示例#1
0
    def test_masked_handling(self):
        if os.name == "nt":
            # FIXME: masking isn't properly implemented on Windows
            return
        # playlists can contain songs and paths for masked handling..
        lib = FileLibrary("foobar")
        with self.wrap("playlist", lib) as pl:
            song = Fakesong({"date": "2038", "~filename": fsnative(u"/fake")})
            song.sanitize()
            lib.add([song])

            # mask and update
            lib.mask("/")
            pl.append(song)
            pl.remove_songs([song])
            self.failUnless("/fake" in pl)

            pl.extend(self.TWO_SONGS)

            # check if collections can handle the mix
            self.failUnlessEqual(pl("date"), "2038")

            # unmask and update
            lib.unmask("/")
            pl.add_songs(["/fake"], lib)
            self.failUnless(song in pl)

            lib.destroy()
 def test_read(self):
     lib = FileLibrary("foobar")
     lib.add(NUMERIC_SONGS)
     with self.wrap("playlist", lib) as pl:
         pl.extend(NUMERIC_SONGS)
         pl.write()
         self.assertEqual(len(pl), len(NUMERIC_SONGS))
    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))
 def setUp(self):
     quodlibet.config.init()
     self.lib = quodlibet.browsers.search.library = FileLibrary()
     quodlibet.browsers.search.library.librarian = SongLibrarian()
     for af in self.SONGS:
         af.sanitize()
     self.lib.add(self.SONGS)
     self._dir = mkdtemp()
     self.pl = FileBackedPlaylist.new(self._dir, "Foobar", self.lib)
     self.pl.extend(self.SONGS)
 def test_difficult_names(self):
     lib = FileLibrary("foobar")
     lib.add(NUMERIC_SONGS)
     name = "c:?\"problem?\" / foo* / 100% É™! COM"
     with self.wrap(name, lib) as pl:
         pl.extend(NUMERIC_SONGS)
         pl.write()
         assert pl.songs == NUMERIC_SONGS
         with self.wrap(name, lib) as pl2:
             assert pl2.songs == NUMERIC_SONGS
示例#6
0
 def setUp(self):
     # Testing locally is VERY dangerous without this...
     self.assertTrue(_TEMP_DIR in PLAYLISTS or os.name == "nt",
                     msg="Failing, don't want to delete %s" % PLAYLISTS)
     try:
         os.mkdir(PLAYLISTS)
     except IOError:
         pass
     quodlibet.config.init()
     self.lib = FileLibrary()
     self.lib.librarian = SongLibrarian()
     for af in self.SONGS:
         af.sanitize()
     self.lib.add(self.SONGS)
     self.added = []