diff --git a/mopidy/audio/playlists.py b/mopidy/audio/playlists.py index 096348a0..2f309e30 100644 --- a/mopidy/audio/playlists.py +++ b/mopidy/audio/playlists.py @@ -218,14 +218,12 @@ class M3uDecoder(BasePlaylistElement): 'Convert .m3u to text/uri-list', 'Mopidy') - sinkpad_template = gst.PadTemplate('sink', - gst.PAD_SINK, - gst.PAD_ALWAYS, + sinkpad_template = gst.PadTemplate( + 'sink', gst.PAD_SINK, gst.PAD_ALWAYS, gst.caps_from_string('audio/x-mpegurl')) - srcpad_template = gst.PadTemplate('src', - gst.PAD_SRC, - gst.PAD_ALWAYS, + srcpad_template = gst.PadTemplate( + 'src', gst.PAD_SRC, gst.PAD_ALWAYS, gst.caps_from_string('text/uri-list')) __gsttemplates__ = (sinkpad_template, srcpad_template) @@ -240,14 +238,12 @@ class PlsDecoder(BasePlaylistElement): 'Convert .pls to text/uri-list', 'Mopidy') - sinkpad_template = gst.PadTemplate('sink', - gst.PAD_SINK, - gst.PAD_ALWAYS, + sinkpad_template = gst.PadTemplate( + 'sink', gst.PAD_SINK, gst.PAD_ALWAYS, gst.caps_from_string('audio/x-scpls')) - srcpad_template = gst.PadTemplate('src', - gst.PAD_SRC, - gst.PAD_ALWAYS, + srcpad_template = gst.PadTemplate( + 'src', gst.PAD_SRC, gst.PAD_ALWAYS, gst.caps_from_string('text/uri-list')) __gsttemplates__ = (sinkpad_template, srcpad_template) @@ -262,14 +258,12 @@ class XspfDecoder(BasePlaylistElement): 'Convert .pls to text/uri-list', 'Mopidy') - sinkpad_template = gst.PadTemplate('sink', - gst.PAD_SINK, - gst.PAD_ALWAYS, + sinkpad_template = gst.PadTemplate( + 'sink', gst.PAD_SINK, gst.PAD_ALWAYS, gst.caps_from_string('application/xspf+xml')) - srcpad_template = gst.PadTemplate('src', - gst.PAD_SRC, - gst.PAD_ALWAYS, + srcpad_template = gst.PadTemplate( + 'src', gst.PAD_SRC, gst.PAD_ALWAYS, gst.caps_from_string('text/uri-list')) __gsttemplates__ = (sinkpad_template, srcpad_template) @@ -284,14 +278,12 @@ class AsxDecoder(BasePlaylistElement): 'Convert .asx to text/uri-list', 'Mopidy') - sinkpad_template = gst.PadTemplate('sink', - gst.PAD_SINK, - gst.PAD_ALWAYS, + sinkpad_template = gst.PadTemplate( + 'sink', gst.PAD_SINK, gst.PAD_ALWAYS, gst.caps_from_string('audio/x-ms-asx')) - srcpad_template = gst.PadTemplate('src', - gst.PAD_SRC, - gst.PAD_ALWAYS, + srcpad_template = gst.PadTemplate( + 'src', gst.PAD_SRC, gst.PAD_ALWAYS, gst.caps_from_string('text/uri-list')) __gsttemplates__ = (sinkpad_template, srcpad_template) @@ -306,14 +298,12 @@ class UriListElement(BasePlaylistElement): 'Convert a text/uri-list to a stream', 'Mopidy') - sinkpad_template = gst.PadTemplate('sink', - gst.PAD_SINK, - gst.PAD_ALWAYS, + sinkpad_template = gst.PadTemplate( + 'sink', gst.PAD_SINK, gst.PAD_ALWAYS, gst.caps_from_string('text/uri-list')) - srcpad_template = gst.PadTemplate('src', - gst.PAD_SRC, - gst.PAD_ALWAYS, + srcpad_template = gst.PadTemplate( + 'src', gst.PAD_SRC, gst.PAD_ALWAYS, gst.caps_new_any()) ghost_srcpad = True # We need to hook this up to our internal decodebin @@ -338,7 +328,7 @@ class UriListElement(BasePlaylistElement): b'Nested playlists not supported.') message = b'Playlists pointing to other playlists is not supported' self.post_message(gst.message_new_error(self, error, message)) - return True + return 1 # GST_PAD_PROBE_OK def handle(self, uris): struct = gst.Structure('urilist-played') @@ -364,9 +354,8 @@ class IcySrc(gst.Bin, gst.URIHandler): 'HTTP src wrapper for icy:// support.', 'Mopidy') - srcpad_template = gst.PadTemplate('src', - gst.PAD_SRC, - gst.PAD_ALWAYS, + srcpad_template = gst.PadTemplate( + 'src', gst.PAD_SRC, gst.PAD_ALWAYS, gst.caps_new_any()) __gsttemplates__ = (srcpad_template,) diff --git a/tests/audio/playlists_test.py b/tests/audio/playlists_test.py index 9f28527e..0f031736 100644 --- a/tests/audio/playlists_test.py +++ b/tests/audio/playlists_test.py @@ -7,13 +7,6 @@ import unittest from mopidy.audio import playlists -class TypeFind(object): - def __init__(self, data): - self.data = data - - def peek(self, start, end): - return self.data[start:end] - BAD = b'foobarbaz' @@ -77,6 +70,14 @@ XSPF = b""" """ +class TypeFind(object): + def __init__(self, data): + self.data = data + + def peek(self, start, end): + return self.data[start:end] + + class BasePlaylistTest(object): valid = None invalid = None