Пример #1
0
 def getLocalFileSource(self, params, video):
     self.INVALID_CHARS = '\\/:*?"<>|'
     get = params.get
     result = u""
     if get("action", "") != "download":
         path = "~/.xbmc/temp"  # self.settings.getSetting("download_path")
         video["Title"] = "Test title"
         # filename = u"".join(c for c in common.makeUTF8(video['Title']) if c not in self.INVALID_CHARS) + u"-[" + get('videoid') + u"]" + u".mp4"
         filename_list = list()
         for c in common.makeUTF8(video["Title"]):
             if c not in self.INVALID_CHARS:
                 filename_list.append(c)
         filename = u"".join(filename_list) + u"-[" + get("videoid") + u"]" + u".mp4"
         path = os.path.join(path.decode("utf-8"), filename)
         try:
             if os.path.exists(path):
                 result = path
         except:
             logger.debug(u"failed to locate local subtitle file, trying youtube instead")
     return result