Exemple #1
0
def allNoProgress(_in, _out, ignore):
    try:
        zin = zipfile.ZipFile(_in, 'r')
        zin.extractall(_out)
    except Exception, e:
        wiz.log(str(e))
        return False
Exemple #2
0
def _pbhook(numblocks, blocksize, filesize, dp, start_time):
    try:
        percent = min(numblocks * blocksize * 100 / filesize, 100)
        currently_downloaded = float(numblocks) * blocksize / (1024 * 1024)
        kbps_speed = numblocks * blocksize / (time.time() - start_time)
        if kbps_speed > 0 and not percent == 100:
            eta = (filesize - numblocks * blocksize) / kbps_speed
        else:
            eta = 0
        kbps_speed = kbps_speed / 1024
        type_speed = 'KB'
        if kbps_speed >= 1024:
            kbps_speed = kbps_speed / 1024
            type_speed = 'MB'
        total = float(filesize) / (1024 * 1024)
        mbs = '[COLOR %s][B]Boyut:[/B] [COLOR %s]%.02f[/COLOR] MB of [COLOR %s]%.02f[/COLOR] MB[/COLOR]' % (
            COLOR2, COLOR1, currently_downloaded, COLOR1, total)
        e = '[COLOR %s][B]Hiz:[/B] [COLOR %s]%.02f [/COLOR]%s/s ' % (
            COLOR2, COLOR1, kbps_speed, type_speed)
        e += '[B]SURE:[/B] [COLOR ' + COLOR1 + ']%02d:%02d[/COLOR][/COLOR]' % divmod(
            eta, 60)
        dp.update(percent, '', mbs, e)
    except Exception, e:
        wiz.log("Hatali Indirme: %s" % str(e), xbmc.LOGERROR)
        return str(e)
Exemple #3
0
def _pbhook(numblocks, blocksize, filesize, dp, start_time):
    try:
        percent = min(numblocks * blocksize * 100 / filesize, 100)
        currently_downloaded = float(numblocks) * blocksize / (1024 * 1024)
        kbps_speed = numblocks * blocksize / (time.time() - start_time)
        if kbps_speed > 0 and not percent == 100:
            eta = (filesize - numblocks * blocksize) / kbps_speed
        else:
            eta = 0
        kbps_speed = kbps_speed / 1024
        type_speed = 'KB'
        if kbps_speed >= 1024:
            kbps_speed = kbps_speed / 1024
            type_speed = 'MB'
        total = float(filesize) / (1024 * 1024)
        mbs = '[COLOR lime]Velicina:[/COLOR] [COLOR white]%.02f[/COLOR] [COLOR lime]MB of[/COLOR] [COLOR white]%.02f[/COLOR] [COLOR lime]MB[/COLOR]' % (
            currently_downloaded, total)
        e = '[COLOR lime]Brzina:[/COLOR] [COLOR white]%.02f [/COLOR][COLOR lime]%s/s[/COLOR] ' % (
            kbps_speed, type_speed)
        e = '[COLOR lime]Preostalo:[/COLOR] [COLOR white]%02d:%02d[/COLOR] [COLOR lime]minuta[/COLOR]' % divmod(
            eta, 60)
        dp.update(percent, '', mbs, e)
    except Exception, e:
        wiz.log("Greska preuzimanja: %s" % str(e), xbmc.LOGERROR)
        pass
Exemple #4
0
def allNoProgress(_in, _out, ignore):
	try:
		zin = zipfile.ZipFile(_in, 'r')
		zin.extractall(_out)
	except Exception, e:
		wiz.log(str(e))
		return False
Exemple #5
0
def _pbhook(numblocks, blocksize, filesize, dp, start_time):
    try:
        percent = min(numblocks * blocksize * 100 / filesize, 100)
        currently_downloaded = float(numblocks) * blocksize / (1024 * 1024)
        kbps_speed = numblocks * blocksize / (time.time() - start_time)
        if kbps_speed > 0 and not percent == 100:
            eta = (filesize - numblocks * blocksize) / kbps_speed
        else:
            eta = 0
        kbps_speed = kbps_speed / 1024
        type_speed = 'KB'
        if kbps_speed >= 1024:
            kbps_speed = kbps_speed / 1024
            type_speed = 'MB'
        total = float(filesize) / (1024 * 1024)
        mbs = '[COLOR %s][B]Tamanho:[/B] [COLOR %s]%.02f[/COLOR] MB de [COLOR %s]%.02f[/COLOR] MB[/COLOR]' % (
            COLOR2, COLOR1, currently_downloaded, COLOR1, total)
        e = '[COLOR %s][B]Velocidade:[/B] [COLOR %s]%.02f [/COLOR]%s/s ' % (
            COLOR2, COLOR1, kbps_speed, type_speed)
        e += '[B]Tempo Restante:[/B] [COLOR ' + COLOR1 + ']%02d:%02d[/COLOR][/COLOR]' % divmod(
            eta, 60)
        dp.update(percent, '', mbs, e)
    except Exception, e:
        wiz.log("Erro ao Fazer Download: %s" % str(e), xbmc.LOGERROR)
        pass
Exemple #6
0
def allWithProgress(_in, _out, dp, ignore, title):
	count = 0; errors = 0; error = ''; update = 0; size = 0; excludes = []
	try:
		zin = zipfile.ZipFile(_in,  'r')
	except Exception, e:
		errors += 1; error += '%s\n' % e
		wiz.log('Error Checking Zip: %s' % str(e), xbmc.LOGERROR)
		return update, errors, error
def allWithProgress(_in, _out, dp, ignore, title):
	count = 0; errors = 0; error = ''; update = 0; size = 0; excludes = []
	try:
		zin = zipfile.ZipFile(_in,  'r')
	except Exception, e:
		errors += 1; error += '%s\n' % e
		wiz.log('Error Checking Zip: %s' % str(e), xbmc.LOGERROR)
		return update, errors, error
Exemple #8
0
def swapUS():
	new = '"addons.unknownsources"'
	value = 'true'
	query = '{"jsonrpc":"2.0", "method":"Settings.GetSettingValue","params":{"setting":%s}, "id":1}' % (new)
	response = xbmc.executeJSONRPC(query)
	wiz.log("get settings: %s" % str(response), xbmc.LOGDEBUG)
	if 'false' in response:
		query = '{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{"setting":%s,"value":%s}, "id":1}' % (new, value)
		response = xbmc.executeJSONRPC(query)
		wiz.ebi('SendClick(11)')
		wiz.log("set settings: %s" % str(response), xbmc.LOGDEBUG)
	return False
Exemple #9
0
def swapUS():
	new = '"addons.unknownsources"'
	value = 'true'
	query = '{"jsonrpc":"2.0", "method":"Settings.GetSettingValue","params":{"setting":%s}, "id":1}' % (new)
	response = xbmc.executeJSONRPC(query)
	wiz.log("get settings: %s" % str(response), xbmc.LOGDEBUG)
	if 'false' in response:
		query = '{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{"setting":%s,"value":%s}, "id":1}' % (new, value)
		response = xbmc.executeJSONRPC(query)
		wiz.ebi('SendClick(11)')
		wiz.log("set settings: %s" % str(response), xbmc.LOGDEBUG)
	return False
Exemple #10
0
def swapUS():
	new = '"addons.unknownsources"'
	value = 'true'
	query = '{"jsonrpc":"2.0", "method":"Settings.GetSettingValue","params":{"setting":%s}, "id":1}' % (new)
	response = xbmc.executeJSONRPC(query)
	wiz.log("Unknown Sources Get Settings: %s" % str(response), xbmc.LOGDEBUG)
	if 'false' in response:
		thread.start_new_thread(dialogWatch, ())
		xbmc.sleep(200)
		query = '{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{"setting":%s,"value":%s}, "id":1}' % (new, value)
		response = xbmc.executeJSONRPC(query)
		wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, ADDONTITLE), '[COLOR %s]Unknown Sources:[/COLOR] [COLOR %s]Enabled[/COLOR]' % (COLOR1, COLOR2))
		wiz.log("Unknown Sources Set Settings: %s" % str(response), xbmc.LOGDEBUG)
Exemple #11
0
def swapUS():
	new = '"addons.unknownsources"'
	value = 'true'
	query = '{"jsonrpc":"2.0", "method":"Settings.GetSettingValue","params":{"setting":%s}, "id":1}' % (new)
	response = xbmc.executeJSONRPC(query)
	wiz.log("Unknown Sources Get Settings: %s" % str(response), xbmc.LOGDEBUG)
	if 'false' in response:
		thread.start_new_thread(dialogWatch, ())
		xbmc.sleep(200)
		query = '{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{"setting":%s,"value":%s}, "id":1}' % (new, value)
		response = xbmc.executeJSONRPC(query)
		wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, ADDONTITLE), '[COLOR %s]Unknown Sources:[/COLOR] [COLOR %s]Enabled[/COLOR]' % (COLOR1, COLOR2))
		wiz.log("Unknown Sources Set Settings: %s" % str(response), xbmc.LOGDEBUG)
Exemple #12
0
def allWithProgress(_in, _out, dp, ignore, title):
    count = 0
    errors = 0
    error = ''
    update = 0
    size = 0
    start_time = time.time()
    try:
        zin = zipfile.ZipFile(_in, 'r')
    except Exception, e:
        errors += 1
        error += '%s\n' % e
        wiz.log('Error Checking Zip: %s' % str(e), xbmc.LOGERROR)
        return update, errors, error
Exemple #13
0
def allWithProgress(_in, _out, dp, ignore, title):
    count = 0
    errors = 0
    error = ''
    update = 0
    size = 0
    excludes = []
    try:
        zin = zipfile.ZipFile(_in, 'r')
    except Exception, e:
        errors += 1
        error += '%s\n' % e
        wiz.log('Erro ao Verificar o Arquivo ZIP: %s' % str(e), xbmc.LOGERROR)
        return update, errors, error
Exemple #14
0
def download(url, dest, dp=None):
    if not dp:
        dp = xbmcgui.DialogProgress()
        dp.create(ADDONTITLE, "Downloading Content", ' ', ' ')
    dp.update(0)
    start_time = time.time()
    try:
        urllib.urlretrieve(
            url, dest, lambda nb, bs, fs: _pbhook(nb, bs, fs, dp, start_time))
    except Exception, e:
        wiz.log("ERROR Downloading(%s): %s" % (dest, str(e)), xbmc.LOGERROR)
        wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, ADDONTITLE),
                      "[COLOR %s]Download Timed Out[/COLOR]" % COLOR2)
        sys.exit()
Exemple #15
0
def allWithProgress(_in, _out, dp, ignore, title):
    count = 0
    errors = 0
    error = ''
    update = 0
    size = 0
    excludes = []
    try:
        content_file = io.FileIO(_in, 'r')
        zin = zipfile.ZipFile(content_file, 'r')
    except Exception, e:
        errors += 1
        error += '%s\n' % e
        wiz.log('Error Checking Zip: %s' % str(e), xbmc.LOGERROR)
        return update, errors, error
Exemple #16
0
def allWithProgress(_in, _out, dp, ignore, title, fix=False):
    count = 0
    errors = 0
    error = ''
    update = 0
    size = 0
    excludes = []
    try:
        if fix:
            zin = fixZip(_in)
        else:
            zin = zipfile.ZipFile(_in, 'r')
    except Exception, e:
        if not fix:
            return allWithProgress(_in, _out, dp, ignore, title, True)
        else:
            errors += 1
            error += '%s\n' % e
            wiz.log('Error Checking Zip: %s' % str(e), xbmc.LOGERROR)
            return update, errors, error
Exemple #17
0
def _pbhook(numblocks, blocksize, filesize, dp, start_time):
	try: 
		percent = min(numblocks * blocksize * 100 / filesize, 100) 
		currently_downloaded = float(numblocks) * blocksize / (1024 * 1024) 
		kbps_speed = numblocks * blocksize / (time.time() - start_time) 
		if kbps_speed > 0 and not percent == 100: 
			eta = (filesize - numblocks * blocksize) / kbps_speed 
		else: 
			eta = 0
		kbps_speed = kbps_speed / 1024 
		total = float(filesize) / (1024 * 1024) 
		mbs = '[COLOR %s][COLOR %s]%.02f[/COLOR] MB of [COLOR %s]%.02f[/COLOR] MB[/COLOR]' % (COLOR2, COLOR1, currently_downloaded, COLOR1, total) 
		e = '[COLOR %s]Speed: [COLOR %s]%.02f [/COLOR]Kb/s ' % (COLOR2, COLOR1, kbps_speed)
		e += 'ETA: [COLOR '+COLOR1+']%02d:%02d[/COLOR][/COLOR]' % divmod(eta, 60)
		dp.update(percent, mbs, e)
		if dp.iscanceled(): 
			raise Exception("Canceled")
			dp.close()
	except Exception, e:
		wiz.log("ERROR Downloading: %s" % str(e))
		return str(e)
Exemple #18
0
def _pbhook(numblocks, blocksize, filesize, dp, start_time):
	try: 
		percent = min(numblocks * blocksize * 100 / filesize, 100) 
		currently_downloaded = float(numblocks) * blocksize / (1024 * 1024) 
		kbps_speed = numblocks * blocksize / (time.time() - start_time) 
		if kbps_speed > 0 and not percent == 100: 
			eta = (filesize - numblocks * blocksize) / kbps_speed 
		else: 
			eta = 0
		kbps_speed = kbps_speed / 1024 
		type_speed = 'KB'
		if kbps_speed >= 1024:
			kbps_speed = kbps_speed / 1024 
			type_speed = 'MB'
		total = float(filesize) / (1024 * 1024) 
		mbs = '[COLOR %s][B]Size:[/B] [COLOR %s]%.02f[/COLOR] MB of [COLOR %s]%.02f[/COLOR] MB[/COLOR]' % (COLOR2, COLOR1, currently_downloaded, COLOR1, total) 
		e   = '[COLOR %s][B]Speed:[/B] [COLOR %s]%.02f [/COLOR]%s/s ' % (COLOR2, COLOR1, kbps_speed, type_speed)
		e  += '[B]ETA:[/B] [COLOR '+COLOR1+']%02d:%02d[/COLOR][/COLOR]' % divmod(eta, 60)
		dp.update(percent, '', mbs, e)
	except Exception, e:
		wiz.log("ERROR Downloading: %s" % str(e), xbmc.LOGERROR)
		return str(e)
Exemple #19
0
def _pbhook(numblocks, blocksize, filesize, dp, start_time):
    try:
        percent = min(numblocks * blocksize * 100 / filesize, 100)
        currently_downloaded = float(numblocks) * blocksize / (1024 * 1024)
        kbps_speed = numblocks * blocksize / (time.time() - start_time)
        if kbps_speed > 0 and not percent == 100:
            eta = (filesize - numblocks * blocksize) / kbps_speed
        else:
            eta = 0
        kbps_speed = kbps_speed / 1024
        total = float(filesize) / (1024 * 1024)
        mbs = '[COLOR %s][COLOR %s]%.02f[/COLOR] MB of [COLOR %s]%.02f[/COLOR] MB[/COLOR]' % (
            COLOR2, COLOR1, currently_downloaded, COLOR1, total)
        e = '[COLOR %s]Speed: [COLOR %s]%.02f [/COLOR]Kb/s ' % (COLOR2, COLOR1,
                                                                kbps_speed)
        e += 'ETA: [COLOR ' + COLOR1 + ']%02d:%02d[/COLOR][/COLOR]' % divmod(
            eta, 60)
        dp.update(percent, mbs, e)
        if dp.iscanceled():
            raise Exception("Canceled")
            dp.close()
    except Exception, e:
        wiz.log("ERROR Downloading: %s" % str(e))
        return str(e)
Exemple #20
0
 elif file[0] == 'userdata' and file[1] == 'addon_data' and file[
         2] in excludes:
     skip = True
 elif file[-1] in LOGFILES:
     skip = True
 elif file[-1] in bad_files:
     skip = True
 elif file[-1].endswith('.csv'):
     skip = True
 elif not str(item.filename).find('plugin.program.super.favourites'
                                  ) == -1 and KEEPSUPER == 'true':
     skip = True
 elif not str(item.filename).find(ADDON_ID) == -1 and ignore == None:
     skip = True
 if skip == True:
     wiz.log("Skipping: %s" % item.filename, xbmc.LOGNOTICE)
 else:
     try:
         zin.extract(item, _out)
     except Exception, e:
         errormsg = "[COLOR %s]File:[/COLOR] [COLOR %s]%s[/COLOR]\n" % (
             COLOR2, COLOR1, file[-1])
         errormsg += "[COLOR %s]Folder:[/COLOR] [COLOR %s]%s[/COLOR]\n" % (
             COLOR2, COLOR1, (item.filename).replace(file[-1], ''))
         errormsg += "[COLOR %s]Error:[/COLOR] [COLOR %s]%s[/COLOR]\n\n" % (
             COLOR2, COLOR1, str(e).replace('\\\\', '\\').replace(
                 "'%s'" % item.filename, ''))
         errors += 1
         error += errormsg
         wiz.log('Error Extracting: %s(%s)' % (item.filename, str(e)),
                 xbmc.LOGERROR)
def apkScraper(name=""):
    if name == 'kodi':
        kodiurl1 = 'http://mirrors.kodi.tv/releases/android/arm/'
        kodiurl2 = 'http://mirrors.kodi.tv/releases/android/arm/old/'
        url1 = wiz.openURL(kodiurl1).replace('\n',
                                             '').replace('\r',
                                                         '').replace('\t', '')
        url2 = wiz.openURL(kodiurl2).replace('\n',
                                             '').replace('\r',
                                                         '').replace('\t', '')
        x = 0
        match1 = re.compile(
            '<tr><td><a href="(.+?)">(.+?)</a></td><td>(.+?)</td><td>(.+?)</td></tr>'
        ).findall(url1)
        match2 = re.compile(
            '<tr><td><a href="(.+?)">(.+?)</a></td><td>(.+?)</td><td>(.+?)</td></tr>'
        ).findall(url2)

        addFile("Official Kodi Apk\'s", themeit=THEME1)
        rc = False
        for url, name, size, date in match1:
            if url in ['../', 'old/']: continue
            if not url.endswith('.apk'): continue
            if not url.find('_') == -1 and rc == True: continue
            try:
                tempname = name.split('-')
                if not url.find('_') == -1:
                    rc = True
                    name2, v2 = tempname[2].split('_')
                else:
                    name2 = tempname[2]
                    v2 = ''
                title = "[COLOR %s]%s v%s%s %s[/COLOR] [COLOR %s]%s[/COLOR] [COLOR %s]%s[/COLOR]" % (
                    COLOR1, tempname[0].title(), tempname[1], v2.upper(),
                    name2, COLOR2, size.replace(' ', ''), COLOR1, date)
                download = urljoin(kodiurl1, url)
                addFile(
                    title, 'apkinstall', "%s v%s%s %s" %
                    (tempname[0].title(), tempname[1], v2.upper(), name2),
                    download)
                x += 1
            except:
                wiz.log("Error on: %s" % name)

        for url, name, size, date in match2:
            if url in ['../', 'old/']: continue
            if not url.endswith('.apk'): continue
            if not url.find('_') == -1: continue
            try:
                tempname = name.split('-')
                title = "[COLOR %s]%s v%s %s[/COLOR] [COLOR %s]%s[/COLOR] [COLOR %s]%s[/COLOR]" % (
                    COLOR1, tempname[0].title(), tempname[1], tempname[2],
                    COLOR2, size.replace(' ', ''), COLOR1, date)
                download = urljoin(kodiurl2, url)
                addFile(
                    title, 'apkinstall', "%s v%s %s" %
                    (tempname[0].title(), tempname[1], tempname[2]), download)
                x += 1
            except:
                wiz.log("Error on: %s" % name)
        if x == 0: addFile("Error Kodi Scraper Is Currently Down.")
    elif name == 'spmc':
        spmcurl1 = 'https://github.com/koying/SPMC/releases'
        url1 = wiz.openURL(spmcurl1).replace('\n',
                                             '').replace('\r',
                                                         '').replace('\t', '')
        x = 0
        match1 = re.compile(
            '<div.+?lass="release-body.+?div class="release-header".+?a href=.+?>(.+?)</a>.+?ul class="release-downloads">(.+?)</ul>.+?/div>'
        ).findall(url1)

        addFile("Official SPMC Apk\'s", themeit=THEME1)

        for name, urls in match1:
            tempurl = ''
            match2 = re.compile(
                '<li>.+?<a href="(.+?)" rel="nofollow">.+?<small class="text-gray float-right">(.+?)</small>.+?strong>(.+?)</strong>.+?</a>.+?</li>'
            ).findall(urls)
            for apkurl, apksize, apkname in match2:
                if apkname.find('armeabi') == -1: continue
                if apkname.find('launcher') > -1: continue
                tempurl = urljoin('https://github.com', apkurl)
                break
            if tempurl == '': continue
            try:
                name = "SPMC %s" % name
                title = "[COLOR %s]%s[/COLOR] [COLOR %s]%s[/COLOR]" % (
                    COLOR1, name, COLOR2, apksize.replace(' ', ''))
                download = tempurl
                addFile(title, 'apkinstall', name, download)
                x += 1
            except Exception, e:
                wiz.log("Error on: %s / %s" % (name, str(e)))
        if x == 0: addFile("Error SPMC Scraper Is Currently Down.")
Exemple #22
0
        excludes.append(fold)
        if fold.startswith('pvr'):
            wiz.setS('pvrclient', id)

    nFiles = float(len(zin.namelist()))
    zipsize = wiz.convertSize(sum([item.file_size for item in zin.infolist()]))

    zipit = str(_in).replace('\\', '/').split('/')
    title = title if not title == None else zipit[-1].replace('.zip', '')

    for item in zin.infolist():
        try:
            str(item.filename).encode('ascii')
        except UnicodeDecodeError:
            wiz.log(
                "[ASCII Check] Illegal character found in file: {0}".format(
                    item.filename))
            continue
        except UnicodeEncodeError:
            wiz.log(
                "[ASCII Check] Illegal character found in file: {0}".format(
                    item.filename))
            continue
        count += 1
        prog = int(count / nFiles * 100)
        size += item.file_size
        file = str(item.filename).split('/')
        skip = False
        line1 = '%s [COLOR %s][B][Errors:%s][/B][/COLOR]' % (title, COLOR2,
                                                             errors)
        line2 = '[COLOR %s][B]File:[/B][/COLOR] [COLOR %s]%s/%s[/COLOR] ' % (
		line1  = '%s [COLOR %s][B][Erros:%s][/B][/COLOR]' % (title, COLOR2, errors)
		line2  = '[COLOR %s][B]Arquivo:[/B][/COLOR] [COLOR %s]%s/%s[/COLOR] ' % (COLOR2, COLOR1, count, int(nFiles))
		line2 += '[COLOR %s][B]Tamanho:[/B][/COLOR] [COLOR %s]%s/%s[/COLOR]' % (COLOR2, COLOR1, wiz.convertSize(size), zipsize)
		line3  = '[COLOR %s]%s[/COLOR]' % (COLOR1, item.filename)
		if item.filename == 'userdata/sources.xml' and KEEPSOURCES == 'true': skip = True
		elif item.filename == 'userdata/favourites.xml' and KEEPFAVS == 'true': skip = True
		elif item.filename == 'userdata/profiles.xml' and KEEPPROFILES == 'true': skip = True
		elif item.filename == 'userdata/advancedsettings.xml' and KEEPADVANCED == 'true': skip = True
		elif file[0] == 'addons' and file[1] in excludes: skip = True
		elif file[0] == 'userdata' and file[1] == 'addon_data' and file[2] in excludes: skip = True
		elif file[-1] in LOGFILES: skip = True
		elif file[-1] in bad_files: skip = True
		elif file[-1].endswith('.csv'): skip = True
		elif not str(item.filename).find('plugin.program.super.favourites') == -1 and KEEPSUPER == 'true': skip = True
		elif not str(item.filename).find(ADDON_ID) == -1 and ignore == None: skip = True
		if skip == True: wiz.log("Skipping: %s" % item.filename, xbmc.LOGNOTICE)
		else:
			try:
				zin.extract(item, _out)
			except Exception, e:
				errormsg  = "[COLOR %s]Tamanho:[/COLOR] [COLOR %s]%s[/COLOR]\n" % (COLOR2, COLOR1, file[-1])
				errormsg += "[COLOR %s]Pasta:[/COLOR] [COLOR %s]%s[/COLOR]\n" % (COLOR2, COLOR1, (item.filename).replace(file[-1],''))
				errormsg += "[COLOR %s]Erro:[/COLOR] [COLOR %s]%s[/COLOR]\n\n" % (COLOR2, COLOR1, str(e).replace('\\\\','\\').replace("'%s'" % item.filename, ''))
				errors += 1; error += errormsg
				wiz.log('Erros de extração: %s(%s)' % (item.filename, str(e)), xbmc.LOGERROR)
				pass
		dp.update(prog, line1, line2, line3)
		if dp.iscanceled(): break
	if dp.iscanceled(): 
		dp.close()
		wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, ADDONTITLE), "[COLOR %s]Extração cancelado[/COLOR]" % COLOR2)
Exemple #24
0
		line1  = '%s [COLOR %s][B][Errores:%s][/B][/COLOR]' % (title, COLOR2, errors)
		line2  = '[COLOR %s][B]Archivo:[/B][/COLOR] [COLOR %s]%s/%s[/COLOR] ' % (COLOR2, COLOR1, count, int(nFiles))
		line2 += '[COLOR %s][B]Tamano:[/B][/COLOR] [COLOR %s]%s/%s[/COLOR]' % (COLOR2, COLOR1, wiz.convertSize(size), zipsize)
		line3  = '[COLOR %s]%s[/COLOR]' % (COLOR1, item.filename)
		if item.filename == 'userdata/sources.xml' and KEEPSOURCES == 'true': skip = True
		elif item.filename == 'userdata/favourites.xml' and KEEPFAVS == 'true': skip = True
		elif item.filename == 'userdata/profiles.xml' and KEEPPROFILES == 'true': skip = True
		elif item.filename == 'userdata/advancedsettings.xml' and KEEPADVANCED == 'true': skip = True
		elif file[0] == 'addons' and file[1] in excludes: skip = True
		elif file[0] == 'userdata' and file[1] == 'addon_data' and file[2] in excludes: skip = True
		elif file[-1] in LOGFILES: skip = True
		elif file[-1] in bad_files: skip = True
		elif file[-1].endswith('.csv'): skip = True
		elif not str(item.filename).find('plugin.program.super.favourites') == -1 and KEEPSUPER == 'true': skip = True
		elif not str(item.filename).find(ADDON_ID) == -1 and ignore == None: skip = True
		if skip == True: wiz.log("Saltando: %s" % item.filename, xbmc.LOGNOTICE)
		else:
			try:
				zin.extract(item, _out)
			except Exception, e:
				errormsg  = "[COLOR %s]Archivo:[/COLOR] [COLOR %s]%s[/COLOR]\n" % (COLOR2, COLOR1, file[-1])
				errormsg += "[COLOR %s]Carpeta:[/COLOR] [COLOR %s]%s[/COLOR]\n" % (COLOR2, COLOR1, (item.filename).replace(file[-1],''))
				errormsg += "[COLOR %s]Error:[/COLOR] [COLOR %s]%s[/COLOR]\n\n" % (COLOR2, COLOR1, str(e).replace('\\\\','\\').replace("'%s'" % item.filename, ''))
				errors += 1; error += errormsg
				wiz.log('Error Extracting: %s(%s)' % (item.filename, str(e)), xbmc.LOGERROR)
				pass
		dp.update(prog, line1, line2, line3)
		if dp.iscanceled(): break
	if dp.iscanceled(): 
		dp.close()
		wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, ADDONTITLE), "[COLOR %s]Extraccion cancelada![/COLOR]" % COLOR2)
Exemple #25
0
 elif file[0] == 'userdata' and file[1] == 'addon_data' and file[
         2] in excludes:
     skip = True
 elif file[-1] in LOGFILES:
     skip = True
 elif file[-1] in bad_files:
     skip = True
 elif file[-1].endswith('.csv'):
     skip = True
 elif not str(item.filename).find('plugin.program.super.favourites'
                                  ) == -1 and KEEPSUPER == 'true':
     skip = True
 elif not str(item.filename).find(ADDON_ID) == -1 and ignore == None:
     skip = True
 if skip == True:
     wiz.log("Skipping: %s" % item.filename, xbmc.LOGNOTICE)
 else:
     try:
         zin.extract(item, _out)
     except Exception, e:
         errormsg = "[COLOR %s]Dosya:[/COLOR] [COLOR %s]%s[/COLOR]\n" % (
             COLOR2, COLOR1, file[-1])
         errormsg += "[COLOR %s]Klasor:[/COLOR] [COLOR %s]%s[/COLOR]\n" % (
             COLOR2, COLOR1, (item.filename).replace(file[-1], ''))
         errormsg += "[COLOR %s]Hata:[/COLOR] [COLOR %s]%s[/COLOR]\n\n" % (
             COLOR2, COLOR1, str(e).replace('\\\\', '\\').replace(
                 "'%s'" % item.filename, ''))
         errors += 1
         error += errormsg
         wiz.log('Ayiklama Hatasi: %s(%s)' % (item.filename, str(e)),
                 xbmc.LOGERROR)
Exemple #26
0
 elif file[0] == 'userdata' and file[1] == 'addon_data' and file[
         2] in excludes:
     skip = True
 elif file[-1] in LOGFILES:
     skip = True
 elif file[-1] in bad_files:
     skip = True
 elif file[-1].endswith('.csv'):
     skip = True
 elif not str(item.filename).find('plugin.program.super.favourites'
                                  ) == -1 and KEEPSUPER == 'true':
     skip = True
 elif not str(item.filename).find(ADDON_ID) == -1 and ignore == None:
     skip = True
 if skip == True:
     wiz.log("Skipping: %s" % item.filename, xbmc.LOGNOTICE)
 else:
     try:
         zin.extract(item, _out)
     except Exception, e:
         errormsg = "[COLOR %s]File:[/COLOR] [COLOR %s]%s[/COLOR]\n" % (
             COLOR2, COLOR1, file[-1])
         errormsg += "[COLOR %s]Folder:[/COLOR] [COLOR %s]%s[/COLOR]\n" % (
             COLOR2, COLOR1, (item.filename).replace(file[-1], ''))
         errormsg += "[COLOR %s]Error:[/COLOR] [COLOR %s]%s[/COLOR]\n\n" % (
             COLOR2, COLOR1, str(e).replace('\\\\', '\\').replace(
                 "'%s'" % item.filename, ''))
         errors += 1
         error += errormsg
         wiz.log('Erro de Instacao: %s(%s)' % (item.filename, str(e)),
                 xbmc.LOGERROR)
Exemple #27
0
		except: pass
		excludes.append(fold)
		if fold.startswith('pvr'):
			wiz.setS('pvrclient', id)

	nFiles = float(len(zin.namelist()))
	zipsize = wiz.convertSize(sum([item.file_size for item in zin.infolist()]))

	zipit = str(_in).replace('\\', '/').split('/')
	title = title if not title == None else zipit[-1].replace('.zip', '')

	for item in zin.infolist():
		try:
			str(item.filename).encode('ascii')
		except UnicodeDecodeError:
			wiz.log("[ASCII Check] Illegal character found in file: {0}".format(item.filename))
			continue
		except UnicodeEncodeError:
			wiz.log("[ASCII Check] Illegal character found in file: {0}".format(item.filename))
			continue
		count += 1; prog = int(count / nFiles * 100); size += item.file_size
		file = str(item.filename).split('/')
		skip = False
		line1  = '%s [COLOR %s][B][Errors:%s][/B][/COLOR]' % (title, COLOR2, errors)
		line2  = '[COLOR %s][B]File:[/B][/COLOR] [COLOR %s]%s/%s[/COLOR] ' % (COLOR2, COLOR1, count, int(nFiles))
		line2 += '[COLOR %s][B]Size:[/B][/COLOR] [COLOR %s]%s/%s[/COLOR]' % (COLOR2, COLOR1, wiz.convertSize(size), zipsize)
		line3  = '[COLOR %s]%s[/COLOR]' % (COLOR1, item.filename)
		if item.filename == 'userdata/sources.xml' and KEEPSOURCES == 'true': skip = True
		elif item.filename == 'userdata/favourites.xml' and KEEPFAVS == 'true': skip = True
		elif item.filename == 'userdata/profiles.xml' and KEEPPROFILES == 'true': skip = True
		elif item.filename == 'userdata/advancedsettings.xml' and KEEPADVANCED == 'true': skip = True