Exemple #1
0
    def setUp(self):
        settings.LOCAL_PLAYLIST_PATH = tempfile.mkdtemp()
        settings.LOCAL_TAG_CACHE_FILE = data_folder('library_tag_cache')
        settings.LOCAL_MUSIC_PATH = data_folder('')

        self.backend = self.backend_class(mixer_class=DummyMixer)
        self.stored  = self.backend.stored_playlists
Exemple #2
0
 def test_simple_cache(self):
     tracks = parse_mpd_tag_cache(data_folder('simple_tag_cache'),
         data_folder(''))
     uri = path_to_uri(data_folder('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)
Exemple #3
0
 def test_albumartist_tag_cache(self):
     tracks = parse_mpd_tag_cache(data_folder('albumartist_tag_cache'),
         data_folder(''))
     uri = path_to_uri(data_folder('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])
Exemple #4
0
    def test_unicode_cache(self):
        tracks = parse_mpd_tag_cache(data_folder('utf8_tag_cache'),
             data_folder(''))

        uri = path_to_uri(data_folder('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])
Exemple #5
0
    def test_musicbrainz_tagcache(self):
        tracks = parse_mpd_tag_cache(data_folder('musicbrainz_tag_cache'),
            data_folder(''))
        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])
Exemple #6
0
    def test_playlists_are_loaded_at_startup(self):
        track = Track(uri=path_to_uri(data_folder("uri2")))
        playlist = Playlist(tracks=[track], name="test")

        self.stored.save(playlist)

        self.backend.destroy()
        self.backend = self.backend_class(mixer_class=DummyMixer)
        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)
Exemple #7
0
 def test_empty_file(self):
     uris = parse_m3u(data_folder('empty.m3u'))
     self.assertEqual([], uris)
Exemple #8
0
 def test_emtpy_cache(self):
     tracks = parse_mpd_tag_cache(data_folder('empty_tag_cache'),
         data_folder(''))
     self.assertEqual(set(), tracks)
Exemple #9
0
    def setUp(self):
        settings.LOCAL_TAG_CACHE_FILE = data_folder('library_tag_cache')
        settings.LOCAL_MUSIC_PATH = data_folder('')

        super(LocalLibraryControllerTest, self).setUp()
Exemple #10
0
 def test_open_missing_file(self):
     uris = parse_m3u(data_folder('non-existant.m3u'))
     self.assertEqual([], uris)
Exemple #11
0
def generate_track(path, ident):
    uri = path_to_uri(data_folder(path))
    track = Track(name='trackname', artists=expected_artists, track_no=1,
        album=expected_albums[0], length=4000, uri=uri)
    expected_tracks.append(track)
Exemple #12
0
 def test_file_with_comment(self):
     uris = parse_m3u(data_folder('comment.m3u'))
     self.assertEqual([song1_uri], uris)
Exemple #13
0
 def test_encoding_is_latin1(self):
     uris = parse_m3u(data_folder('encoding.m3u'))
     self.assertEqual([encoded_uri], uris)
Exemple #14
0
 def check(self, name, key, value):
     name = data_folder(name)
     self.assertEqual(self.data[name][key], value)
Exemple #15
0
 def find(self, path):
     return list(find_files(data_folder(path)))
Exemple #16
0
from mopidy.utils.path import path_to_uri

from tests import data_folder

song = data_folder("song%s.wav")
generate_song = lambda i: path_to_uri(song % i)
Exemple #17
0
 def test_file(self):
     files = self.find('blank.mp3')
     self.assertEqual(len(files), 1)
     self.assert_(files[0], data_folder('blank.mp3'))
Exemple #18
0
 def test_cache_with_blank_track_info(self):
     tracks = parse_mpd_tag_cache(data_folder('blank_tag_cache'),
         data_folder(''))
     uri = path_to_uri(data_folder('song1.mp3'))
     self.assertEqual(set([Track(uri=uri, length=4000)]), tracks)
Exemple #19
0
# encoding: utf-8

import os
import tempfile
import unittest

from mopidy.utils.path import path_to_uri
from mopidy.backends.local.translator import parse_m3u, parse_mpd_tag_cache
from mopidy.models import Track, Artist, Album

from tests import SkipTest, data_folder

song1_path = data_folder('song1.mp3')
song2_path = data_folder('song2.mp3')
encoded_path = data_folder(u'æøå.mp3')
song1_uri = path_to_uri(song1_path)
song2_uri = path_to_uri(song2_path)
encoded_uri = path_to_uri(encoded_path)

class M3UToUriTest(unittest.TestCase):
    def test_empty_file(self):
        uris = parse_m3u(data_folder('empty.m3u'))
        self.assertEqual([], uris)

    def test_basic_file(self):
        uris = parse_m3u(data_folder('one.m3u'))
        self.assertEqual([song1_uri], uris)

    def test_file_with_comment(self):
        uris = parse_m3u(data_folder('comment.m3u'))
        self.assertEqual([song1_uri], uris)
Exemple #20
0
 def test_advanced_cache(self):
     tracks = parse_mpd_tag_cache(data_folder('advanced_tag_cache'),
          data_folder(''))
     self.assertEqual(set(expected_tracks), tracks)
Exemple #21
0
 def scan(self, path):
     scanner = Scanner(data_folder(path), self.data_callback, self.error_callback)
     scanner.start()
Exemple #22
0
 def test_basic_file(self):
     uris = parse_m3u(data_folder('one.m3u'))
     self.assertEqual([song1_uri], uris)
Exemple #23
0
 def test_uri_is_set(self):
     self.scan("scanner/simple")
     self.check("scanner/simple/song1.mp3", "uri", "file://" + data_folder("scanner/simple/song1.mp3"))
Exemple #24
0
 def setUp(self):
     settings.BACKENDS = ('mopidy.backends.local.LocalBackend',)
     self.song_uri = path_to_uri(data_folder('song1.wav'))
     self.core_queue = multiprocessing.Queue()
     self.output = GStreamerOutput(self.core_queue)
     self.output.start()