Beispiel #1
0
 def __init__(self, audio_files):
     super().__init__()
     self.AUDIO_FILES = audio_files
     self.playing_files = list(self.AUDIO_FILES)
     self.current_playlist = list(self.AUDIO_FILES)
     self.player = playback.MusicPlayer(self.playing_files)
     self.fs_editor = fsystem.FileSystemEdit(self.playing_files)
     self.album_editor = albumsys.AlbumEditor()
     self.play_row = True
     self.is_pause = False
     self.repeat_track = False
     self.timer_change = False
     self.shuffle = False
     self.file_sys_work = False
     self.icons = {
         'play': QtGui.QIcon('images/play.png'),
         'pause': QtGui.QIcon('images/pause.png'),
         'again': QtGui.QIcon('images/again.png'),
         'cur_song': QtGui.QIcon('images/cur_song.png'),
         'repeat': QtGui.QIcon('images/repeat.png'),
         'no_repeat': QtGui.QIcon('images/no_repeat.png'),
         'shuffle': QtGui.QIcon('images/shuffle.png'),
         'normal': QtGui.QIcon('images/normal.png'),
         'previous': QtGui.QIcon('images/previous.png'),
         'next': QtGui.QIcon('images/next.png'),
         'rewind_f': QtGui.QIcon('images/rewind_f.png'),
         'rewind_b': QtGui.QIcon('images/rewind_b.png')
     }
     self._init_ui()
Beispiel #2
0
    def test_add_album(self):
        album_editor = albumsys.AlbumEditor()
        album = self._get_test_album()
        album_editor.add_album(album)

        self.assertEqual(1, len(album_editor.albums))
        self.assertIn('name', album_editor.albums)
        self.assertEqual(album, album_editor.albums['name'])
Beispiel #3
0
    def test_change_song_name(self):
        album_editor = albumsys.AlbumEditor()
        album = self._get_test_album()
        album_editor.add_album(album)
        album_editor.change_song_name('name', 2, 'name10')

        self.assertEqual(1, len(album_editor.albums))
        self.assertIn('name', album_editor.albums)
        self.assertIn(
            'name10',
            [item.name for item in album_editor.albums['name'].album_items])
        self.assertNotIn(
            'name2',
            [item.name for item in album_editor.albums['name'].album_items])
Beispiel #4
0
    def test_add_albums(self):
        album_editor = albumsys.AlbumEditor()
        album1 = self._get_test_album()
        album1.change_album_name('name1')
        album_editor.add_album(album1)
        album2 = self._get_test_album()
        album2.change_album_name('name2')
        album_editor.add_album(album2)

        self.assertEqual(2, len(album_editor.albums))
        self.assertIn('name1', album_editor.albums)
        self.assertIn('name2', album_editor.albums)
        self.assertEqual(album1, album_editor.albums['name1'])
        self.assertEqual(album2, album_editor.albums['name2'])
Beispiel #5
0
    def test_save_few_albums(self):
        album1 = self._get_test_album(0, 3)
        album2 = self._get_test_album(3, 3)
        album_editor = albumsys.AlbumEditor()
        album_editor.add_album(album1)
        album_editor.add_album(album2)

        saved_albums = album_editor.save_albums()

        self.assertEqual(
            saved_albums,
            'name0\n\rdirectory0::name0\n\r'
            'directory1::name1\n\rdirectory2::name2\n\r\n\r'
            'name3\n\rdirectory3::name3\n\r'
            'directory4::name4\n\rdirectory5::name5\n\r\n\r')
Beispiel #6
0
    def test_find_name_in_albums(self):
        album_editor = albumsys.AlbumEditor()
        album1 = self._get_test_album()
        album1.change_album_name('name1')
        album_editor.add_album(album1)
        album2 = self._get_test_album()
        album2.change_album_name('name2')
        album_editor.add_album(album2)

        result_dict = files.find_name_in_albums('other', album_editor.albums)

        self.assertEqual(2, len(result_dict))
        self.assertIn('name1', result_dict)
        self.assertIn('name2', result_dict)
        self.assertEqual(5, len(result_dict['name1']))
        self.assertEqual(5, len(result_dict['name2']))