Пример #1
0
 def recreate(self, playlist: Playlist, songs: Iterable[AudioFile]):
     """Keep a playlist but entirely replace its contents
     This is useful for applying new external sorting etc"""
     playlist._list.clear()
     playlist._list.extend(songs)
     playlist.finalize()
     playlist.write()
     self.changed([playlist])
Пример #2
0
    def test_read(self):
        pl = Playlist(self.temp, "playlist")
        pl.extend(NUMERIC_SONGS)
        pl.write()

        lib = FileLibrary("foobar")
        lib.add(NUMERIC_SONGS)
        pl = Playlist(self.temp, "playlist", lib)
        self.assertEqual(len(pl), len(NUMERIC_SONGS))
Пример #3
0
    def test_write(self):
        pl = Playlist(self.temp, "playlist")
        pl.extend(NUMERIC_SONGS)
        pl.extend([fsnative(u"xf0xf0")])
        pl.write()

        with open(pl.filename, "rb") as h:
            self.assertEqual(len(h.read().splitlines()),
                             len(NUMERIC_SONGS) + 1)
Пример #4
0
    def test_read(self):
        pl = Playlist(self.temp, "playlist")
        pl.extend(NUMERIC_SONGS)
        pl.write()

        lib = FileLibrary("foobar")
        lib.add(NUMERIC_SONGS)
        pl = Playlist(self.temp, "playlist", lib)
        self.assertEqual(len(pl), len(NUMERIC_SONGS))
Пример #5
0
    def test_write(self):
        pl = Playlist(self.temp, "playlist")
        pl.extend(NUMERIC_SONGS)
        pl.extend([fsnative(u"xf0xf0")])
        pl.write()

        with open(pl.filename, "rb") as h:
            self.assertEqual(len(h.read().splitlines()),
                             len(NUMERIC_SONGS) + 1)