def main(hash, arg1): arg1 = int(arg1) # Check to see if the file has completely downloaded. if g.__islocal__ == 1: url = g.rtc.f.get_frozen_path(hash, arg1) else: f_name = g.rtc.f.get_path(hash, arg1) dld_name = g.rtc.d.get_name(hash) dld_is_multi_file = int(g.rtc.d.is_multi_file(hash)) dld_complete = int(g.rtc.d.get_complete(hash)) # Create the path to file to be played if dld_is_multi_file == 0: path = f_name else: path = os.path.join(dld_name, f_name) # Files that would be in the complete folder if dld_complete == 1: url = os.path.join(g.__setting__('remote_folder_complete'), path) else: url = os.path.join(g.__setting__('remote_folder_downloading'), path) f_completed_chunks = int(g.rtc.f.get_completed_chunks(hash, arg1)) f_size_chunks = int(g.rtc.f.get_size_chunks(hash, arg1)) f_percent_complete = f_completed_chunks * 100 / f_size_chunks if f_percent_complete < 100: dialog = xbmcgui.Dialog() ret = dialog.yesno(g.__lang__(30150), g.__lang__(30151), g.__lang__(30152)) if ret is True: xbmc.Player().play(url); else: xbmc.Player().play(url);
def main(hash,arg1): arg1=int(arg1) # Check to see if the file has completely downloaded. if g.__islocal__==1: url = g.rtc.f.get_frozen_path(hash,arg1) else: f_name = g.rtc.f.get_path(hash, arg1) dld_name = g.rtc.d.get_name(hash) dld_is_multi_file = int(g.rtc.d.is_multi_file(hash)) dld_complete = int(g.rtc.d.get_complete(hash)) # Create the path to file to be played if dld_is_multi_file==0: path = f_name else: path = os.path.join(dld_name,f_name) # Files that would be in the complete folder if dld_complete==1: url = os.path.join(g.__setting__('remote_folder_complete'),path) else: url = os.path.join(g.__setting__('remote_folder_downloading'),path) f_completed_chunks = int(g.rtc.f.get_completed_chunks(hash, arg1)) f_size_chunks = int(g.rtc.f.get_size_chunks(hash, arg1)) f_percent_complete = f_completed_chunks*100/f_size_chunks if f_percent_complete<100: dialog = xbmcgui.Dialog() ret = dialog.yesno(g.__lang__(30150), g.__lang__(30151), g.__lang__(30152)) if ret==True: xbmc.Player().play(url); else: xbmc.Player().play(url);
def main(hash, numfiles): files = [] files = g.rtc.f.multicall(hash, 1, "f.get_path=", "f.get_completed_chunks=", "f.get_size_chunks=", "f.get_priority=", "f.get_size_bytes=") i = 0 for f in files: f_name = f[0] f_completed_chunks = int(f[1]) f_size_chunks = int(f[2]) f_size_bytes = int(f[4]) if f_size_chunks < 1: f_percent_complete = 100 else: f_percent_complete = f_completed_chunks * 100 / f_size_chunks f_priority = f[3] if f_percent_complete == 100: f_complete = 1 else: f_complete = 0 tbn = getIcon(0, 1, f_complete, f_priority) if f_percent_complete < 100: li_name = f_name + ' (' + str(f_percent_complete) + '%)' else: li_name = f_name li = xbmcgui.ListItem(label=li_name, iconImage=tbn, thumbnailImage=tbn) cm = [ (g.__lang__(30120), "xbmc.runPlugin(%s?mode=action&method=f.set_priority&arg1=%s&arg2=%s&arg3=2)" % (sys.argv[0], hash, i)), (g.__lang__(30121), "xbmc.runPlugin(%s?mode=action&method=f.set_priority&arg1=%s&arg2=%s&arg3=1)" % (sys.argv[0], hash, i)), (g.__lang__(30124), "xbmc.runPlugin(%s?mode=action&method=f.set_priority&arg1=%s&arg2=%s&arg3=0)" % (sys.argv[0], hash, i)) ] li.addContextMenuItems(items=cm, replaceItems=True) li.setArt({'fanart': g.__addon__.getAddonInfo('fanart')}) li.setInfo('video', {'title': li_name, 'size': f_size_bytes}) if not xbmcplugin.addDirectoryItem( int(sys.argv[1]), sys.argv[0] + "?mode=play&arg1=" + str(i) + "&hash=" + hash, li, totalItems=numfiles): break i += 1 xbmcplugin.addSortMethod(int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_TITLE) xbmcplugin.addSortMethod(int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_SIZE) xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False)
def main(): # addonMenu(); dlds = [] if LooseVersion(g.rt_version) < LooseVersion("0.9.4") : dlds = g.rtc.d.multicall('main', "d.get_name=", "d.get_hash=", "d.get_completed_chunks=", "d.get_size_chunks=", "d.get_size_files=", "d.get_directory=", "d.is_active=", "d.get_complete=", "d.get_priority=", "d.is_multi_file=", "d.get_size_bytes=") else: dlds = g.rtc.d.multicall2('', 'main', "d.name=", "d.hash=", "d.completed_chunks=", "d.size_chunks=", "d.size_files=", "d.directory=", "d.is_active=", "d.complete=", "d.priority=", "d.is_multi_file=", "d.size_bytes=" ) dlds_len = len(dlds) for dld in dlds: dld_name = dld[0] dld_hash = dld[1] dld_completed_chunks = dld[2] dld_size_chunks = dld[3] dld_percent_complete = dld_completed_chunks*100/dld_size_chunks dld_size_files = dld[4] dld_directory = dld[5] dld_is_active = dld[6] dld_complete = dld[7] dld_priority = dld[8] dld_is_multi_file = dld[9] dld_size_bytes = int(dld[10]) tbn=getIcon(dld_size_files,dld_is_active,dld_complete,dld_priority) if dld_is_active==1: cm_action = g.__lang__(30101),"xbmc.runPlugin(%s?mode=action&method=d.stop&arg1=%s)" % ( sys.argv[0], dld_hash) else: cm_action = g.__lang__(30100),"xbmc.runPlugin(%s?mode=action&method=d.start&arg1=%s)" % ( sys.argv[0], dld_hash) if dld_percent_complete<100: li_name = dld_name+' ('+str(dld_percent_complete)+'%)' else: li_name = dld_name cm = [cm_action, \ (g.__lang__(30102),"xbmc.runPlugin(%s?mode=action&method=d.erase&arg1=%s)" % ( sys.argv[0], dld_hash)), \ (g.__lang__(30120),"xbmc.runPlugin(%s?mode=action&method=d.set_priority&arg1=%s&arg2=3)" % ( sys.argv[0], dld_hash)), \ (g.__lang__(30121),"xbmc.runPlugin(%s?mode=action&method=d.set_priority&arg1=%s&arg2=2)" % ( sys.argv[0], dld_hash)), \ (g.__lang__(30122),"xbmc.runPlugin(%s?mode=action&method=d.set_priority&arg1=%s&arg2=1)" % ( sys.argv[0], dld_hash)), \ (g.__lang__(30123),"xbmc.runPlugin(%s?mode=action&method=d.set_priority&arg1=%s&arg2=0)" % ( sys.argv[0], dld_hash))] li = xbmcgui.ListItem( \ label=li_name, \ iconImage=tbn, thumbnailImage=tbn) li.addContextMenuItems(items=cm,replaceItems=True) li.setInfo('video',{ 'title':li_name, 'size':dld_size_bytes}) if dld_size_files>1: if not xbmcplugin.addDirectoryItem(int(sys.argv[1]), \ sys.argv[0]+"?mode=files&hash="+dld_hash+"&numfiles="+str(dld_size_files), \ li,isFolder=True,totalItems=dlds_len): break else: if not xbmcplugin.addDirectoryItem(int(sys.argv[1]), \ sys.argv[0]+"?mode=play&arg1=0&hash="+dld_hash, \ li,totalItems=dlds_len): break xbmcplugin.addSortMethod(int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_TITLE ) xbmcplugin.addSortMethod(int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_SIZE ) xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False)
def main(hash, numfiles): files = [] files = g.rtc.f.multicall(hash, 1, "f.get_path=", "f.get_completed_chunks=", "f.get_size_chunks=", "f.get_priority=", "f.get_size_bytes=") i = 0 for f in files: f_name = f[0] f_completed_chunks = int(f[1]) f_size_chunks = int(f[2]) f_size_bytes = int(f[4]) if f_size_chunks < 1: f_percent_complete = 100 else: f_percent_complete = f_completed_chunks * 100 / f_size_chunks f_priority = f[3] if f_percent_complete == 100: f_complete = 1 else: f_complete = 0 tbn = getIcon(0, 1, f_complete, f_priority) if f_percent_complete < 100: li_name = f_name + ' (' + str(f_percent_complete) + '%)' else: li_name = f_name li = xbmcgui.ListItem( label=li_name, iconImage=tbn, thumbnailImage=tbn) cm = [(g.__lang__(30120), "xbmc.runPlugin(%s?mode=action&method=f.set_priority&arg1=%s&arg2=%s&arg3=2)" % (sys.argv[0], hash, i)), (g.__lang__(30121), "xbmc.runPlugin(%s?mode=action&method=f.set_priority&arg1=%s&arg2=%s&arg3=1)" % (sys.argv[0], hash, i)), (g.__lang__(30124), "xbmc.runPlugin(%s?mode=action&method=f.set_priority&arg1=%s&arg2=%s&arg3=0)" % (sys.argv[0], hash, i))] li.addContextMenuItems(items=cm, replaceItems=True) li.setArt({'fanart': g.__addon__.getAddonInfo('fanart')}) li.setInfo('video', {'title': li_name, 'size': f_size_bytes}) if not xbmcplugin.addDirectoryItem(int(sys.argv[1]), sys.argv[0] + "?mode=play&arg1=" + str(i) + "&hash=" + hash, li, totalItems=numfiles): break i += 1 xbmcplugin.addSortMethod(int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_TITLE) xbmcplugin.addSortMethod(int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_SIZE) xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False)
def main(method, arg1, arg2, arg3): allok = 0 if method.find('erase')!=-1: dialog = xbmcgui.Dialog() ret = dialog.yesno(g.__lang__(30153), g.__lang__(30154)) if ret==True: allok = 1 else: allok = 1 if allok==1: if arg3: #only used at this stage to change priority on files in torrent #TODO: Must clean this up and put integer checking in place function = 'g.rtc.'+method+'("'+arg1+'",'+arg2+','+arg3+')' elif arg2: function = 'g.rtc.'+method+'("'+arg1+'","'+arg2+'")' else: function = 'g.rtc.'+method+'("'+arg1+'")' #print function exec function xbmc.executebuiltin('Container.Refresh')
def main(method, arg1, arg2, arg3): allok = 0 if method.find('erase') != -1: dialog = xbmcgui.Dialog() ret = dialog.yesno(g.__lang__(30153), g.__lang__(30154)) if ret is True: allok = 1 else: allok = 1 if allok == 1: if arg3: # only used at this stage to change priority on files in torrent # TODO: Must clean this up and put integer checking in place function = 'g.rtc.' + method + '("' + arg1 + '",' + arg2 + ',' + arg3 + ')' elif arg2: function = 'g.rtc.' + method + '("' + arg1 + '","' + arg2 + '")' else: function = 'g.rtc.' + method + '("' + arg1 + '")' # print function exec function xbmc.executebuiltin('Container.Refresh')
def main(hash,arg1): arg1=int(arg1) # Check to see if the file has completely downloaded. if g.__islocal__==1: base_path = g.rtc.d.get_directory(hash) f_name = g.rtc.f.get_path(hash,arg1) url = os.path.join(base_path, f_name) else: f_name = g.rtc.f.get_path(hash, arg1) dld_name = g.rtc.d.get_name(hash) dld_is_multi_file = int(g.rtc.d.is_multi_file(hash)) dld_complete = int(g.rtc.d.get_complete(hash)) # Create the path to file to be played if dld_is_multi_file==0: path = f_name else: path = os.path.join(dld_name,f_name) # Files that would be in the complete folder if dld_complete==1: url = os.path.join(g.__setting__('remote_folder_complete'),path) else: url = os.path.join(g.__setting__('remote_folder_downloading'),path) # XBMC fails to play urls with non-ascii unicode strings, assume UTF-8 and convert to str. if isinstance(url, unicode): url = url.encode('utf-8') f_completed_chunks = int(g.rtc.f.get_completed_chunks(hash, arg1)) f_size_chunks = int(g.rtc.f.get_size_chunks(hash, arg1)) f_percent_complete = f_completed_chunks*100/f_size_chunks if f_percent_complete<100: dialog = xbmcgui.Dialog() ret = dialog.yesno(g.__lang__(30150), g.__lang__(30151), g.__lang__(30152)) if ret==True: xbmc.Player().play(url); else: xbmc.Player().play(url);
def main(): # addonMenu(); dlds = [] dlds = g.rtc.d.multicall('main', "d.get_name=", "d.get_hash=", "d.get_completed_chunks=", "d.get_size_chunks=", "d.get_size_files=", "d.get_directory=", "d.is_active=", "d.get_complete=", "d.get_priority=", "d.is_multi_file=", "d.get_size_bytes=") dlds_len = len(dlds) for dld in dlds: dld_name = dld[0] dld_hash = dld[1] dld_completed_chunks = dld[2] dld_size_chunks = dld[3] dld_percent_complete = dld_completed_chunks * 100 / dld_size_chunks dld_size_files = dld[4] dld_directory = dld[5] dld_is_active = dld[6] dld_complete = dld[7] dld_priority = dld[8] dld_is_multi_file = dld[9] dld_size_bytes = int(dld[10]) tbn = getIcon(dld_size_files, dld_is_active, dld_complete, dld_priority) if dld_is_active == 1: cm_action = g.__lang__( 30101 ), "xbmc.runPlugin(%s?mode=action&method=d.stop&arg1=%s)" % ( sys.argv[0], dld_hash) else: cm_action = g.__lang__( 30100 ), "xbmc.runPlugin(%s?mode=action&method=d.start&arg1=%s)" % ( sys.argv[0], dld_hash) if dld_percent_complete < 100: li_name = dld_name + ' (' + str(dld_percent_complete) + '%)' else: li_name = dld_name cm = [ cm_action, (g.__lang__(30102), "xbmc.runPlugin(%s?mode=action&method=d.erase&arg1=%s)" % (sys.argv[0], dld_hash)), (g.__lang__(30120), "xbmc.runPlugin(%s?mode=action&method=d.set_priority&arg1=%s&arg2=3)" % (sys.argv[0], dld_hash)), (g.__lang__(30121), "xbmc.runPlugin(%s?mode=action&method=d.set_priority&arg1=%s&arg2=2)" % (sys.argv[0], dld_hash)), (g.__lang__(30122), "xbmc.runPlugin(%s?mode=action&method=d.set_priority&arg1=%s&arg2=1)" % (sys.argv[0], dld_hash)), (g.__lang__(30123), "xbmc.runPlugin(%s?mode=action&method=d.set_priority&arg1=%s&arg2=0)" % (sys.argv[0], dld_hash)) ] li = xbmcgui.ListItem(label=li_name, iconImage=tbn, thumbnailImage=tbn) li.addContextMenuItems(items=cm, replaceItems=True) li.setArt({'fanart': g.__addon__.getAddonInfo('fanart')}) li.setInfo('video', {'title': li_name, 'size': dld_size_bytes}) if dld_size_files > 1: if not xbmcplugin.addDirectoryItem( int(sys.argv[1]), sys.argv[0] + "?mode=files&hash=" + dld_hash + "&numfiles=" + str(dld_size_files), li, isFolder=True, totalItems=dlds_len): break else: if not xbmcplugin.addDirectoryItem( int(sys.argv[1]), sys.argv[0] + "?mode=play&arg1=0&hash=" + dld_hash, li, totalItems=dlds_len): break xbmcplugin.addSortMethod(int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_TITLE) xbmcplugin.addSortMethod(int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_SIZE) xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False)