def setUp(self): super(PlaylistTestCase, self).setUp() root = Folder() root.root = True root.name = 'Root folder' root.path = 'tests/assets' self.store.add(root) artist = Artist() artist.name = 'Artist' album = Album() album.name = 'Album' album.artist = artist songs = {} for num, song in enumerate(['One', 'Two', 'Three', 'Four']): track = Track() track.disc = 1 track.number = num track.title = song track.duration = 2 track.album = album track.artist = artist track.bitrate = 320 track.path = 'tests/assets/empty' track.content_type = 'audio/mpeg' track.last_modification = 0 track.root_folder = root track.folder = root self.store.add(track) songs[song] = track users = {u.name: u for u in self.store.find(User)} playlist = Playlist() playlist.user = users['alice'] playlist.name = "Alice's" playlist.add(songs['One']) playlist.add(songs['Three']) self.store.add(playlist) playlist = Playlist() playlist.user = users['alice'] playlist.public = True playlist.name = "Alice's public" playlist.add(songs['One']) playlist.add(songs['Two']) self.store.add(playlist) playlist = Playlist() playlist.user = users['bob'] playlist.name = "Bob's" playlist.add(songs['Two']) playlist.add(songs['Four']) self.store.add(playlist) self.store.commit()
def setUp(self): super(MediaTestCase, self).setUp() self.folder = Folder() self.folder.name = 'Root' self.folder.path = os.path.abspath('tests/assets') self.folder.root = True self.folder.has_cover_art = True # 420x420 PNG artist = Artist() artist.name = 'Artist' album = Album() album.artist = artist album.name = 'Album' self.track = Track() self.track.title = '23bytes' self.track.number = 1 self.track.disc = 1 self.track.artist = artist self.track.album = album self.track.path = os.path.abspath('tests/assets/23bytes') self.track.root_folder = self.folder self.track.folder = self.folder self.track.duration = 2 self.track.bitrate = 320 self.track.content_type = 'audio/mpeg' self.track.last_modification = 0 self.store.add(self.track) self.store.commit()
def setUp(self): super(BrowseTestCase, self).setUp() empty = Folder() empty.root = True empty.name = 'Empty root' empty.path = '/tmp' self.store.add(empty) root = Folder() root.root = True root.name = 'Root folder' root.path = 'tests/assets' self.store.add(root) for letter in 'ABC': folder = Folder() folder.name = letter + 'rtist' folder.path = 'tests/assets/{}rtist'.format(letter) folder.parent = root artist = Artist() artist.name = letter + 'rtist' for lether in 'AB': afolder = Folder() afolder.name = letter + lether + 'lbum' afolder.path = 'tests/assets/{0}rtist/{0}{1}lbum'.format( letter, lether) afolder.parent = folder album = Album() album.name = letter + lether + 'lbum' album.artist = artist for num, song in enumerate(['One', 'Two', 'Three']): track = Track() track.disc = 1 track.number = num track.title = song track.duration = 2 track.album = album track.artist = artist track.bitrate = 320 track.path = 'tests/assets/{0}rtist/{0}{1}lbum/{2}'.format( letter, lether, song) track.content_type = 'audio/mpeg' track.last_modification = 0 track.root_folder = root track.folder = afolder self.store.add(track) self.store.commit() self.assertEqual(self.store.find(Folder).count(), 11) self.assertEqual( self.store.find(Folder, Folder.root == True).count(), 2) self.assertEqual(self.store.find(Artist).count(), 3) self.assertEqual(self.store.find(Album).count(), 6) self.assertEqual(self.store.find(Track).count(), 18)
def setUp(self): super(AlbumSongsTestCase, self).setUp() folder = Folder() folder.name = 'Root' folder.root = True folder.path = 'tests/assets' artist = Artist() artist.name = 'Artist' album = Album() album.name = 'Album' album.artist = artist track = Track() track.title = 'Track' track.album = album track.artist = artist track.disc = 1 track.number = 1 track.path = 'tests/assets/empty' track.folder = folder track.root_folder = folder track.duration = 2 track.bitrate = 320 track.content_type = 'audio/mpeg' track.last_modification = 0 self.store.add(track) self.store.commit()
def setUp(self): super(MediaTestCase, self).setUp() self.folder = Folder() self.folder.name = 'Root' self.folder.path = os.path.abspath('tests/assets') self.folder.root = True self.folder.has_cover_art = True # 420x420 PNG artist = Artist() artist.name = 'Artist' album = Album() album.artist = artist album.name = 'Album' self.track = Track() self.track.title = '23bytes' self.track.number = 1 self.track.disc = 1 self.track.artist = artist self.track.album = album self.track.path = os.path.abspath('tests/assets/23bytes') self.track.root_folder = self.folder self.track.folder = self.folder self.track.duration = 2 self.track.bitrate = 320 self.track.content_type = 'audio/mpeg' self.track.last_modification = 0 self.store.add(self.track) self.store.commit()
def setUp(self): super(PlaylistTestCase, self).setUp() root = Folder() root.root = True root.name = 'Root folder' root.path = 'tests/assets' self.store.add(root) artist = Artist() artist.name = 'Artist' album = Album() album.name = 'Album' album.artist = artist songs = {} for num, song in enumerate([ 'One', 'Two', 'Three', 'Four' ]): track = Track() track.disc = 1 track.number = num track.title = song track.duration = 2 track.album = album track.artist = artist track.bitrate = 320 track.path = 'tests/assets/empty' track.content_type = 'audio/mpeg' track.last_modification = 0 track.root_folder = root track.folder = root self.store.add(track) songs[song] = track users = { u.name: u for u in self.store.find(User) } playlist = Playlist() playlist.user = users['alice'] playlist.name = "Alice's" playlist.add(songs['One']) playlist.add(songs['Three']) self.store.add(playlist) playlist = Playlist() playlist.user = users['alice'] playlist.public = True playlist.name = "Alice's public" playlist.add(songs['One']) playlist.add(songs['Two']) self.store.add(playlist) playlist = Playlist() playlist.user = users['bob'] playlist.name = "Bob's" playlist.add(songs['Two']) playlist.add(songs['Four']) self.store.add(playlist) self.store.commit()
def setUp(self): super(BrowseTestCase, self).setUp() empty = Folder() empty.root = True empty.name = 'Empty root' empty.path = '/tmp' self.store.add(empty) root = Folder() root.root = True root.name = 'Root folder' root.path = 'tests/assets' self.store.add(root) for letter in 'ABC': folder = Folder() folder.name = letter + 'rtist' folder.path = 'tests/assets/{}rtist'.format(letter) folder.parent = root artist = Artist() artist.name = letter + 'rtist' for lether in 'AB': afolder = Folder() afolder.name = letter + lether + 'lbum' afolder.path = 'tests/assets/{0}rtist/{0}{1}lbum'.format(letter, lether) afolder.parent = folder album = Album() album.name = letter + lether + 'lbum' album.artist = artist for num, song in enumerate([ 'One', 'Two', 'Three' ]): track = Track() track.disc = 1 track.number = num track.title = song track.duration = 2 track.album = album track.artist = artist track.bitrate = 320 track.path = 'tests/assets/{0}rtist/{0}{1}lbum/{2}'.format(letter, lether, song) track.content_type = 'audio/mpeg' track.last_modification = 0 track.root_folder = root track.folder = afolder self.store.add(track) self.store.commit() self.assertEqual(self.store.find(Folder).count(), 11) self.assertEqual(self.store.find(Folder, Folder.root == True).count(), 2) self.assertEqual(self.store.find(Artist).count(), 3) self.assertEqual(self.store.find(Album).count(), 6) self.assertEqual(self.store.find(Track).count(), 18)
def __find_artist(self, artist): ar = self.__store.find(Artist, Artist.name == artist).one() if ar: return ar ar = Artist() ar.name = artist self.__store.add(ar) self.__added_artists += 1 return ar
def __find_artist(self, artist): ar = self.__store.find(Artist, Artist.name == artist).one() if ar: return ar ar = Artist() ar.name = artist self.__store.add(ar) self.__added_artists += 1 return ar
def setUp(self): super(AnnotationTestCase, self).setUp() root = Folder() root.name = 'Root' root.root = True root.path = 'tests/assets' folder = Folder() folder.name = 'Folder' folder.path = 'tests/assets' folder.parent = root artist = Artist() artist.name = 'Artist' album = Album() album.name = 'Album' album.artist = artist track = Track() track.title = 'Track' track.album = album track.artist = artist track.disc = 1 track.number = 1 track.path = 'tests/assets/empty' track.folder = folder track.root_folder = root track.duration = 2 track.bitrate = 320 track.content_type = 'audio/mpeg' track.last_modification = 0 self.store.add(track) self.store.commit() self.folder = folder self.artist = artist self.album = album self.track = track self.user = self.store.find(User, User.name == 'alice').one()
def setUp(self): super(PlaylistTestCase, self).setUp() folder = Folder() folder.name = 'Root' folder.path = 'tests/assets' folder.root = True artist = Artist() artist.name = 'Artist!' album = Album() album.name = 'Album!' album.artist = artist track = Track() track.path = 'tests/assets/23bytes' track.title = '23bytes' track.artist = artist track.album = album track.folder = folder track.root_folder = folder track.duration = 2 track.disc = 1 track.number = 1 track.content_type = 'audio/mpeg' track.bitrate = 320 track.last_modification = 0 playlist = Playlist() playlist.name = 'Playlist!' playlist.user = self.store.find(User, User.name == 'alice').one() for _ in range(4): playlist.add(track) self.store.add(track) self.store.add(playlist) self.store.commit() self.playlist = playlist
def setUp(self): super(PlaylistTestCase, self).setUp() folder = Folder() folder.name = 'Root' folder.path = 'tests/assets' folder.root = True artist = Artist() artist.name = 'Artist!' album = Album() album.name = 'Album!' album.artist = artist track = Track() track.path = 'tests/assets/23bytes' track.title = '23bytes' track.artist = artist track.album = album track.folder = folder track.root_folder = folder track.duration = 2 track.disc = 1 track.number = 1 track.content_type = 'audio/mpeg' track.bitrate = 320 track.last_modification = 0 playlist = Playlist() playlist.name = 'Playlist!' playlist.user = self.store.find(User, User.name == 'alice').one() for _ in range(4): playlist.add(track) self.store.add(track) self.store.add(playlist) self.store.commit() self.playlist = playlist