Example #1
0
 def test_download(self):
     """ Test downloading a file.
     """
     downloader.download(SAMPLE_FILE)
     basename = path.basename(SAMPLE_FILE)
     self.evaluate_file(basename, ORIGINAL_FILE)
     os.remove(basename)
def HUBINSTALL(name, url, script):
    aList = []
    script_url = url
    link = OPEN_URL(script_url)
    matcher = script + '-(.+?).zip'
    match = re.compile(matcher).findall(link)
    for version in match:
        aList.append(version)
    aList.sort(cmp=ver_cmp, reverse=True)
    newest_v = script + '-' + aList[0]
    newest_v_url = script_url + script + '-' + aList[0] + '.zip'
    kodi.log("Looking for : " + newest_v_url)
    path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    dp = xbmcgui.DialogProgress()
    dp.create("Starting up", "Initializing ", '', 'Please Stand By....')
    # lib = os.path.join(path, name + '.zip')
    lib = os.path.join(path, newest_v + '.zip')
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home', 'addons'))
    if os.path.exists(lib):
        os.remove(lib)
    downloader.download(newest_v_url, lib, dp, timeout=120)
    try:
        # xbmc.executebuiltin("InstallAddon(%s)" % newest_v)
        extract.all(lib, addonfolder, '')
        time.sleep(2)
    except IOError, (errno, strerror):
        kodi.message("Failed to open required files", "Error code is:", strerror)
        return False
Example #3
0
def wizard2(name,url,description,pk,isaddon,restart,forceRestart):
	#PURGEPACKAGES()
	dp = xbmcgui.DialogProgress()
	dp.create(name,"A fazer download: " + name,'')
	lib=os.path.join(PACKAGES, name+'.zip')
	try:
		os.remove(lib)
	except:
		pass
	downloader.download(url, lib, dp)
	time.sleep(2)
	dp.update(0,name, "A extrair: " + name)
	extract.all(lib,ADDONS,dp)
	xbmc.executebuiltin('UnloadSkin()')
	xbmc.executebuiltin('ReloadSkin()')
	xbmc.executebuiltin("LoadProfile()")
	xbmc.executebuiltin('UpdateLocalAddons')
	dialog = xbmcgui.Dialog()
	
	if platform() == 'android':
		dialog.ok("Concluido", 'Tudo instalado', 'caso seu kodi trave, reinicie seu dispositivo', 'em caso de duvida contacte o nosso suporte.')
	else:
		dialog.ok("Concluido", 'Tudo instalado', 'volte ao menu para visualizar o conteudo instalado,', 'em caso de duvida contacte o nosso suporte.')
	
	if restart == True:
		dialog = xbmcgui.Dialog()
		dialog.ok("Download Concluido", 'Infelizmente a unica forma de persistir o pacote e', 'compelir o fechamento abrupto do kodi,', 'em seguida re-abra o kodi.')
	
	if forceRestart == True:
		dialog = xbmcgui.Dialog()
		dialog.ok("Download Concluido", 'Infelizmente a unica forma de persistir o pacote e', 'compelir o fechamento abrupto do kodi,', 'jamais saia do kodi manualmente, caso o kodi continue aberto, reinicie sua box ou mate a tarefa do kodi.')
	
	killxbmc()
Example #4
0
def downloader_is(url, name, showProgress=True):
	import downloader, extract

	addonsDir = xbmc.translatePath(os.path.join('special://home', 'addons')).decode("utf-8")
	packageFile = os.path.join(addonsDir, 'packages', 'isr.zip')
	'''
	try:
		os.remove(packageFile)
	except:
		pass
	'''	
	if showProgress:
		dp = xbmcgui.DialogProgress()
		dp.create(AddonName, "Downloading", name, "Please Wait")
		downloader.download(url, packageFile, dp)
		dp.update(0, "", "Extracting Zip Please Wait")
		extract.all(packageFile, addonsDir, dp)
	else:
		urllib.urlretrieve(url, packageFile)
		extract.all(packageFile, addonsDir)
		
	try:
		os.remove(packageFile)
	except:
		pass
			
	xbmc.executebuiltin("UpdateLocalAddons")
	xbmc.executebuiltin("UpdateAddonRepos")
Example #5
0
def ServicePack(url):
#	\Servicepack.zip
    if dialog.yesno('XvBMC-NL most recent Android ServicePacks','Download de laatste XvBMC Android ServicePack?',nolabel='Nee, No',yeslabel='Ja, Yes'):
        url=base+'Servicepack.zip'
        path = xbmc.translatePath(os.path.join('special://home','addons','packages'))
        if not os.path.exists(path):
            os.makedirs(path)
        lib=os.path.join(path, 'update.zip')
        try:
            os.remove(lib)
        except:
            pass
        downloader.download(url, lib)
        if os.path.exists(lib):
            addonfolder = xbmc.translatePath(os.path.join('special://','home'))
            time.sleep(2)
            dp = xbmcgui.DialogProgress()
            dp.create("XvBMC-NL - *extra* Android Add-ons","XvBMC-NL: doing some Android extracting VOODOO...",'', 'Please Wait')
            dp.update(0,"", "*Extracting ZiP Please Wait*")
            extract.all(lib,addonfolder,dp)
            dp.close()
            try: os.remove(lib)
            except: pass
            dialog.ok("XvBMC-NL Android ServicePack - Update finished", 'een REBOOT van uw systeem is SOMS wenselijk...','', '(if add-ons do NOT work you probably should reboot first)')
            xbmc.executebuiltin("UpdateLocalAddons")
            xbmc.executebuiltin("UpdateAddonRepos")
            xbmc.executebuiltin('XBMC.RunScript(special://home/addons/script.schoonmaak/purge.py)')
Example #6
0
 def test_download_tarball(self):
     """ Test downloading a tarball file.
     """
     downloader.download(TAR_FILE)
     target = path.join(ARCHIVE_ROOT, TARGET_FILE)
     self.evaluate_file(target, ORIGINAL_FILE)
     shutil.rmtree(ARCHIVE_ROOT)
def install_keymap(name, url):
    if os.path.isfile(KEYBOARD_FILE):
        try:
            os.remove(KEYBOARD_FILE)
        except:
            pass
    # Check is the packages folder exists, if not create it.
    path = xbmc.translatePath(os.path.join('special://home/addons', 'packages'))
    if not os.path.exists(path):
        os.makedirs(path)
    path_key = xbmc.translatePath(os.path.join('special://home/userdata', 'keymaps'))
    if not os.path.exists(path_key):
        os.makedirs(path_key)
    buildname = name
    dp = xbmcgui.DialogProgress()
    dp.create("Keymap Installer", "", "", "[B]Keymap: [/B]" + buildname)
    buildname = "customkeymap"
    lib = os.path.join(path, buildname + '.zip')
    
    try:
        os.remove(lib)
    except:
        pass
    
    downloader.download(url, lib, dp, timeout=120)
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home'))
    time.sleep(2)
    dp.update(0, "", "Installing Please wait..", "")
    try:
        extract.all(lib, addonfolder, dp)
    except IOError, (errno, strerror):
        kodi.message("Failed to open required files", "Error code is:", strerror)
        return False
Example #8
0
def HELPWIZARD(name,url,description,filetype):
    path=xbmc.translatePath(os.path.join('special://home/addons','packages'))
    confirm=xbmcgui.Dialog()
    if confirm.yesno("NUKECORP","Would you like me to ","customize your add-on selection? "," "):
        dp=xbmcgui.DialogProgress(); dp.create("NUKE WIZARD","Downloading ",'','Please Wait')
        lib=os.path.join(path,name+'.zip')
        try: os.remove(lib)
        except: pass
        downloader.download(url,lib,dp)
    #if filetype == 'addon':
        #addonfolder = xbmc.translatePath(os.path.join('special://','home/addons'))
    #elif filetype == 'media':
        #addonfolder = xbmc.translatePath(os.path.join('special://','home'))    
#attempt Shortcuts
    #elif filetype == 'main':
        addonfolder=xbmc.translatePath(os.path.join('special://','home'))
        time.sleep(2)
        dp.update(0,"","Extracting Zip Please Wait")
        print '======================================='; print addonfolder; print '======================================='
        extract.all(lib,addonfolder,dp)
        link=OPEN_URL('https://github.com/CYBERxNUKE/cputech/raw/master/homeshort.txt')
        proname=xbmc.getInfoLabel("System.ProfileName")
        shorts=re.compile('shortcut="(.+?)"').findall(link)
        for shortname in shorts: xbmc.executebuiltin("Skin.SetString(%s)" % shortname)
        time.sleep(2)
        xbmc.executebuiltin('UnloadSkin()'); xbmc.executebuiltin('ReloadSkin()'); xbmc.executebuiltin("LoadProfile(%s)" % proname)
        dialog=xbmcgui.Dialog(); dialog.ok("Success!","Please Reboot To Take","Effect   [COLOR gold]Brought To You By CYBERxNUKE[/COLOR]")
Example #9
0
 def test_rename(self):
     """ Test downloading a file and renaming it.
     """
     target = "test.md"
     downloader.download(SAMPLE_FILE + ":" + target)
     self.evaluate_file(target, ORIGINAL_FILE)
     os.remove(target)
Example #10
0
def UpdateRollup(url):
    Common.verifyplatform()
#	\update\sp\03-sp-rollup.zip
    if dialog.yesno('XvBMC NL ServicePack Update Rollup','Download ALLE XvBMC [COLOR=white][B]SP[/B][/COLOR]-updates [COLOR=white]([B]all-in-1[/B])?[/COLOR]',nolabel='Nee, No',yeslabel='Ja, Yes'):
        url=base64.b64decode(base)+'update/sp/03-sp-rollup.zip'
        path = xbmc.translatePath(os.path.join('special://home','addons','packages'))
        if not os.path.exists(path):
            os.makedirs(path)
        lib=os.path.join(path, 'update.zip')
        try:
            os.remove(lib)
        except:
            pass
        downloader.download(url, lib)
        if os.path.exists(lib):
            addonfolder = xbmc.translatePath(os.path.join('special://','home'))
            time.sleep(2)
            dp = xbmcgui.DialogProgress()
            dp.create("XvBMC Nederland - Updater","XvBMC-NL: doing some updating VOODOO...",'', 'Please Wait')
            dp.update(0,"", "*Extracting ZiP Please Wait*")
            extract.all(lib,addonfolder,dp)
            dp.close()
            try: os.remove(lib)
            except: pass
            dialog.ok('XvBMC-NL ServicePack - RollUp finished', 'een REBOOT van uw systeem is SOMS wenselijk...','', '(if add-ons do NOT work you probably should reboot first)')
            xbmc.executebuiltin("UpdateLocalAddons")
            xbmc.executebuiltin("UpdateAddonRepos")
            xbmc.executebuiltin('XBMC.RunScript(special://home/addons/script.schoonmaak/purge.py)')
Example #11
0
 def test_set_destination_and_rename(self):
     """ Test downloading a file to a directory and renaming it.
     """
     target = "/tmp/test.md"
     downloader.download(SAMPLE_FILE + ":" + target)
     self.evaluate_file(target, ORIGINAL_FILE)
     os.remove(target)
def AfterWizard():
    global winOeMain, __cwd__, __oe__
    if not os.path.exists(firstrun):
        try:
            dp.create('Totally Revolutionising your box','Please wait...','')
            downloader.download('http://thelittleblackbox.com/frun/frun_cube.zip', firstrunzip, dp)
            dp.close()
            dp.create('Installing Updates','Please wait...','')
            extract.all(firstrunzip,'/storage',dp)
#            while xbmc.getCondVisibility("Window.IsActive(progressdialog)"):
#                xbmc.sleep(1000)
            dp.close()
            os.makedirs(firstrun)
            xbmc.executebuiltin( 'UpdateLocalAddons' )
            xbmc.sleep(1000)
            xbmc.executebuiltin( 'UpdateAddonRepos' )
            xbmc.sleep(2000)
            os.remove(firstrunzip)
            try: os.system('killall XBMC')
            except: pass
            try: os.system('killall Kodi')
            except: pass
            try: os.system('killall -9 xbmc.bin')
            except: pass
            try: os.system('killall -9 kodi.bin')
            except: pass
        except:
            dialog.ok('Update download failed','There was a problem trying to download the latest updates, please go to your settings and make sure you\'re connected. Once connected reboot and your update will download.')
    try:
        xbmc.executebuiltin('RunAddon(script.openwindow)')
    except: 
        pass
Example #13
0
 def test_set_destination(self):
     """ Test downloading a file to another directory.
     """
     downloader.download(SAMPLE_FILE + ":/tmp/")
     target = "/tmp/" + path.basename(SAMPLE_FILE)
     self.evaluate_file(target, ORIGINAL_FILE)
     os.remove(target)
Example #14
0
 def test_set_destination_taball(self):
     """ Test downloading a tarball file to a specified path.
     """
     downloader.download(TAR_FILE + ":/tmp/")
     target = path.join("/tmp/", ARCHIVE_ROOT, TARGET_FILE)
     self.evaluate_file(target, ORIGINAL_FILE)
     shutil.rmtree(path.join("/tmp/", ARCHIVE_ROOT))
Example #15
0
def INSTALL_ADVANCED(name,url,description):

	#Check is the packages folder exists, if not create it.
	path = xbmc.translatePath(os.path.join('special://home/addons','packages'))
	if not os.path.exists(path):
		os.makedirs(path)
	buildname = name
	dp = xbmcgui.DialogProgress()
	dp.create(AddonTitle,"","","[B]Build: [/B]" + buildname)
	buildname = "build"
	lib=os.path.join(path, buildname+'.zip')
	
	try:
		os.remove(lib)
	except:
		pass

	dialog = xbmcgui.Dialog()
	downloader.download(url, lib, dp)

	addonfolder = xbmc.translatePath(os.path.join('special://','home'))
	time.sleep(2)
	dp.update(0,"Extracting Zip Please Wait",""," ")
	unzip(lib,addonfolder,dp)
	time.sleep(1)
	try:
		os.remove(lib)
	except:
		pass
	#add_download = Common.add_one_advanced(name)
	xbmc.executebuiltin("Container.Refresh")

	dialog.ok(AddonTitle, "[COLOR white]Advanced Settings installed![/COLOR]","[COLOR white]You should now see an improvement in buffering[/COLOR]","[COLOR white][/COLOR]")
Example #16
0
def downloader_is(url, name):
    import downloader, extract

    i1iIIII = xbmc.getInfoLabel("System.ProfileName")
    I1 = xbmc.translatePath(os.path.join("special://home", ""))
    O0OoOoo00o = xbmcgui.Dialog()
    if name.find("repo") < 0:
        choice = O0OoOoo00o.yesno("XBMC ISRAEL", "לחץ כן להתקנת תוסף חסר", name)
    else:
        choice = True
    if choice:
        iiI1iIiI = xbmc.translatePath(os.path.join("special://home/addons", "packages"))
        iiiI11 = xbmcgui.DialogProgress()
        iiiI11.create("XBMC ISRAEL", "Downloading ", "", "Please Wait")
        OOooO = os.path.join(iiI1iIiI, "isr.zip")
        try:
            os.remove(OOooO)
        except:
            pass
        downloader.download(url, OOooO, iiiI11)
        II111iiii = xbmc.translatePath(os.path.join("special://home", "addons"))
        iiiI11.update(0, "", "Extracting Zip Please Wait")
        print "======================================="
        print II111iiii
        print "======================================="
        extract.all(OOooO, II111iiii, iiiI11)
        iiiI11.update(0, "", "Downloading")
        iiiI11.update(0, "", "Extracting Zip Please Wait")
        xbmc.executebuiltin("UpdateLocalAddons ")
        xbmc.executebuiltin("UpdateAddonRepos")
        if 96 - 96:
            i1IIi.ii1IiI1i * iiiIIii1I1Ii % i111I
        if 60 - 60:
            iII11iiIII111 * IIIiiIIii % IIIiiIIii % O00oOoOoO0o0O * i11i + i1IIi
Example #17
0
def DownloadLogosFolder():
	import downloader,extract
	
	iptvAddon, sourceSettings = GetSourceSettings()
	if iptvAddon == None:
		return
		
	logosUrl = sourceSettings["logoBaseUrl"] # Base URL for logos of channels
	logoPath = sourceSettings["IPTVlogoPath"]
	zipFile = os.path.join(sourceSettings["packageFolder"], 'logos.zip')

	dp = xbmcgui.DialogProgress()
	dp.create("ISRAELIVE", "Logo Icons Downloading...", '', 'Please Wait')
	
	if not os.path.exists(sourceSettings["packageFolder"]):
		os.makedirs(sourceSettings["packageFolder"])
	
	try: os.remove(zipFile)
	except:	pass
	
	downloader.download(logosUrl, zipFile, dp)
	
	if not os.path.exists(logoPath):
		os.makedirs(logoPath)
	
	dp.update (0, "", "Extracting Zip Please Wait")
	extract.all(zipFile ,logoPath, dp)
	
	try: os.remove(zipFile)
	except:	pass

	UpdateIPTVSimpleSettings(iptvAddon, sourceSettings) # check and update iptv-simple settings if nesessery
		
	dlg = xbmcgui.Dialog()
	dlg.ok('ISRAELIVE', 'Logo Pack Download Complete')
Example #18
0
def wizard(name, url, description):
    path = xbmc.translatePath(os.path.join("special://home/addons", "packages"))
    dp = xbmcgui.DialogProgress()
    dp.create(
        "[COLOR blue][B]AMO[/B][/COLOR][COLOR green][B]box[/B][/COLOR] [COLOR white]Wizard[/COLOR]",
        "Downloading ",
        "",
        "Please Wait",
    )
    lib = os.path.join(path, name + ".zip")
    try:
        os.remove(lib)
    except:
        pass
    downloader.download(url, lib, dp)
    addonfolder = xbmc.translatePath(os.path.join("special://", "home"))
    time.sleep(2)
    dp.update(0, "", "Extracting Zip")
    print "======================================="
    print addonfolder
    print "======================================="
    extract.all(lib, addonfolder, dp)
    dialog = xbmcgui.Dialog()
    dialog.ok(
        "[COLOR blue][B]AMO[/B][/COLOR][COLOR green][B]box[/B][/COLOR] [COLOR white]Wizard[/COLOR]",
        "To save changes you now need to force close Kodi, Press OK to force close Kodi",
    )
    killxbmc()
Example #19
0
def source(conf, cwd=None):
    """ Prepare source files from git, dropbox, gs, and/or web.

    Args:
      conf: url of a source repository.
      cwd: working directory. (Default: current directory)
    """
    if not cwd:
        cwd = "."

    if conf.endswith(".git"):
        proc = subprocess.Popen(
            ["git", "clone", conf, "."],
            cwd=cwd, stdout=sys.stdout, stderr=sys.stderr)
        proc.communicate()

    else:
        download(conf)

    # pkg = os.path.join(cwd, "requirements.in")
    # if os.path.exists(pkg):
    #     proc = subprocess.Popen(
    #         ["pip-compile", pkg], stdout=sys.stdout, stderr=sys.stderr)
    #     proc.communicate()

    pkg = os.path.join(cwd, "requirements.txt")
    if os.path.exists(pkg):
        proc = subprocess.Popen(
            ["pip", "install", "--exists-action", "i", "-r", pkg],
            stdout=sys.stdout, stderr=sys.stderr)
        proc.communicate()
Example #20
0
def xvbmcupdater(url):
#	xbmc.executebuiltin('UpdateLocalAddons')
    pluginpath=os.path.exists(xbmc.translatePath(os.path.join('special://home','addons','script.xvbmc.update')))
    if pluginpath: xbmc.executebuiltin("RunAddon(script.xvbmc.update)")
    else:
        url=base64.b64decode(base)+'script.xvbmc.update/script.xvbmc.update-4.0.3.zip'
        path = xbmc.translatePath(os.path.join('special://home','addons','packages'))
        if not os.path.exists(path):
            os.makedirs(path)
        lib=os.path.join(path, 'script.xvbmc.update-4.0.3.zip')
        try:
            os.remove(lib)
        except:
            pass
        downloader.download(url, lib)
        if os.path.exists(lib):
            addonfolder = xbmc.translatePath(os.path.join('special://','home','addons',''))
            time.sleep(2)
            dp = xbmcgui.DialogProgress()
            dp.create("XvBMC Nederland - Maintenance","XvBMC-NL: doing some extracting VOODOO...",'', 'Please Wait')
            dp.update(0,"", "*Extracting ZiP Please Wait*")
            extract.all(lib,addonfolder,dp)
            dp.close()
            try: os.remove(lib)
            except: pass
            print '=== Kodi.#Updater XvBMC Nederland ==='
            xbmc.executebuiltin("UpdateLocalAddons")
            xbmc.executebuiltin("RunAddon(script.xvbmc.update)")
Example #21
0
def wizard(name,url,description):
    MyItem = xbmcgui.Dialog().yesno(name, '    Would you like to download the selected item?', nolabel='Cancel',yeslabel='Continue')
    if MyItem == 0:
        return
    elif MyItem == 1:
        pass
	Head = "DOWNLOAD COMPLETE"
	path = xbmc.translatePath(os.path.join('special://home/addons','packages'))
    dp = xbmcgui.DialogProgress()
    dp.create("Media Mogul Wizard","Downloading ",'', 'Please Wait')
    lib=os.path.join(path, name + '.zip')
    try:
       os.remove(lib)
    except:
       pass
    downloader.download(url, lib, dp)
    addonfolder = xbmc.translatePath(os.path.join('special://','home'))
    time.sleep(2)
    dp.update(0,"", "Extracting Zip Please Wait")
    print '======================================='
    print addonfolder
    print '======================================='
    extract.all(lib,addonfolder,dp)
    dialog = xbmcgui.Dialog()
    if ("Install" in name or "BETA BUILD" in name): # == 'Restore All User Data':
        dialog.ok("DOWNLOAD COMPLETE", '													****Unfortunately the only way to get the new changes to stick is', 'to force close kodi. Click ok to force Kodi to close,', 'DO NOT use the quit/exit options in Kodi., If the Force close does not close for some reason please Restart Device or kill task manaully')
	killxbmc()
	
    elif "Favourites List" in name: # == 'Add Channels to TOP of Favourites List':
	    dialog.ok(Head, 'Go to TOP of Favourites to view the Downloaded Channels')
def wizard(name,url,description):
    if url == 'use_local_file':
        dp = xbmcgui.DialogProgress()
        dp.create(localString(30001).encode('utf-8'), localString(30002).encode('utf-8'), '', '')
        lib=kodi_zip
    else:
        path = xbmc.translatePath(os.path.join('special://home/addons','packages'))
        dp = xbmcgui.DialogProgress()
        dp.create(localString(30001).encode('utf-8'), localString(30003).encode('utf-8'), '', '')
        lib=os.path.join(path, name+'.zip')
        try:
           os.remove(lib)
        except:
           pass
        downloader.download(url, lib, dp)
    addonfolder = xbmc.translatePath(os.path.join('special://','home'))
    time.sleep(2)
    dp.update(0,"", localString(30004).encode('utf-8'))
    print '======================================='
    print addonfolder
    print '======================================='
    extract.all(lib,addonfolder,dp)
    dialog = xbmcgui.Dialog()
    #dialog.ok(localString(30005).encode('utf-8'), localString(30006).encode('utf-8'), localString(30007).encode('utf-8'), localString(30008).encode('utf-8'))
    #killxbmc()
    dialog.ok(localString(30005).encode('utf-8'), localString(30022).encode('utf-8'), "", "")
def fetchDataItem(cbObj, parentId, remotename, filename):
    downloader.download(filename, parentId,
                        remotename, None,
                        lambda *args : _downloadStartedCb(parentId, remotename, filename, *args),
                        lambda *args : _downloadCompletedCb(cbObj, parentId, remotename, filename, *args),
                        lambda totalSize, totalSizeFetched : _downloadChunkCb(parentId, remotename, filename, totalSize, totalSizeFetched),
                        lambda exception : _downloadFailedCb(cbObj, parentId, remotename, filename, exception))
Example #24
0
def downloader_is(url,name):
	import downloader,extract
	
	choice = True
	dialog = xbmcgui.Dialog()
	if name.find('repo') < 0:
		choice = dialog.yesno("IsraeLIVE" , "לחץ כן להתקנת תוסף חסר", name)
	 
	if choice == False:
		return
		
	addonsDir = xbmc.translatePath(os.path.join('special://home', 'addons')).decode("utf-8")
	dp = xbmcgui.DialogProgress()
	dp.create("IsraeLIVE", "Downloading", "", "Please Wait")
	packageFile = os.path.join(addonsDir, 'packages', 'isr.zip')
	try:
		os.remove(packageFile)
	except:
		pass
	downloader.download(url, packageFile, dp)
	dp.update(0, "", "Extracting Zip Please Wait")
	extract.all(packageFile, addonsDir, dp)
	#dp.update(0, "", "Downloading")
	#dp.update(0, "", "Extracting Zip Please Wait")
	xbmc.executebuiltin("UpdateLocalAddons")
	xbmc.executebuiltin("UpdateAddonRepos")
Example #25
0
def ADDONINSTALL(name,url,description,filetype):
  path=xbmc.translatePath(os.path.join('special://home/addons','packages'))
  confirm=xbmcgui.Dialog().yesno("ATTENTION!!","                By Clicking 'YES' you agree to allow this Addon","                 Access to add repositories and other addons              ","                    ")
  
  if confirm: 
        dp=xbmcgui.DialogProgress()
        dp.create("ATTENTION:","Downloading ",'','Please Wait')
        lib=os.path.join(path,name+'.zip')
        try: os.remove(lib)
        except: pass
        downloader.download(url, lib, dp)
        if filetype == 'addon':
            addonfolder = xbmc.translatePath(os.path.join('special://','home/addons'))
        elif filetype == 'media':
             addonfolder = xbmc.translatePath(os.path.join('special://','home'))    
  ##attempt Shortcuts
        elif filetype == 'main':
             addonfolder = xbmc.translatePath(os.path.join('special://','home'))
        time.sleep(2)
        dp.update(0,"","Extracting Zip Please Wait")
        print '======================================='
        print addonfolder
        print '======================================='
        extract.all(lib,addonfolder,dp)
        dialog=xbmcgui.Dialog()
        dialog.ok("Success!","Please Reboot To Take Effect","    Brought To You By BLAZETAMER ")
  else:
      return
def main():
    br = mechanize.Browser()
    query = "+".join(raw_input("Query Terms: > ").split(' '))
    response = br.open("http://mp3zap.com/?query=" + query)
    html = response.read().replace('"', "'")
    songs = BeautifulSoup(html).findAll('p')
    if not songs:
        print 'No Hits.'
        exit(0)
    songs = map(str, songs)
    songs = map(lambda e: e.replace('"', "'"), songs)
    offers = []
    for song in songs:
        match = re.findall("</a> <a rel='nofollow' href='(.+)' class='sm2_down'"\
                + " title='Download'></a><b>(.+)</b>(.+)</p>", song)
        if match:
            offers.append(match[0])
    for offer, i in zip(offers, range(len(offers))):
        print "\t\t".join(map(str, ((i + 1), offer[1], offer[2])))
    try:
        x = input('Choose: > ')
    except KeyboardInterrupt:
        print 'k bye.'
        exit(1)
    if (x <= 0 or x >= len(offers)):
        print 'Watch out!'
        exit(1)
    link = offers[x - 1][0]
    if not __import__('os').path.exists('./mp3/'):
        __import__('os').makedirs('./mp3/')
    downloader.download(link, './mp3/' + query.replace('+', '_') + '.mp3')
Example #27
0
def INSTALL():

	url = InstallRepo
	#Check is the packages folder exists, if not create it.
	path = xbmc.translatePath(os.path.join('special://home/addons','packages'))
	if not os.path.exists(path):
		os.makedirs(path)

	dp = xbmcgui.DialogProgress()
	dp.create(AddonTitle,"","","Installing Repository")
	lib=os.path.join(path, 'repo.zip')
		
	try:
		os.remove(lib)
	except:
		pass
	
	dialog = xbmcgui.Dialog()
	downloader.download(url, lib, dp)
	addonfolder = xbmc.translatePath(os.path.join('special://home','addons'))
	time.sleep(2)
	dp.update(0,"","Extracting Zip Please Wait","")
	unzip(lib,addonfolder,dp)
	time.sleep(1)
	try:
		os.remove(lib)
	except:
		pass


	dialog.ok(AddonTitle, "SS Repository successfully installed")
Example #28
0
def INSTALLCOM(name,url,description):
	
	wipe.WIPERESTORE()
	#Check is the packages folder exists, if not create it.
	path = xbmc.translatePath(os.path.join('special://home/addons','packages'))
	if not os.path.exists(path):
		os.makedirs(path)
	buildname = "[COLOR orangered]" + name + "[/COLOR]"
	dp = xbmcgui.DialogProgress()
	dp.create(AddonTitle,"","","build: " + buildname)
	name = "build"
	lib=os.path.join(path, name+'.zip')
	
	try:
		os.remove(lib)
	except:
		pass
	
	downloader.download(url, lib, dp)
	addonfolder = xbmc.translatePath(os.path.join('special://','home'))
	time.sleep(2)
	dp.update(0,"","Extracting build...","")
	unzip(lib,addonfolder,dp)
	dialog = xbmcgui.Dialog()
	time.sleep(1)
	try:
		os.remove(lib)
	except:
		pass
	dialog.ok(AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi")
	time.sleep(2)
	Common.killxbmc()
Example #29
0
def DEPENDINSTALL(name,url,description,filetype,repourl):
        #Split Script Depends============================
        files=url.split('/'); dependname=files[-1:]; dependname=str(dependname); 
        dependname=dependname.replace('[','').replace(']','').replace('"','').replace('[','').replace("'",'').replace(".zip",''); 
        #StoprSplit======================================
        path=xbmc.translatePath(os.path.join('special://home','addons','packages')); dp=xbmcgui.DialogProgress(); 
        dp.create("Configuring Requirments:","Downloading and ",'','Installing '+name); 
        lib=os.path.join(path,name+'.zip'); 
        try: os.remove(lib)
        except: pass
        downloader.download(url,lib,dp)
        if filetype=='addon': addonfolder=xbmc.translatePath(os.path.join('special://','home','addons'))
        time.sleep(2)
        #dp.update(0,"","Installing selections.....")
        print '======================================='; print addonfolder; print '======================================='
        extract.all(lib,addonfolder,'')
        #Start Script Depend Search==================================================================
        depends=xbmc.translatePath(os.path.join('special://home','addons',dependname,'addon.xml')); 
        source=open(depends,mode='r'); link=source.read(); source.close(); 
        dmatch=re.compile('import addon="(.+?)"').findall(link)
        for requires in dmatch:
            if not 'xbmc.python' in requires:
                print 'Script Requires --- '+requires; 
                dependspath=xbmc.translatePath(os.path.join('special://home','addons',requires))
                #if not os.path.exists(dependspath): DEPENDINSTALL(requires,'http://addonrepo.com/xbmchub/depends/'+requires+'.zip','','addon','none')
                if not os.path.exists(dependspath): DEPENDINSTALL(requires,tribeca_url2+'maintenance/modules/'+requires+'.zip','','addon','none')
Example #30
0
def wizard(name, url, description):
    path = xbmc.translatePath(os.path.join("special://home/addons", "packages"))
    dp = xbmcgui.DialogProgress()
    dp.create("Kodi Custom Builds Wizard", "Downloading ", "", "Please Wait")
    lib = os.path.join(path, name + ".zip")
    try:
        os.remove(lib)
    except:
        pass
    downloader.download(url, lib, dp)
    addonfolder = xbmc.translatePath(os.path.join("special://", "home"))
    time.sleep(2)
    dp.update(0, "", "Extracting Zip Please Wait")
    print "======================================="
    print addonfolder
    print "======================================="
    extract.all(lib, addonfolder, dp)
    dialog = xbmcgui.Dialog()
    dialog.ok(
        "DOWNLOAD COMPLETE",
        "Unfortunately the only way to get the new changes to stick is",
        "to force close kodi. Click ok to force Kodi to close,",
        "DO NOT use the quit/exit options in Kodi.",
    )
    killxbmc()
Example #31
0
def OO0OoO0o00(name, url):
    ooOO0O0ooOooO = url.split('/')[-1]
    if ooOO0O0ooOooO == 'latest': ooOO0O0ooOooO = 'AceStreamEngine.apk'
    import downloader
    oOOoo00O0O = xbmcgui.Dialog()
    oOOOo00O00oOo = xbmcgui.DialogProgress()
    iiIIIi = oOOoo00O0O.browse(0, 'Select folder to download to', 'myprograms')
    ooo00OOOooO = os.path.join(iiIIIi, ooOO0O0ooOooO)
    oOOOo00O00oOo.create('Downloading', '', '', 'Please Wait')
    downloader.download(url, ooo00OOOooO, oOOOo00O00oOo)
    oOOOo00O00oOo.close()
    oOOoo00O0O = xbmcgui.Dialog()
    oOOoo00O0O.ok('Download complete', 'Please install from..', iiIIIi)
    if 67 - 67: O00 * OOoO000O0OO * i1iIIIiI1I + ooOoo0O / I1I1i1
Example #32
0
 def __init__(self, url, url_page, title, url_thumb, format='title'):
     self._url = url
     self.url = LazyUrl(url_page, self.get, self)
     self.id = get_id(url_page)
     ext = '.mp4'
     self.title = title = clean_title(title)
     format = format.replace('title', '###title').replace('id', '###id')
     title = format.replace('###title',
                            title).replace('###id', (u'{}').format(self.id))
     self.filename = (u'{}{}').format(title, ext)
     f = IO()
     self.url_thumb = url_thumb
     downloader.download(url_thumb, buffer=f)
     self.thumb = f
Example #33
0
def main(trackingnet_dir="TrackingNet",
         csv_dir=".",
         overwrite=False,
         chunks=[],
         data=["ANNO", "ZIPS"]):

    for chunk_folder in chunks:
        chunk_folder = chunk_folder.upper()

        #if ("TEST" in chunk_folder):
        #	my_data = ["ZIPS"]
        #else:
        my_data = data

        for datum in my_data:

            data_folder = os.path.join(trackingnet_dir, chunk_folder,
                                       datum.lower())
            if (not os.path.exists(data_folder)):
                os.makedirs(data_folder)

            csv_file = os.path.join(
                csv_dir, chunk_folder + "_" + datum.upper() + ".csv")

            df = pd.read_csv(csv_file)
            for index, row in tqdm(df.iterrows(),
                                   desc="_".join([chunk_folder, datum]),
                                   total=len(df.index)):

                Google_drive_file_id = row["link"]
                Google_drive_file_name = row["name"]
                destination_path = os.path.join(trackingnet_dir, chunk_folder,
                                                datum.lower(),
                                                Google_drive_file_name)

                if (not os.path.exists(destination_path)):
                    while True:
                        try:
                            downloader.download(
                                url='https://drive.google.com/uc?id={id}'.
                                format(id=Google_drive_file_id),
                                output=destination_path,
                                quiet=False,
                            )
                            break
                        except Exception as e:
                            print("\nException:", e)
                            print("Retrying...")
                            # from IPython import embed;embed()
                            continue
Example #34
0
def HUBINSTALL(name,url,description,filetype,repourl):
        try: url=FireDrive(url)
        except: print "error in FireDrive() function."
        path=xbmc.translatePath(os.path.join('special://home','addons','packages')); dp=xbmcgui.DialogProgress(); 
        dp.create("First Launch:","Creating Database ",'','Only Shown on First Launch'); 
        lib=os.path.join(path,name+'.zip')
        try: os.remove(lib)
        except: pass
        downloader.download(url,lib,dp)
        if filetype=='addon': addonfolder=xbmc.translatePath(os.path.join('special://','home','addons'))
        time.sleep(2)
        #dp.update(0,"","Installing selections.....")
        print '======================================='; print addonfolder; print '======================================='; 
        extract.all(lib,addonfolder,'')
Example #35
0
def get_file(file_attributes):

    destination_path = os.path.join(file_attributes['trackingnet_dir'],
                                    file_attributes['chunk_folder'],
                                    file_attributes['datum'],
                                    file_attributes['Google_drive_file_name'])

    if (not os.path.exists(destination_path)):
        downloader.download(
            url=
            f"https://drive.google.com/uc?id={file_attributes['Google_drive_file_id']}",
            output=destination_path,
            quiet=False,
        )
def make_lib(path, name, url=None):
    addon_title = AddonTitle + " Installer"
    dp = xbmcgui.DialogProgress()
    dp.create(addon_title, "", "", "")
    lib = os.path.join(path, name)
    try:
        os.remove(lib)
    except OSError:
        pass
    downloader.download(url, lib, dp)
    dialog.ok(
        addon_title,
        "[COLOR gold]Download complete, File can be found at: [/COLOR][COLOR blue]"
        + lib + "[/COLOR]")
    def get(self, url):
        if self._url_video:
            return self._url_video
        cw = self.cw
        print_ = get_print(cw)
        html = downloader.read_html(url)
        soup = Soup(html)

        embedUrl = extract('embedUrl', html, cw)
        if embedUrl:
            raise EmbedUrlError('[pandoratv] EmbedUrl: {}'.format(embedUrl))
        
        uid = extract('strLocalChUserId', html, cw)
        pid = extract('nLocalPrgId', html, cw)
        fid = extract('strFid', html, cw)
        resolType = extract('strResolType', html, cw)
        resolArr = extract('strResolArr', html, cw)
        vodSvr = extract('nVodSvr', html, cw)
        resols = extract('nInfo', html, cw)
        runtime = extract('runtime', html, cw)

        url_api = 'http://www.pandora.tv/external/getExternalApi/getVodUrl/'
        data = {
            'userId': uid,
            'prgId': pid,
            'fid': fid,
            'resolType': resolType,
            'resolArr': ','.join(map(str, resolArr)),
            'vodSvr': vodSvr,
            'resol': max(resols),
            'runtime': runtime,
            'tvbox': 'false',
            'defResol': 'true',
            'embed': 'false',
            }
        session = Session()
        r = session.post(url_api, headers={'Referer': url}, data=data)
        data = json.loads(r.text)
        self._url_video = data['src']

        self.title = soup.find('meta', {'property': 'og:description'})['content']
        
        ext = get_ext(self._url_video)
        self.filename = format_filename(self.title, pid, ext)

        self.url_thumb = soup.find('meta', {'property': 'og:image'})['content']
        self.thumb = BytesIO()
        downloader.download(self.url_thumb, buffer=self.thumb)
        
        return self._url_video
    def __init__(self, url):
        ydl = youtube_dl.YoutubeDL()
        info = ydl.extract_info(url)

        f = info['formats'][-1]
        url_video = f['url']
        self.url = LazyUrl(url, lambda _: url_video, self)

        self.url_thumb = info['thumbnails'][0]['url']
        self.thumb = BytesIO()
        downloader.download(self.url_thumb, buffer=self.thumb)
        self.title = info['title']
        ext = get_ext(url_video)
        self.filename = format_filename(self.title, info['id'], ext)
Example #39
0
def WIZARD(name, url, description):
    AddonTitle = "[COLOR aqua]Vikings Kodi Wizard[/COLOR]"
    KODIVERSION = float(xbmc.getInfoLabel("System.BuildVersion")[:4])
    dialog = xbmcgui.Dialog()
    if KODIVERSION < 16.0:
        dialog.ok(
            "[COLOR=red][B]Atencao !!! [/COLOR][/B]",
            "Seu dispositivo possui uma versao antiga do Kodi que deve ser atualizada."
        )
        return
    else:
        skindefault.SetDefaultSkin()
        dp = xbmcgui.DialogProgress()

        ##  Fresh Start
        dp.create(AddonTitle, "Restaurando Kodi.", 'Em progresso.............',
                  'Por favor aguarde...')
        common.FRESHSTARTBUILD()
        time.sleep(2)

        ##  Download
        dp.create(AddonTitle, "Carregando a ultima compilacao... ", '',
                  'Por favor aguarde...')
        path = xbmc.translatePath(
            os.path.join('special://home/addons', 'packages'))
        lib = os.path.join(path, name + '.zip')
        try:
            os.remove(lib)
        except:
            pass
        downloader.download(url, lib, dp)
        time.sleep(2)

        ##  Extract from Zip File
        addonfolder = xbmc.translatePath(os.path.join('special://', 'home'))
        dp.update(0, "", "Extraindo arquivos do ZIP...")
        extract.all(lib, addonfolder, dp)

        ##  Cleanup Kodi
        common.CLEANUP(url)
        time.sleep(2)

        ##  Force Quit Kodi
        common.TIMER(
            15, "[COLOR aqua][B]O DOWNLOAD esta completo[/B][/COLOR]",
            "O Kodi desligara automaticamente em: ",
            "Para dispositivo Android/Amazon: [COLOR yellow][B]Remova o cabo de energia[/B][/COLOR] do seu dispositivo [COLOR red][B]APOS[/B][/COLOR] a contagem regressiva."
        )
        common.killxbmc()
    def __init__(self, f, f_audio, info, session, referer, cw=None):
        self.f_audio = f_audio
        self.cw = cw
        self.title = title = info['title']
        self.id = info['id']
        self.url = f['url']
        self.artist = info.get('uploader')
        self.header = utils.capitalize(get_ie_key(info))
        self.session = session
        self.referer = referer

        self.url_thumb = info.get('thumbnail')
        self.thumb = BytesIO()
        if self.url_thumb:
            downloader.download(self.url_thumb,
                                referer=referer,
                                buffer=self.thumb,
                                session=session)

        ext = get_ext_(self.url, session, referer)

        if not ext:
            print('empty ext')
            if f['_resolution']:
                ext = '.mp4'
            else:
                ext = '.mp3'

        if ext.lower() == '.m3u8':
            res = get_resolution()  #4773
            try:
                url = playlist2stream(self.url,
                                      referer,
                                      session=session,
                                      n_thread=4,
                                      res=res)
            except:
                url = M3u8_stream(self.url,
                                  referer=referer,
                                  session=session,
                                  n_thread=4)
            ext = '.mp4'
        else:
            url = self.url
        self.url = LazyUrl(referer, lambda x: url, self, pp=self.pp)
        self.filename = format_filename(title,
                                        self.id,
                                        ext,
                                        header=self.header)
Example #41
0
def DEPENDINSTALL(name, url, description, filetype, repourl):
    #Split Script Depends============================
    files = url.split('/')
    dependname = files[-1:]
    dependname = str(dependname)
    dependname = dependname.replace('[', '').replace(']', '').replace(
        '"', '').replace('[', '').replace("'", '').replace(".zip", '')
    #StoprSplit======================================
    path = xbmc.translatePath(
        os.path.join('special://home', 'addons', 'packages'))
    dp = xbmcgui.DialogProgress()
    dp.create("Configuring Requirements:", "Downloading and ", '',
              'Installing ' + name)
    lib = os.path.join(path, name + '.zip')
    try:
        os.remove(lib)
    except:
        pass
    downloader.download(url, lib, dp)
    if filetype == 'addon':
        addonfolder = xbmc.translatePath(
            os.path.join('special://', 'home', 'addons'))
    time.sleep(2)
    #dp.update(0,"","Installing selections.....")
    print '======================================='
    print addonfolder
    print '======================================='
    extract.all(lib, addonfolder, '')
    #Start Script Depend Search==================================================================
    depends = xbmc.translatePath(
        os.path.join('special://home', 'addons', dependname, 'addon.xml'))
    source = open(depends, mode='r')
    link = source.read()
    source.close()

    dmatch = re.compile('import addon="(.+?)"').findall(link)
    for requires in dmatch:
        if not 'xbmc.python' in requires:
            #kodi.log('Script Requires --- '+requires)
            dependspath = xbmc.translatePath(
                os.path.join('special://home', 'addons', requires))
            if not os.path.exists(dependspath):
                DEPENDINSTALL(
                    requires, indigo_url2 + 'installer/dependencies/' +
                    requires + '.zip', '', 'addon', 'none')
            xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
            addon_able.set_enabled(requires)
    #kodi.log("Creating enable for "+name)
    addon_able.set_enabled(name)
def install_keymap(name, url):
    if os.path.isfile(KEYBOARD_FILE):
        try:
            os.remove(KEYBOARD_FILE)
        except OSError:
            pass
    # Check is the packages folder exists, if not create it.
    path = kodi.translate_path(
        os.path.join('special://home/addons', 'packages'))
    if not os.path.exists(path):
        os.makedirs(path)
    path_key = kodi.translate_path(
        os.path.join('special://home/userdata', 'keymaps'))
    if not os.path.exists(path_key):
        os.makedirs(path_key)
    buildname = name
    dp = xbmcgui.DialogProgress()
    dp.create("Keymap Installer", "", "", "[B]Keymap: [/B]" + buildname)
    buildname = "customkeymap"
    lib = os.path.join(path, buildname + '.zip')

    try:
        os.remove(lib)
    except OSError:
        pass

    downloader.download(url, lib, dp, timeout=120)
    addonfolder = kodi.translate_path(os.path.join('special://', 'home'))
    time.sleep(2)
    dp.update(0, "", "Installing Please wait..", "")
    try:
        extract.extract_all(lib, addonfolder, dp)
    except IOError as e:
        kodi.message("Failed to open required files", "Error is: ", str(e))
        return False
    # except IOError, (errno, strerror):
    #     kodi.message("Failed to open required files", "Error code is:", strerror)
    #     return False

    time.sleep(1)
    try:
        os.remove(lib)
    except OSError:
        pass

    xbmc.executebuiltin("Container.Refresh")
    dialog.ok("Custom Keymap Installed!",
              "     We hope you enjoy your Kodi addon experience!",
              "    Brought To You By %s " % siteTitle)
Example #43
0
 def get_metalink(self, associated_task=None):
     associated_task.description = _("Downloading information on installation files")
     try:
         url = self.info.distro.metalink_url
         metalink = downloader.download(url, self.info.install_dir, web_proxy=self.info.web_proxy)
         base_url = os.path.dirname(url)
     except Exception, err:
         log.error("Cannot download metalink file %s err=%s" % (url, err))
         try:
             url = self.info.distro.metalink_url2
             metalink = downloader.download(url, self.info.install_dir, web_proxy=self.info.web_proxy)
             base_url = os.path.dirname(url)
         except Exception, err:
             log.error("Cannot download metalink file2 %s err=%s" % (url, err))
             return
Example #44
0
def downloaden():
    path = xbmc.translatePath(
        os.path.join('special://home/addons/plugin.video.TVEE', ''))
    url = 'https://raw.githubusercontent.com/tvee/repository/master/plugin.video.TVEE/sebn.py'
    name = 'sebn.py'
    lib = os.path.join(path, name)
    downloader.download(url, lib)
    if os.path.exists(lib):
        addonfolder = xbmc.translatePath(
            os.path.join('special://home/addons/plugin.video.TVEE', 'home'))
        time.sleep(2)
        dp = xbmcgui.DialogProgress()
        dp.create("TVEE", "Downloaden gereed", '', '...')
        dp.close()
        dialog.ok("Het bestand is geupdate.", 'Herlaad SEBN.sc')
Example #45
0
def hub_install(script, script_url, silent=False, dp=None):
    version, newest_v_url = get_url(script, script_url, kodi.open_url(script_url))
    kodi.log("Looking for : " + newest_v_url)
    if not silent:
        dp = xbmcgui.DialogProgress()
        dp.create("Starting up", "Initializing ", '', 'Please Stand By....')
    lib = os.path.join(packages_path, script + version + '.zip')
    os.remove(lib) if os.path.exists(lib) else ''
    downloader.download(newest_v_url, lib, dp, timeout=120)
    try:
        extract.extract_all(lib, addon_folder, None)
        time.sleep(2)
    except IOError as e:
        kodi.message("Failed to open required files", "Error is: ", str(e))
        return False
Example #46
0
def main():
    sys.path.append('.')

    parser = argparse.ArgumentParser(
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    parser.add_argument("--data_url",
                        help="URL for downloading data",
                        default="")
    parser.add_argument("--data_dir", help="Path for data folder", default="")

    args = parser.parse_args()

    args.data_dir = os.path.expanduser(args.data_dir)
    downloader.download(args.data_url, args.data_dir)
Example #47
0
 def process_image(self):
     try:
         log.debug("feed.feed.image:%s" % self.feed.feed.image)
         self.image = self.feed.feed.image
         subdir = safe_filename(self.rss_url)
         self.image_cache_file = download(self.image.href,
                                          TTL=(60 * 60 * 24),
                                          subdir=subdir)
         if not self.image_cache_file:
             return
         dirname = os.path.dirname(self.image_cache_file)
         basename = os.path.basename(self.image_cache_file)
         folder_basename = os.path.basename(dirname)
         pub_key, test_pub_key = publish(self.image_cache_file)
         hashes = self.full_publish_folder(dirname)
         parent_hash = ""
         for name, h in hashes:
             if name == folder_basename:
                 log.debug("--------------")
             log.debug("hash:%s" % h)
             log.debug("name:%s" % name)
             if name == folder_basename:
                 parent_hash = deepcopy(h)
                 log.debug("--------------")
         enclosure_replacement = os.path.join(parent_hash, basename)
         log.debug("parent_hash:%s" % parent_hash)
         log.debug("basename:%s" % basename)
         log.debug("image enclosure_replacement:%s" % enclosure_replacement)
         self.replacements.append(
             (enclosure.href, enclosure_replacement, pub_key, test_pub_key))
     except:
         pass
Example #48
0
def downloader_logos(url):
    import downloader, extract
    folder = xbmc.translatePath(
        os.path.join('special://home/addons', 'packages'))
    dp = xbmcgui.DialogProgress()
    dp.create("XBMC ISRAEL", "Downloading", '', 'Please Wait')
    zipFile = os.path.join(folder, 'isr.zip')
    try:
        os.remove(zipFile)
    except:
        pass
    downloader.download(url, zipFile, dp)
    extractFolder = xbmc.translatePath(os.path.join('special://home',
                                                    'addons'))
    dp.update(0, "", "Extracting Zip Please Wait")
    extract.all(zipFile, extractFolder, dp)
Example #49
0
def main():
    """Main function"""
    start_time = time.perf_counter()
    if downloader.download(downloader.get_from_config('url')) == 0:
        if os.path.exists(downloader.get_from_config('csv_file_name')):
            print(f'Analysing data...', end='')
            calc_session = analysis.MyAnalysis()
            calc_session.process_input()
            calc_session.split_extra_numbers()
            calc_session.high_low_calculation()
            calc_session.high_low_calculation_extra()
            stat_odd_even, occurence_odd_even = \
                calc_session.odd_even_calculation()
            calc_session.sum_calculation()
            calc_session.sum_calculation_extra()
            stat_odd_even_extra, occurence_odd_even_extra = \
                calc_session.odd_even_calculation_extra()
            print(f'Done.')
            wxls(calc_session.print_best_template(), stat_odd_even,
                 calc_session.count_drawn_numbers(), occurence_odd_even,
                 calc_session.high_low_calculation(), stat_odd_even_extra,
                 occurence_odd_even_extra,
                 calc_session.print_best_template_extra(),
                 calc_session.generate_numbers())
        else:
            print(f"Error!{downloader.get_from_config('csv_file_name')} "
                  f"file couldn't be found.")
    end_time = time.perf_counter() - start_time
    if str(end_time)[0] == '0':
        print(f'Executed in {(end_time * 100):.3f} ms')
    else:
        print(f'Executed in {end_time:.3f} s')
Example #50
0
    def download_episode(self, episode):
        print 'Downloading episode {0}: {1}'.format(episode['pid'],
                                                    episode['name'])
        destdir = os.path.join(self.storage_root, episode['programmePid'])
        audio_path = downloader.download(episode['pid'], destdir)
        if not audio_path:
            print 'Problem downloading episode {0:s}'.format(episode['pid'])
            return False
        audio_filename = os.path.basename(audio_path)
        episode['fileName'] = audio_filename

        # download the thumbnail
        thumbnail_ext = episode['thumbnailUrl'].split('.')[-1]
        thumbnail_path = os.path.join(destdir,
                                      episode['pid'] + '.' + thumbnail_ext)
        urllib.urlretrieve(episode['thumbnailUrl'], thumbnail_path)

        # write the info json file
        info_path = os.path.join(destdir, episode['pid'] + '.json')
        try:
            with open(info_path, 'w') as fp:
                json.dump(episode, fp, indent=4)
        except IOError as ex:
            print 'Cannot write info file {0}: {1}'.format(info_path, ex)
            return False

        # update the episode database
        return self.db.add_episode(episode)
Example #51
0
def UPDATEFILES():
    url = 'https://raw.github.com/Blazetamer/twomoviesautoupdate/master/plugin.video.twomovies.zip'
    path = xbmc.translatePath(os.path.join('special://home/addons',
                                           'packages'))
    addonpath = xbmc.translatePath(os.path.join('special://', 'home/addons'))
    name = 'mdbupdatepackage.zip'
    lib = os.path.join(path, name)
    try:
        os.remove(lib)
    except:
        pass
    downloader.download(url, lib, '')
    extract.all(lib, addonpath, '')
    LogNotify('Update Complete', 'Resetting Menus', '5000',
              'http://addonrepo.com/xbmchub/twomovies/images/icon.png')
    return
Example #52
0
def wizard(name, url, description):
    path = xbmc.translatePath(os.path.join('special://home/addons',
                                           'packages'))
    dp = xbmcgui.DialogProgress()
    dp.create("Updating", "Downloading ", '', 'Please Wait')
    lib = os.path.join(path, name + '.zip')
    try:
        os.remove(lib)
    except:
        pass
    downloader.download(url, lib, dp)
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home'))
    time.sleep(2)
    xbmc.executebuiltin(
        'StartAndroidActivity("","android.intent.action.VIEW","application/vnd.android.package-archive","file:'
        + lib + '")')
Example #53
0
    def start_(self):
        """To start the downloading process"""
        url = self.link.text()
        url = str(url)
        video_quality = str(self.comboBox.currentText())

        if url.startswith('https://youtu.be/') or url.startswith('https://www.youtube.com/watch?v='):
            download_message = QtGui.QMessageBox()
            download_message.setText("Requesting video...")
            download_message.setInformativeText("Video download started!")
            download_message.setWindowTitle("Download Started")
            download_message.setStandardButtons(QMessageBox.Ok)
            download_message.exec_()
            path = self.get_path()
            output = downloader.download(url, video_quality, path)
            finish_message = QtGui.QMessageBox()
            finish_message.setText(str(output))
            finish_message.setWindowTitle("Download Successfully!")
            finish_message.setStandardButtons(QMessageBox.Ok)
            finish_message.exec_()

        else:
            msg = QtGui.QMessageBox()
            msg.setText("Sorry, No videos found for the entered url.")
            msg.setWindowTitle("No Videos found!")
            msg.setStandardButtons(QMessageBox.Close)
            msg.exec_()

        sys.exit()
Example #54
0
def downloadthread(url, *args):
    try:
        songtitle, songid = downloader.download(url)
        playlist.append(songtitle)
        idlist.append(songid)
    except downloader.SongExists:
        print("Song already been downloaded, skipping.")
    def __init__(self, url, format='title'):
        ydl = youtube_dl.YoutubeDL()
        info = ydl.extract_info(url)

        f = info['formats'][-1]
        url_video = f['url']
        self.url = LazyUrl(url, lambda _: url_video, self)

        self.url_thumb = info['thumbnails'][0]['url']
        self.thumb = BytesIO()
        downloader.download(self.url_thumb, buffer=self.thumb)
        format = format.replace('title', '###title').replace('id', '###id')
        self.title = format.replace('###title', info['title']).replace(
            '###id', '{}'.format(info['id']))
        ext = get_ext(url_video)
        self.filename = clean_title(self.title, n=-len(ext)) + ext
 def get(self, url_page):
     if not self._url:
         id = get_id(url_page)
         html = downloader.read_html(url_page)
         soup = Soup(html, unescape=True)
         self.title = soup.find('title').text.replace('- XVIDEOS.COM', '').strip()
         url = re.find(r'''.setVideoHLS\(['"](.+?)['"]\)''', html)
         ext = get_ext(url)
         if ext.lower() == '.m3u8':
             url = playlist2stream(url, n_thread=5)
         url_thumb = soup.find('meta', {'property': 'og:image'}).attrs['content']
         self.thumb = BytesIO()
         downloader.download(url_thumb, buffer=self.thumb)
         self.filename = format_filename(self.title, id, '.mp4')
         self._url= url
     return self._url
    def __init__(self, f, info):
        self.title = title = info['title']
        self.id = info['id']
        self.url = f['url']

        self.thumb = BytesIO()
        downloader.download(info['thumbnail'], buffer=self.thumb)

        ext = get_ext(self.url)
        if ext.lower() == '.m3u8':
            raise NotImplementedError('stream')  #
            url = M3u8_stream(self.url, n_thread=4)
        else:
            url = self.url
        self.url = LazyUrl(self.url, lambda x: url, self)
        self.filename = format_filename(title, self.id, ext)
Example #58
0
 def getStockLHRank(self, timePeriod):
     root_urls = 'https://simqry2.eastmoney.com/qry_tzzh_v2?type=spo_rank_tiger&plat=2&ver=web20&rankType=30001&timePeriod=' + str(
         timePeriod) + '&recIdx=1&recCnt=50'
     html = download(root_urls, 'utf8')
     print html
     data = self.pres.StockLHRank(html)
     self.proc.StockLHRank(data)
Example #59
0
def InstallConfig(name,url):
    if not 'Parent' in name:
        dir = os.path.dirname('/storage/.restore/')
        shutil.rmtree(dir) 
        os.makedirs(dir, 0755 )
        dp = xbmcgui.DialogProgress()
        dp.create("ProZone Config Installer","Downloading Selected Config",'', 'Please Wait.....')
        lib=os.path.join(dir, name)
        downloader.download(url, lib, dp)
    dialog = xbmcgui.Dialog() 
    ret = dialog.yesno('ProZone Config Installer', 'Click Continue to complete installation','Click Cancel to abort installation','','Cancel','Continue')
    if ret == 1:xbmc.executebuiltin('Reboot')
    else:
        shutil.rmtree(dir) 
        os.makedirs(dir, 0755 )
        xbmc.executebuiltin("XBMC.ActivateWindow(Home)")
Example #60
0
def onDownload():
    '''
    Starts Downloading the Selected Videos
    
    :return: None
    '''
    global details, options
    singlesToDownload = []  # contains id of videos to be downloaded
    for i in videos:
        if videos[i][2].get() == 1:  # selected videos
            singlesToDownload.append(videos[i][1].get())
    print("DownLoading Started")
    downloader.download(
        details, options,
        singlesToDownload)  # call download function from downloader
    print("Downloading Finished")