def allNoProgress(_in, _out, ignore): try: zin = zipfile.ZipFile(_in, 'r') zin.extractall(_out) except Exception, e: print str(e) return False
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): zin = zipfile.ZipFile(_in, 'r') nFiles = float(len(zin.infolist())) count = 0 try: for item in zin.infolist(): count += 1 update = count / nFiles * 100 dp.update(int(update)) zin.extract(item, _out) except Exception, e: print str(e) return False
name = name.replace('\\', '').replace('/', '').replace( ':', '').replace('*', '').replace('?', '').replace('"', '').replace( '<', '').replace('>', '').replace('|', '') name = urllib.quote_plus(name) tempzipname = '' zipname = os.path.join(mybuilds, '%s.zip' % name) for_progress = 0 ITEM = [] #if not DIALOG.yesno(ADDONTITLE, "[COLOR %s]Do you want to include your addon_data folder?" % COLOR2, 'This contains [COLOR %s]ALL[/COLOR] addon settings including passwords but may also contain important information such as skin shortcuts. We recommend [COLOR %s]MANUALLY[/COLOR] removing the addon_data folders that aren\'t required.' % (COLOR1, COLOR1), '[COLOR %s]%s[/COLOR] addon_data is ignored[/COLOR]' % (COLOR1, ADDON_ID), yeslabel='[B][COLOR green]Include data[/COLOR][/B]',nolabel='[B][COLOR red]Don\'t Include[/COLOR][/B]'): #exclude_dirs.append('addon_data') #convertSpecial(HOME, True) asciiCheck(HOME, True) #clearS('zip') try: zipf = zipfile.ZipFile(xbmc.translatePath(zipname), mode='w') except: try: tempzipname = os.path.join(PACKAGES, '%s.zip' % name) zipf = zipfile.ZipFile(tempzipname, mode='w') except: log("Không thể tạo được file %s.zip" % name, xbmc.LOGERROR) if DIALOG.yesno( ADDONTITLE, "[COLOR %s]Không thể lưu file backup vào thư mục hiện tại, bạn có muốn đổi đường dẫn khác không?[/COLOR]" % COLOR2, yeslabel="[B][COLOR green]Đổi thư mục[/COLOR][/B]", nolabel="[B][COLOR red]Hủy[/COLOR][/B]"): openS() return else: