def importPlaylist(self, filename): self.clearPlaylistItems.emit() playlist = DMPlaylist.readFrom(filename) for category in playlist.getAllCategories(): for item in category.getAllItems(): self.importItemFound.emit(category.name, item.name, item.source, item.played) for item in playlist.getAllItems(): self.importItemFound.emit(None, item.name, item.source, item.played) self.importDone.emit(filename)
def testReadFrom(self): playlist = DMPlaylist.readFrom("testReadFrom.dmpl") playlist.writeTo("testReadFrom2.dmpl") with open("testReadFrom.dmpl") as readFrom: with open("testReadFrom2.dmpl") as readFrom2: self.assertEqual(readFrom.read(), readFrom2.read())