def addPath(self, path): if os.path.isfile(path): track = controller.build_track(path) containerAlbum = controller.album_from_tracks([track], u"Singles") self.albumView.model().addAlbum(containerAlbum) else: for album in controller.build_albums(path, recursive=True): self.albumView.model().addAlbum(album)
def test_flush_changes_track(self, album): track = album[0] path = track.path artist = u'Foo' track.artist = artist controller.flush_changes(track) changed_track = controller.build_track(path) assert changed_track.artist == artist
def test_flush_changes_tracks(self, album): artist = u'Foo' tracks = [] for track in album[0:3]: track.artist = artist paths = [track.path for track in tracks] controller.flush_changes(*tracks) for path in paths: changed_track = controller.build_track(path) assert changed_track.artist == artist
def test_build_track_unsupported(self): with pytest.raises(NotImplementedError): controller.build_track('test_Controller.py')
def test_build_track_supported(self): track = controller.build_track('test_songs/PublicDomainSong.mp3') with open('test_songs/PublicDomainFingerprint.txt') as fingerprint: fp = ''.join(fingerprint).strip() assert fp == track.fingerprint
def test_build_track_missing(self): with pytest.raises(controller.NoFileFoundError): controller.build_track('.')