def playPlaylist(self, plsTitle, plsId, plsCount): """ Discover a list of Categories within a Directory """ log("> playPlaylist() plsId=%s plsCount=%s" % (plsId, plsCount)) ok = False try: # delete existing data docs as were now getting every video in pls, not by pagesize reeplayit.deleteScriptCache(deleteVideos=False, deleteData=True) dialogProgress.create(__lang__(0), __lang__(217), plsTitle) # DL playlist content self.reeplayitLib.set_report_hook(self.reeplayitLib.progressHandler, dialogProgress) # get all videos in playlist videoCount = self.reeplayitLib.getPlaylist(plsId, pageSize=plsCount) if not videoCount: raise "Empty" # create a playlist and add items to it xbmcPlaylist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) xbmcPlaylist.clear() streamVideo = self.settings.get(self.settings.SETTING_STREAM_VIDEO) for idx in range(videoCount): source, li = self.reeplayitLib.getVideo(idx, stream=streamVideo) if source and li: # url = li.getProperty(self.reeplayitLib.PROP_URL) xbmcPlaylist.add(source, li) else: break # http error, so stop processing more videos dialogProgress.close() # play all in xbmc pls log("Playlist size=%d" % xbmcPlaylist.size()) if xbmcPlaylist.size() <= 0: raise "Empty" if xbmcgui.Dialog().yesno(__lang__(0), __lang__(234), "", "", __lang__(236), __lang__(235)): xbmcPlaylist.shuffle() playMedia(xbmcPlaylist) except "Empty": log("Empty raised") messageOK(__lang__(0), __lang__(105)) # no videos except: handleException() dialogProgress.close() log("< playPlaylist()")
def playPlaylist(self, plsTitle, plsId, plsCount): """ Discover a list of Categories within a Directory """ log( "> playPlaylist() plsId=%s plsCount=%s" % (plsId,plsCount)) ok = False try: # delete existing data docs as were now getting every video in pls, not by pagesize reeplayit.deleteScriptCache(deleteVideos=False, deleteData=True) dialogProgress.create(__lang__(0), __lang__(217), plsTitle) # DL playlist content self.reeplayitLib.set_report_hook(self.reeplayitLib.progressHandler, dialogProgress) # get all videos in playlist videoCount = self.reeplayitLib.getPlaylist(plsId, pageSize=plsCount) if not videoCount: raise "Empty" # create a playlist and add items to it xbmcPlaylist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) xbmcPlaylist.clear() streamVideo = self.settings.get(self.settings.SETTING_STREAM_VIDEO) for idx in range(videoCount): source, li = self.reeplayitLib.getVideo(idx, stream=streamVideo) if source and li: # url = li.getProperty(self.reeplayitLib.PROP_URL) xbmcPlaylist.add(source, li) else: break # http error, so stop processing more videos dialogProgress.close() # play all in xbmc pls log("Playlist size=%d" % xbmcPlaylist.size()) if xbmcPlaylist.size() <= 0: raise "Empty" if xbmcgui.Dialog().yesno(__lang__(0), __lang__(234), "","", __lang__(236), __lang__(235)): xbmcPlaylist.shuffle() playMedia(xbmcPlaylist) except "Empty": log("Empty raised") messageOK(__lang__(0), __lang__(105)) # no videos except: handleException() dialogProgress.close() log( "< playPlaylist()")
def __init__(self, *args, **kwargs): log("> __init__()") if not sys.argv or len(sys.argv) < 3: xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=False) log("< __init__() too few argv args %s" % sys.argv) return # allow access to readme/changelog which dont rely on any settings elif sys.argv[2]: paramDict = self._getParams() if paramDict.has_key(self.PARAM_INFO): fn = os.path.join(DIR_RESOURCES, paramDict[self.PARAM_INFO]) reeplayit.showTextFile(fn) return # load settings - ensuring all ok if not self.loadSettings(): xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=False) log("< settings incomplete, exiting script") return log("script normal startup") # create a new lib instance using login details self.reeplayitLib = reeplayit.ReeplayitLib( self.settings.get(self.settings.SETTING_USER), self.settings.get(self.settings.SETTING_PWD), self.settings.get(self.settings.SETTING_PAGE_SIZE), self.settings.get(self.settings.SETTING_VQ), ) if not sys.argv[2]: ok = True # check XBMC min build date required if not checkBuildDate(__plugin__, "01-02-2009"): ok = False # check for svn update elif self.settings.get(self.settings.SETTING_CHECK_UPDATE): # check for update ? if checkUpdate(False, False): ok = False if not ok: xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=False) return # new session clear cache of data and maybe videos deleteVideos = self.settings.get(self.settings.SETTING_DELETE_VIDEOS) reeplayit.deleteScriptCache(deleteVideos, deleteData=True) # get category self.getPlaylists() else: # extract URL params and act accordingly try: # paramDict = self._getParams() if paramDict.has_key(self.PARAM_PLS_ID): title = unescape(paramDict[self.PARAM_TITLE]) count = int(paramDict[self.PARAM_PLS_COUNT]) page = int(paramDict.get(self.PARAM_PLS_PAGE, 1)) id = paramDict[self.PARAM_PLS_ID] self.getPlaylist(title, id, count, page) elif paramDict.has_key(self.PARAM_VIDEO_ID): title = unescape(paramDict[self.PARAM_TITLE]) id = paramDict[self.PARAM_VIDEO_ID] self.getVideo(title, id) elif paramDict.has_key(self.PARAM_PLS_PLAYALL): id = paramDict[self.PARAM_PLS_PLAYALL] title = unescape(paramDict[self.PARAM_TITLE]) count = int(paramDict[self.PARAM_PLS_COUNT]) self.playPlaylist(title, id, count) else: raise except: traceback.print_exc() messageOK("ERROR", str(sys.exc_info()[1])) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=False) log("< __init__()")
def __init__( self, *args, **kwargs ): log("> __init__()") if not sys.argv or len(sys.argv) < 3: xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=False) log("< __init__() too few argv args %s" % sys.argv) return # allow access to readme/changelog which dont rely on any settings elif ( sys.argv[ 2 ] ): paramDict = self._getParams() if paramDict.has_key(self.PARAM_INFO): fn = os.path.join( DIR_RESOURCES, paramDict[self.PARAM_INFO] ) reeplayit.showTextFile(fn) return # load settings - ensuring all ok if not self.loadSettings(): xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=False) log("< settings incomplete, exiting script") return log("script normal startup") # create a new lib instance using login details self.reeplayitLib = reeplayit.ReeplayitLib(self.settings.get(self.settings.SETTING_USER), \ self.settings.get(self.settings.SETTING_PWD), \ self.settings.get(self.settings.SETTING_PAGE_SIZE), \ self.settings.get(self.settings.SETTING_VQ)) if ( not sys.argv[ 2 ] ): ok = True # check XBMC min build date required if not checkBuildDate(__plugin__, "01-02-2009"): ok = False # check for svn update elif self.settings.get(self.settings.SETTING_CHECK_UPDATE): # check for update ? if checkUpdate(False, False): ok = False if not ok: xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=False) return # new session clear cache of data and maybe videos deleteVideos = self.settings.get(self.settings.SETTING_DELETE_VIDEOS) reeplayit.deleteScriptCache(deleteVideos, deleteData=True) # get category self.getPlaylists() else: # extract URL params and act accordingly try: # paramDict = self._getParams() if paramDict.has_key(self.PARAM_PLS_ID): title = unescape(paramDict[self.PARAM_TITLE]) count = int(paramDict[self.PARAM_PLS_COUNT]) page = int(paramDict.get(self.PARAM_PLS_PAGE,1)) id = paramDict[self.PARAM_PLS_ID] self.getPlaylist(title, id, count, page) elif paramDict.has_key(self.PARAM_VIDEO_ID): title = unescape(paramDict[self.PARAM_TITLE]) id = paramDict[self.PARAM_VIDEO_ID] self.getVideo(title, id) elif paramDict.has_key(self.PARAM_PLS_PLAYALL): id = paramDict[self.PARAM_PLS_PLAYALL] title = unescape(paramDict[self.PARAM_TITLE]) count = int(paramDict[self.PARAM_PLS_COUNT]) self.playPlaylist(title, id, count) else: raise except: traceback.print_exc() messageOK("ERROR", str(sys.exc_info()[ 1 ])) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=False) log("< __init__()")