Пример #1
0
    def setUp(self):
        settings.LOCAL_PLAYLIST_PATH = tempfile.mkdtemp()
        settings.LOCAL_TAG_CACHE_FILE = path_to_data_dir('library_tag_cache')
        settings.LOCAL_MUSIC_PATH = path_to_data_dir('')

        self.backend = self.backend_class()
        self.stored  = self.backend.stored_playlists
Пример #2
0
    def test_log_file_that_gst_thinks_is_mpeg_1_is_ignored(self):
        self.scan([path_to_data_dir('scanner/example.log')])

        self.check_if_missing_plugin()

        log = path_to_data_dir('scanner/example.log')
        self.assertLess(self.result[log].duration, 100)
Пример #3
0
 def test_cache_with_blank_track_info(self):
     tracks = parse_mpd_tag_cache(path_to_data_dir('blank_tag_cache'),
                                  path_to_data_dir(''))
     expected = Track(uri='local:track:song1.mp3',
                      length=4000,
                      last_modified=1272319626)
     self.assertEqual(set([expected]), tracks)
Пример #4
0
class LocalPlaybackControllerTest(PlaybackControllerTest, unittest.TestCase):
    backend_class = actor.LocalBackend
    config = {
        'local': {
            'media_dir': path_to_data_dir(''),
            'playlists_dir': b'',
            'tag_cache_file': path_to_data_dir('empty_tag_cache'),
        }
    }
    tracks = [Track(uri=generate_song(i), length=4464) for i in range(1, 4)]

    def add_track(self, path):
        uri = path_to_uri(path_to_data_dir(path))
        track = Track(uri=uri, length=4464)
        self.tracklist.add([track])

    def test_uri_scheme(self):
        self.assertIn('file', self.core.uri_schemes)

    def test_play_mp3(self):
        self.add_track('blank.mp3')
        self.playback.play()
        self.assertEqual(self.playback.state, PlaybackState.PLAYING)

    def test_play_ogg(self):
        self.add_track('blank.ogg')
        self.playback.play()
        self.assertEqual(self.playback.state, PlaybackState.PLAYING)

    def test_play_flac(self):
        self.add_track('blank.flac')
        self.playback.play()
        self.assertEqual(self.playback.state, PlaybackState.PLAYING)
Пример #5
0
    def test_duration_is_set(self):
        self.scan(self.find('scanner/simple'))

        ogg = path_to_data_dir('scanner/simple/song1.ogg')
        mp3 = path_to_data_dir('scanner/simple/song1.mp3')
        self.assertEqual(self.result[mp3].duration, 4680)
        self.assertEqual(self.result[ogg].duration, 4680)
Пример #6
0
    def test_log_file_that_gst_thinks_is_mpeg_1_is_ignored(self):
        self.scan([path_to_data_dir('scanner/example.log')])

        self.check_if_missing_plugin()

        log = path_to_data_dir('scanner/example.log')
        self.assertLess(self.result[log].duration, 100)
Пример #7
0
    def test_duration_is_set(self):
        self.scan(self.find('scanner/simple'))

        self.assertEqual(
            self.durations[path_to_data_dir('scanner/simple/song1.mp3')], 4680)
        self.assertEqual(
            self.durations[path_to_data_dir('scanner/simple/song1.ogg')], 4680)
Пример #8
0
    def setUp(self):
        settings.LOCAL_PLAYLIST_PATH = tempfile.mkdtemp()
        settings.LOCAL_TAG_CACHE_FILE = path_to_data_dir('library_tag_cache')
        settings.LOCAL_MUSIC_PATH = path_to_data_dir('')

        self.backend = self.backend_class()
        self.stored = self.backend.stored_playlists
Пример #9
0
 def test_simple_cache(self):
     tracks = parse_mpd_tag_cache(path_to_data_dir('simple_tag_cache'),
         path_to_data_dir(''))
     uri = path_to_uri(path_to_data_dir('song1.mp3'))
     track = Track(name='trackname', artists=expected_artists, track_no=1,
         album=expected_albums[0], length=4000, uri=uri)
     self.assertEqual(set([track]), tracks)
Пример #10
0
 def test_albumartist_tag_cache(self):
     tracks = parse_mpd_tag_cache(path_to_data_dir("albumartist_tag_cache"), path_to_data_dir(""))
     uri = path_to_uri(path_to_data_dir("song1.mp3"))
     artist = Artist(name="albumartistname")
     album = expected_albums[0].copy(artists=[artist])
     track = Track(name="trackname", artists=expected_artists, track_no=1, album=album, length=4000, uri=uri)
     self.assertEqual(track, list(tracks)[0])
Пример #11
0
 def test_simple_cache(self):
     tracks = parse_mpd_tag_cache(
         path_to_data_dir('simple_tag_cache'), path_to_data_dir(''))
     track = Track(
         uri='local:track:song1.mp3', name='trackname',
         artists=expected_artists, track_no=1, album=expected_albums[0],
         date='2006', length=4000, last_modified=1272319626)
     self.assertEqual(set([track]), tracks)
Пример #12
0
    def setUp(self):
        settings.LOCAL_PLAYLIST_PATH = tempfile.mkdtemp()
        settings.LOCAL_TAG_CACHE_FILE = path_to_data_dir('library_tag_cache')
        settings.LOCAL_MUSIC_PATH = path_to_data_dir('')

        self.audio = mock.Mock(spec=audio.Audio)
        self.backend = self.backend_class.start(audio=self.audio).proxy()
        self.core = core.Core(backends=[self.backend])
Пример #13
0
 def test_uri_is_set(self):
     self.scan('scanner/simple')
     self.check(
         'scanner/simple/song1.mp3', 'uri',
         'file://%s' % path_to_data_dir('scanner/simple/song1.mp3'))
     self.check(
         'scanner/simple/song1.ogg', 'uri',
         'file://%s' % path_to_data_dir('scanner/simple/song1.ogg'))
Пример #14
0
 def test_simple_cache(self):
     tracks = parse_mpd_tag_cache(
         path_to_data_dir('simple_tag_cache'), path_to_data_dir(''))
     uri = path_to_uri(path_to_data_dir('song1.mp3'))
     track = Track(
         uri=uri, name='trackname', artists=expected_artists, track_no=1,
         album=expected_albums[0], date='2006', length=4000)
     self.assertEqual(set([track]), tracks)
Пример #15
0
    def test_find_exact_uri(self):
        track_1_uri = 'file://' + path_to_data_dir('uri1')
        result = self.library.find_exact(uri=track_1_uri)
        self.assertEqual(list(result[0].tracks), self.tracks[:1])

        track_2_uri = 'file://' + path_to_data_dir('uri2')
        result = self.library.find_exact(uri=track_2_uri)
        self.assertEqual(list(result[0].tracks), self.tracks[1:2])
Пример #16
0
 def test_simple_cache(self):
     tracks = parse_mpd_tag_cache(
         path_to_data_dir('simple_tag_cache'), path_to_data_dir(''))
     track = Track(
         uri='local:track:song1.mp3', name='trackname',
         artists=expected_artists, track_no=1, album=expected_albums[0],
         date='2006', length=4000, last_modified=1272319626)
     self.assertEqual(set([track]), tracks)
Пример #17
0
 def test_uri_is_set(self):
     self.scan(self.find('scanner/simple'))
     self.check(
         'scanner/simple/song1.mp3', 'uri',
         'file://%s' % path_to_data_dir('scanner/simple/song1.mp3'))
     self.check(
         'scanner/simple/song1.ogg', 'uri',
         'file://%s' % path_to_data_dir('scanner/simple/song1.ogg'))
Пример #18
0
    def setUp(self):
        settings.LOCAL_PLAYLIST_PATH = tempfile.mkdtemp()
        settings.LOCAL_TAG_CACHE_FILE = path_to_data_dir('library_tag_cache')
        settings.LOCAL_MUSIC_PATH = path_to_data_dir('')

        self.audio = audio.DummyAudio.start().proxy()
        self.backend = self.backend_class.start(audio=self.audio).proxy()
        self.core = core.Core(backends=[self.backend])
Пример #19
0
    def test_find_exact_uri(self):
        track_1_uri = 'file://' + path_to_data_dir('uri1')
        result = self.library.find_exact(uri=track_1_uri)
        self.assertEqual(list(result[0].tracks), self.tracks[:1])

        track_2_uri = 'file://' + path_to_data_dir('uri2')
        result = self.library.find_exact(uri=track_2_uri)
        self.assertEqual(list(result[0].tracks), self.tracks[1:2])
Пример #20
0
class LocalBackendEventsTest(events.BackendEventsTest, unittest.TestCase):
    backend_class = actor.LocalBackend
    config = {
        'local': {
            'media_dir': path_to_data_dir(''),
            'playlists_dir': b'',
            'tag_cache_file': path_to_data_dir('empty_tag_cache'),
        }
    }
Пример #21
0
    def test_duration_is_set(self):
        self.scan(self.find("scanner/simple"))

        self.check_if_missing_plugin()

        ogg = path_to_data_dir("scanner/simple/song1.ogg")
        mp3 = path_to_data_dir("scanner/simple/song1.mp3")
        assert self.result[mp3].duration == 4680
        assert self.result[ogg].duration == 4680
Пример #22
0
    def test_unicode_cache(self):
        tracks = parse_mpd_tag_cache(path_to_data_dir("utf8_tag_cache"), path_to_data_dir(""))

        uri = path_to_uri(path_to_data_dir("song1.mp3"))
        artists = [Artist(name=u"æøå")]
        album = Album(name=u"æøå", artists=artists)
        track = Track(uri=uri, name=u"æøå", artists=artists, album=album, length=4000)

        self.assertEqual(track, list(tracks)[0])
Пример #23
0
class LocalLibraryControllerTest(LibraryControllerTest, unittest.TestCase):
    backend_class = actor.LocalBackend
    config = {
        'local': {
            'media_dir': path_to_data_dir(''),
            'playlists_dir': b'',
            'tag_cache_file': path_to_data_dir('library_tag_cache'),
        }
    }
Пример #24
0
 def test_albumartist_tag_cache(self):
     tracks = parse_mpd_tag_cache(
         path_to_data_dir('albumartist_tag_cache'), path_to_data_dir(''))
     uri = path_to_uri(path_to_data_dir('song1.mp3'))
     artist = Artist(name='albumartistname')
     album = expected_albums[0].copy(artists=[artist])
     track = Track(
         uri=uri, name='trackname', artists=expected_artists, track_no=1,
         album=album, date='2006', length=4000)
     self.assertEqual(track, list(tracks)[0])
Пример #25
0
 def test_albumartist_tag_cache(self):
     tracks = parse_mpd_tag_cache(
         path_to_data_dir('albumartist_tag_cache'), path_to_data_dir(''))
     artist = Artist(name='albumartistname')
     album = expected_albums[0].copy(artists=[artist])
     track = Track(
         uri='local:track:song1.mp3', name='trackname',
         artists=expected_artists, track_no=1, album=album, date='2006',
         length=4000, last_modified=1272319626)
     self.assertEqual(track, list(tracks)[0])
Пример #26
0
class LocalTracklistControllerTest(TracklistControllerTest, unittest.TestCase):
    backend_class = actor.LocalBackend
    config = {
        'local': {
            'media_dir': path_to_data_dir(''),
            'playlists_dir': b'',
            'tag_cache_file': path_to_data_dir('empty_tag_cache'),
        }
    }
    tracks = [Track(uri=generate_song(i), length=4464) for i in range(1, 4)]
Пример #27
0
 def test_albumartist_tag_cache(self):
     tracks = parse_mpd_tag_cache(
         path_to_data_dir('albumartist_tag_cache'), path_to_data_dir(''))
     artist = Artist(name='albumartistname')
     album = expected_albums[0].copy(artists=[artist])
     track = Track(
         uri='local:track:song1.mp3', name='trackname',
         artists=expected_artists, track_no=1, album=album, date='2006',
         length=4000, last_modified=1272319626)
     self.assertEqual(track, list(tracks)[0])
Пример #28
0
 def test_albumartist_tag_cache(self):
     tracks = parse_mpd_tag_cache(
         path_to_data_dir('albumartist_tag_cache'), path_to_data_dir(''))
     uri = path_to_uri(path_to_data_dir('song1.mp3'))
     artist = Artist(name='albumartistname')
     album = expected_albums[0].copy(artists=[artist])
     track = Track(
         uri=uri, name='trackname', artists=expected_artists, track_no=1,
         album=album, date='2006', length=4000)
     self.assertEqual(track, list(tracks)[0])
Пример #29
0
    def test_unicode_cache(self):
        tracks = parse_mpd_tag_cache(
            path_to_data_dir('utf8_tag_cache'), path_to_data_dir(''))

        uri = path_to_uri(path_to_data_dir('song1.mp3'))
        artists = [Artist(name='æøå')]
        album = Album(name='æøå', artists=artists)
        track = Track(
            uri=uri, name='æøå', artists=artists, album=album, length=4000)

        self.assertEqual(track, list(tracks)[0])
Пример #30
0
    def test_unicode_cache(self):
        tracks = parse_mpd_tag_cache(
            path_to_data_dir('utf8_tag_cache'), path_to_data_dir(''))

        artists = [Artist(name='æøå')]
        album = Album(name='æøå', artists=artists)
        track = Track(
            uri='local:track:song1.mp3', name='æøå', artists=artists,
            album=album, length=4000, last_modified=1272319626)

        self.assertEqual(track, list(tracks)[0])
Пример #31
0
    def test_unicode_cache(self):
        tracks = parse_mpd_tag_cache(
            path_to_data_dir('utf8_tag_cache'), path_to_data_dir(''))

        artists = [Artist(name='æøå')]
        album = Album(name='æøå', artists=artists)
        track = Track(
            uri='local:track:song1.mp3', name='æøå', artists=artists,
            composers=artists, performers=artists, genre='æøå',
            album=album, length=4000, last_modified=1272319626,
            comment='æøå&^`ൂ㔶')

        self.assertEqual(track, list(tracks)[0])
Пример #32
0
    def test_musicbrainz_tagcache(self):
        tracks = parse_mpd_tag_cache(path_to_data_dir('musicbrainz_tag_cache'),
            path_to_data_dir(''))
        artist = list(expected_tracks[0].artists)[0].copy(
            musicbrainz_id='7364dea6-ca9a-48e3-be01-b44ad0d19897')
        albumartist = list(expected_tracks[0].artists)[0].copy(
            name='albumartistname',
            musicbrainz_id='7364dea6-ca9a-48e3-be01-b44ad0d19897')
        album = expected_tracks[0].album.copy(artists=[albumartist],
            musicbrainz_id='cb5f1603-d314-4c9c-91e5-e295cfb125d2')
        track = expected_tracks[0].copy(artists=[artist], album=album,
            musicbrainz_id='90488461-8c1f-4a4e-826b-4c6dc70801f0')

        self.assertEqual(track, list(tracks)[0])
Пример #33
0
class JsonLibraryTest(unittest.TestCase):

    config = {
        'core': {
            'data_dir': path_to_data_dir(''),
        },
        'local': {
            'media_dir': path_to_data_dir(''),
            'library': 'json',
        },
    }

    def setUp(self):  # noqa: N802
        self.library = json.JsonLibrary(self.config)

    def _create_tracks(self, count):
        for i in range(count):
            self.library.add(Track(uri='local:track:%d' % i))

    def test_search_should_default_limit_results(self):
        self._create_tracks(101)

        result = self.library.search()
        result_exact = self.library.search(exact=True)

        self.assertEqual(len(result.tracks), 100)
        self.assertEqual(len(result_exact.tracks), 100)

    def test_search_should_limit_results(self):
        self._create_tracks(100)

        result = self.library.search(limit=35)
        result_exact = self.library.search(exact=True, limit=35)

        self.assertEqual(len(result.tracks), 35)
        self.assertEqual(len(result_exact.tracks), 35)

    def test_search_should_offset_results(self):
        self._create_tracks(200)

        expected = self.library.search(limit=110).tracks[10:]
        expected_exact = self.library.search(exact=True, limit=110).tracks[10:]

        result = self.library.search(offset=10).tracks
        result_exact = self.library.search(offset=10, exact=True).tracks

        self.assertEqual(expected, result)
        self.assertEqual(expected_exact, result_exact)
Пример #34
0
    def test_musicbrainz_tagcache(self):
        tracks = parse_mpd_tag_cache(
            path_to_data_dir('musicbrainz_tag_cache'), path_to_data_dir(''))
        artist = list(expected_tracks[0].artists)[0].copy(
            musicbrainz_id='7364dea6-ca9a-48e3-be01-b44ad0d19897')
        albumartist = list(expected_tracks[0].artists)[0].copy(
            name='albumartistname',
            musicbrainz_id='7364dea6-ca9a-48e3-be01-b44ad0d19897')
        album = expected_tracks[0].album.copy(
            artists=[albumartist],
            musicbrainz_id='cb5f1603-d314-4c9c-91e5-e295cfb125d2')
        track = expected_tracks[0].copy(
            artists=[artist], album=album,
            musicbrainz_id='90488461-8c1f-4a4e-826b-4c6dc70801f0')

        self.assertEqual(track, list(tracks)[0])
Пример #35
0
 def test_files(self):
     mtimes = self.find('find')
     expected_files = [
         b'find/foo/bar/file', b'find/foo/file', b'find/baz/file'
     ]
     expected = {path_to_data_dir(p): any_int for p in expected_files}
     self.assertEqual(expected, mtimes)
Пример #36
0
    def test_refresh_missing_uri(self):
        # Verifies that https://github.com/mopidy/mopidy/issues/500
        # has been fixed.

        tmpdir = tempfile.mkdtemp()
        try:
            tmplib = os.path.join(tmpdir, 'library.json.gz')
            shutil.copy(path_to_data_dir('library.json.gz'), tmplib)

            config = {'local': self.config['local'].copy()}
            config['local']['data_dir'] = tmpdir
            backend = actor.LocalBackend(config=config, audio=None)

            # Sanity check that value is in the library
            result = backend.library.lookup(self.tracks[0].uri)
            self.assertEqual(result, self.tracks[0:1])

            # Clear and refresh.
            open(tmplib, 'w').close()
            backend.library.refresh()

            # Now it should be gone.
            result = backend.library.lookup(self.tracks[0].uri)
            self.assertEqual(result, [])

        finally:
            shutil.rmtree(tmpdir)
Пример #37
0
def generate_track(path, ident):
    uri = path_to_uri(path_to_data_dir(path))
    track = Track(name='trackname',
                  artists=expected_artists,
                  track_no=1,
                  album=expected_albums[0],
                  length=4000,
                  uri=uri)
    expected_tracks.append(track)
Пример #38
0
 def setUp(self):
     config = {
         'audio': {
             'mixer': 'fakemixer track_max_volume=65536',
             'mixer_track': None,
             'output': 'fakesink',
         }
     }
     self.song_uri = path_to_uri(path_to_data_dir('song1.wav'))
     self.audio = audio.Audio.start(config=config).proxy()
Пример #39
0
 def scan(self, path):
     paths = path_lib.find_files(path_to_data_dir(path))
     uris = (path_lib.path_to_uri(p) for p in paths)
     scanner = scan.Scanner()
     for uri in uris:
         key = uri[len('file://'):]
         try:
             self.data[key] = scanner.scan(uri)
         except exceptions.ScannerError as error:
             self.errors[key] = error
Пример #40
0
class BaseTest(unittest.TestCase):
    config = {
        'audio': {
            'buffer_time': None,
            'mixer': 'fakemixer track_max_volume=65536',
            'mixer_track': None,
            'mixer_volume': None,
            'output': 'testoutput',
            'visualizer': None,
        }
    }

    uris = [
        path.path_to_uri(path_to_data_dir('song1.wav')),
        path.path_to_uri(path_to_data_dir('song2.wav'))
    ]

    audio_class = audio.Audio

    def setUp(self):  # noqa: N802
        config = {
            'audio': {
                'buffer_time': None,
                'mixer': 'foomixer',
                'mixer_volume': None,
                'output': 'testoutput',
                'visualizer': None,
            },
            'proxy': {
                'hostname': '',
            },
        }
        self.song_uri = path.path_to_uri(path_to_data_dir('song1.wav'))
        self.audio = self.audio_class.start(config=config, mixer=None).proxy()

    def tearDown(self):  # noqa
        pykka.ActorRegistry.stop_all()

    def possibly_trigger_fake_playback_error(self, uri):
        pass

    def possibly_trigger_fake_about_to_finish(self):
        pass
Пример #41
0
 def setUp(self):
     config = {
         'audio': {
             'mixer': 'fakemixer track_max_volume=65536',
             'mixer_track': None,
             'output': 'fakesink',
         }
     }
     self.song_uri = path_to_uri(path_to_data_dir('song1.wav'))
     self.audio = audio.Audio.start(config=config).proxy()
Пример #42
0
def config():
    return {
        "proxy": {},
        "file": {
            "show_dotfiles": False,
            "media_dirs": [str(path_to_data_dir(""))],
            "excluded_file_extensions": [],
            "follow_symlinks": False,
            "metadata_timeout": 1000,
        },
    }
Пример #43
0
class BaseTest(unittest.TestCase):
    config = {
        "audio": {
            "buffer_time": None,
            "mixer": "fakemixer track_max_volume=65536",
            "mixer_track": None,
            "mixer_volume": None,
            "output": "testoutput",
            "visualizer": None,
        }
    }

    uris = [
        path.path_to_uri(path_to_data_dir("song1.wav")),
        path.path_to_uri(path_to_data_dir("song2.wav")),
    ]

    audio_class = audio.Audio

    def setUp(self):  # noqa: N802
        config = {
            "audio": {
                "buffer_time": None,
                "mixer": "foomixer",
                "mixer_volume": None,
                "output": "testoutput",
                "visualizer": None,
            },
            "proxy": {"hostname": ""},
        }
        self.song_uri = path.path_to_uri(path_to_data_dir("song1.wav"))
        self.audio = self.audio_class.start(config=config, mixer=None).proxy()

    def tearDown(self):  # noqa
        pykka.ActorRegistry.stop_all()

    def possibly_trigger_fake_playback_error(self, uri):
        pass

    def possibly_trigger_fake_about_to_finish(self):
        pass
Пример #44
0
    def test_playlists_are_loaded_at_startup(self):
        track = Track(uri=path_to_uri(path_to_data_dir('uri2')))
        playlist = Playlist(tracks=[track], name='test')

        self.stored.save(playlist)

        self.backend = self.backend_class()
        self.stored = self.backend.stored_playlists

        self.assert_(self.stored.playlists)
        self.assertEqual('test', self.stored.playlists[0].name)
        self.assertEqual(track.uri, self.stored.playlists[0].tracks[0].uri)
Пример #45
0
    def test_playlists_are_loaded_at_startup(self):
        track = Track(uri=path_to_uri(path_to_data_dir('uri2')))
        playlist = Playlist(tracks=[track], name='test')

        self.stored.save(playlist)

        self.backend = self.backend_class()
        self.stored = self.backend.stored_playlists

        self.assert_(self.stored.playlists)
        self.assertEqual('test', self.stored.playlists[0].name)
        self.assertEqual(track.uri, self.stored.playlists[0].tracks[0].uri)
Пример #46
0
class LocalBackendEventsTest(unittest.TestCase):
    config = {
        'local': {
            'media_dir': path_to_data_dir(''),
            'playlists_dir': b'',
            'tag_cache_file': path_to_data_dir('empty_tag_cache'),
        }
    }

    def setUp(self):
        self.audio = audio.DummyAudio.start().proxy()
        self.backend = actor.LocalBackend.start(config=self.config,
                                                audio=self.audio).proxy()
        self.core = core.Core.start(backends=[self.backend]).proxy()

    def tearDown(self):
        pykka.ActorRegistry.stop_all()

    def test_playlists_refresh_sends_playlists_loaded_event(self, send):
        send.reset_mock()
        self.core.playlists.refresh().get()
        self.assertEqual(send.call_args[0][0], 'playlists_loaded')
Пример #47
0
 def setUp(self):
     config = {
         'audio': {
             'mixer': 'foomixer',
             'mixer_volume': None,
             'output': 'fakesink',
             'visualizer': None,
         },
         'proxy': {
             'hostname': '',
         },
     }
     self.song_uri = path_to_uri(path_to_data_dir('song1.wav'))
     self.audio = audio.Audio.start(config=config, mixer=None).proxy()
Пример #48
0
 def setUp(self):  # noqa: N802
     config = {
         'audio': {
             'mixer': 'foomixer',
             'mixer_volume': None,
             'output': 'testoutput',
             'visualizer': None,
         },
         'proxy': {
             'hostname': '',
         },
     }
     self.song_uri = path_to_uri(path_to_data_dir('song1.wav'))
     self.audio = self.audio_class.start(config=config, mixer=None).proxy()
Пример #49
0
    def test_playlists_are_loaded_at_startup(self):
        playlist_path = os.path.join(self.playlists_dir, 'test.m3u')

        track = Track(uri=path_to_uri(path_to_data_dir('uri2')))
        playlist = self.core.playlists.create('test')
        playlist = playlist.copy(tracks=[track])
        playlist = self.core.playlists.save(playlist)

        backend = self.backend_class(config=self.config, audio=self.audio)

        self.assert_(backend.playlists.playlists)
        self.assertEqual(
            path_to_uri(playlist_path),
            backend.playlists.playlists[0].uri)
        self.assertEqual(
            playlist.name, backend.playlists.playlists[0].name)
        self.assertEqual(
            track.uri, backend.playlists.playlists[0].tracks[0].uri)
Пример #50
0
 def find(self, value):
     return list(path.find_files(path_to_data_dir(value)))
Пример #51
0
 def check(self, name, key, value):
     name = path_to_data_dir(name)
     self.assertEqual(self.data[name][key], value)
Пример #52
0
 def scan(self, path):
     scanner = Scanner(
         path_to_data_dir(path), self.data_callback, self.error_callback)
     scanner.start()
Пример #53
0
 def setUp(self):
     settings.MIXER = 'fakemixer track_max_volume=65536'
     settings.OUTPUT = 'fakesink'
     self.song_uri = path_to_uri(path_to_data_dir('song1.wav'))
     self.audio = audio.Audio.start().proxy()
Пример #54
0
 def test_file(self):
     files = self.find('blank.mp3')
     self.assertEqual(len(files), 1)
     self.assert_(files[0], path_to_data_dir('blank.mp3'))
Пример #55
0
def test_lookup_respects_blacklist_globbing(backend, track_uri):
    blacklist = [path.path_to_uri(path_to_data_dir("")) + "*"]
    library = actor.StreamLibraryProvider(backend, blacklist)

    assert library.lookup(track_uri) == [Track(uri=track_uri)]
Пример #56
0
def track_uri():
    return path.path_to_uri(path_to_data_dir("song1.wav"))
Пример #57
0
 def test_empty_wav_file_is_ignored(self):
     self.scan([path_to_data_dir('scanner/empty.wav')])
     self.assert_(self.errors)