def check_for_updates(): try: data = read( REMOTE_VERSION_FILE ) versiondescargada = data.splitlines()[0] urldescarga = data.splitlines()[1] infile = open( LOCAL_VERSION_FILE ) data = infile.read() infile.close(); versionlocal = data.splitlines()[0] if int(versiondescargada)>int(versionlocal): yes_pressed = message_yes_no("Boyz Toyz","New Version Found!","Do you want to Update now?") if yes_pressed: try: local_file_name = os.path.join( plugintools.get_data_path() , "update.zip" ) urllib.urlretrieve(urldescarga, local_file_name ) import ziptools unzipper = ziptools.ziptools() destpathname = xbmc.translatePath( "special://home/addons") unzipper.extract( local_file_name , destpathname ) os.remove(local_file_name) xbmc.executebuiltin("UpdateLocalAddons") xbmc.executebuiltin("UpdateAddonRepos") xbmc.executebuiltin((u'XBMC.Notification("Update Done!", "Boyz Toyz has been updated", 2000)')) xbmc.executebuiltin( "Container.Refresh" ) except: xbmc.executebuiltin((u'XBMC.Notification("Not updated", "Error the update has failed", 2000)')) except: import traceback
def action_download(params): plugintools.log("dandb.action_download "+repr(params)) icon = os.path.join( plugintools.get_runtime_path() , "icon.png" ) filename = plugintools.get_filename_from_url(params.get("file_url")) full_path_filename = os.path.join( plugintools.get_data_path() , filename ) plugintools.download(params.get("file_url"),full_path_filename) plugintools.show_notification("D&B TV","File "+filename+"downloaded",icon)
def check_for_updates(): plugintools.log("ruyaiptv.updater checkforupdates") # Descarga el fichero con la versión en la web try: plugintools.log("ruyaiptv.updater remote_version_file="+REMOTE_VERSION_FILE) data = plugintools.read( REMOTE_VERSION_FILE ) versiondescargada = data.splitlines()[0] urldescarga = data.splitlines()[1] plugintools.log("ruyaiptv.updater version descargada="+versiondescargada) # Lee el fichero con la versión instalada plugintools.log("ruyaiptv.updater local_version_file="+LOCAL_VERSION_FILE) infile = open( LOCAL_VERSION_FILE ) data = infile.read() infile.close(); versionlocal = data.splitlines()[0] plugintools.log("ruyaiptv.updater version local="+versionlocal) if int(versiondescargada)>int(versionlocal): plugintools.log("ruyaiptv.updater update found") yes_pressed = plugintools.message_yes_no("RuYa IPTV","An update is available!","Do you want to install it now?") if yes_pressed: try: plugintools.log("ruyaiptv.updater Download file...") local_file_name = os.path.join( plugintools.get_data_path() , "update.zip" ) urllib.urlretrieve(urldescarga, local_file_name ) # Lo descomprime plugintools.log("ruyaiptv.updater Unzip file...") import ziptools unzipper = ziptools.ziptools() destpathname = xbmc.translatePath( "special://home/addons") plugintools.log("ruyaiptv.updater destpathname=%s" % destpathname) unzipper.extract( local_file_name , destpathname ) # Borra el zip descargado plugintools.log("ruyaiptv.updater borra fichero...") os.remove(local_file_name) plugintools.log("ruyaiptv.updater ...fichero borrado") xbmc.executebuiltin((u'XBMC.Notification("Updated", "The add-on has been updated", 2000)')) xbmc.executebuiltin( "Container.Refresh" ) except: xbmc.executebuiltin((u'XBMC.Notification("Not updated", "An error causes the update to fail", 2000)')) except: import traceback plugintools.log(traceback.format_exc())
def action_download_and_execute(params): plugintools.log("dandb.action_download_and_execute "+repr(params)) icon = os.path.join( plugintools.get_runtime_path() , "icon.png" ) # Download file filename = plugintools.get_filename_from_url(params.get("file_url")) full_path_filename = os.path.join( plugintools.get_data_path() , filename ) plugintools.download(params.get("file_url"),full_path_filename) plugintools.show_notification("D&B TV","File "+filename+"downloaded",icon) # Replace filename command = params.get("command") plugintools.log("dandb.action_download_and_execute command="+command) command = command.replace("$1",full_path_filename) plugintools.log("dandb.action_download_and_execute command="+command) # Execute command params["command"] = command action_execute(params)
line_splits = line.split("\n") for line_split in line_splits: plugintools.log(line_split) # Thumbnails for item list FILE_ICON = os.path.join(plugintools.get_runtime_path(), 'resources', 'images', 'file.png') FOLDER_ICON = os.path.join(plugintools.get_runtime_path(), 'resources', 'images', 'folder.png') IMAGE_ICON = os.path.join(plugintools.get_runtime_path(), 'resources', 'images', 'image.png') MUSIC_ICON = os.path.join(plugintools.get_runtime_path(), 'resources', 'images', 'music.png') VIDEO_ICON = os.path.join(plugintools.get_runtime_path(), 'resources', 'images', 'video.png') DOWNLOAD_PATH = os.path.join(plugintools.get_data_path(), "downloads") plugintools.log("mega.init Creating...") mega = Mega() maindialog.update(50, "Connecting...") plugintools.log("mega.init Login...") USERNAME = plugintools.get_setting("username") PASSWORD = plugintools.get_setting("password") #plugintools.log("mega.init USERNAME="******"mega.init PASSWORD="+PASSWORD) try: m = mega.login(USERNAME, PASSWORD) logged = True except:
import traceback,sys from pprint import pprint exc_type, exc_value, exc_tb = sys.exc_info() lines = traceback.format_exception(exc_type, exc_value, exc_tb) for line in lines: line_splits = line.split("\n") for line_split in line_splits: plugintools.log(line_split) # Thumbnails for item list FILE_ICON = os.path.join( plugintools.get_runtime_path(), 'resources' , 'images' , 'file.png' ) FOLDER_ICON = os.path.join( plugintools.get_runtime_path(), 'resources' , 'images' , 'folder.png' ) IMAGE_ICON = os.path.join( plugintools.get_runtime_path(), 'resources' , 'images' , 'image.png' ) MUSIC_ICON = os.path.join( plugintools.get_runtime_path(), 'resources' , 'images' , 'music.png' ) VIDEO_ICON = os.path.join( plugintools.get_runtime_path(), 'resources' , 'images' , 'video.png' ) DOWNLOAD_PATH = os.path.join( plugintools.get_data_path() ,"downloads") plugintools.log("mega.init Creating...") mega = Mega() maindialog.update(50,"Connecting...") plugintools.log("mega.init Login...") USERNAME = plugintools.get_setting("username") PASSWORD = plugintools.get_setting("password") #plugintools.log("mega.init USERNAME="******"mega.init PASSWORD="+PASSWORD) try: m = mega.login( USERNAME , PASSWORD ) logged = True except: