示例#1
0
 def setUp(self):
     self.playlist = DMPlaylist()
     cate_game = self.playlist.appendCategory("The Game of Thorn")
     cate_game.appendItem("001", "file:///videos/001.rm", "645")
     cate_game.appendItem("002", "file:///videos/002.rm")
     self.playlist.appendItem("The Big Bang Theory",
                              "file:///videos/tbbt001.mkv")
     self.playlist.appendItem("The game of thorn 002")
示例#2
0
	def setUp(self):
		self.playlist = DMPlaylist()
		cate_game = self.playlist.appendCategory("The Game of Thorn")
		cate_game.appendItem("001", "file:///videos/001.rm", "645")
		cate_game.appendItem("002", "file:///videos/002.rm")
		self.playlist.appendItem("The Big Bang Theory",
			"file:///videos/tbbt001.mkv");
		self.playlist.appendItem("The game of thorn 002");
示例#3
0
class TestDMPlaylist(unittest.TestCase):

	def setUp(self):
		self.playlist = DMPlaylist()
		cate_game = self.playlist.appendCategory("The Game of Thorn")
		cate_game.appendItem("001", "file:///videos/001.rm", "645")
		cate_game.appendItem("002", "file:///videos/002.rm")
		self.playlist.appendItem("The Big Bang Theory",
			"file:///videos/tbbt001.mkv");
		self.playlist.appendItem("The game of thorn 002");

	def tearDown(self):
		pass

	def testWriteTo(self):
		self.playlist.writeTo("testWriteTo.dmpl")
		with open("testWriteTo.dmpl") as writeTo:
			with open("testReadFrom.dmpl") as readFrom:
				self.assertEqual(writeTo.read(), readFrom.read())

	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())
示例#4
0
class TestDMPlaylist(unittest.TestCase):
    def setUp(self):
        self.playlist = DMPlaylist()
        cate_game = self.playlist.appendCategory("The Game of Thorn")
        cate_game.appendItem("001", "file:///videos/001.rm", "645")
        cate_game.appendItem("002", "file:///videos/002.rm")
        self.playlist.appendItem("The Big Bang Theory",
                                 "file:///videos/tbbt001.mkv")
        self.playlist.appendItem("The game of thorn 002")

    def tearDown(self):
        pass

    def testWriteTo(self):
        self.playlist.writeTo("testWriteTo.dmpl")
        with open("testWriteTo.dmpl") as writeTo:
            with open("testReadFrom.dmpl") as readFrom:
                self.assertEqual(writeTo.read(), readFrom.read())

    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())
示例#5
0
    def exportPlaylist(self, filename):
        playlist = DMPlaylist()
        playlistItems = json.loads(self.playlist_local)

        for item in playlistItems:
            try:
                itemChild = json.loads(item["itemChild"])
                if len(itemChild) != 0 and item["itemUrl"] == "":
                    cate = playlist.appendCategory(
                        item["itemName"].encode("utf-8"))
                    for child in itemChild:
                        cate.appendItem(child["itemName"].encode("utf-8"),
                            child["itemUrl"].encode("utf-8"),
                            str(self.fetch_video_position(child["itemUrl"])))
                else:
                    playlist.appendItem(item["itemName"].encode("utf-8"),
                        item["itemUrl"].encode("utf-8"),
                        str(self.fetch_video_position(item["itemUrl"])))
            except Exception, e:
                print e
示例#6
0
    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)
示例#7
0
	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())
示例#8
0
 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())