Exemple #1
0
        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

    whitelist = wiz.whiteList('read')
    for item in whitelist:
        try:
            name, id, fold = item
        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:
            continue
        count += 1
        prog = int(count / nFiles * 100)
        size += item.file_size
Exemple #2
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
	
	whitelist = wiz.whiteList('read')
	for item in whitelist:
		try: name, id, fold = item
		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():
		count += 1; prog = int(count / nFiles * 100); size += item.file_size
		file = str(item.filename).split('/')
		skip = False
		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)