def restore_colortheme(self):
'''restore zipbackup of colortheme to colorthemes folder'''
zip_path = xbmcgui.Dialog().browse(1, self.addon.getLocalizedString(32030), "files", ".zip")
if zip_path and zip_path.endswith(".zip"):
# create temp path
temp_path = u'special://temp/skinbackup/'
temp_zip = u"special://temp/colortheme.zip"
if xbmcvfs.exists(temp_path):
recursive_delete_dir(temp_path)
xbmcvfs.mkdir(temp_path)
# unzip to temp
xbmcvfs.copy(zip_path, temp_zip)
unzip_fromfile(temp_zip, temp_path)
for filename in xbmcvfs.listdir(temp_path)[1]:
filename = filename.decode("utf-8")
sourcefile = os.path.join(temp_path, filename)
destfile = os.path.join(self.userthemes_path, filename)
xbmcvfs.copy(sourcefile, destfile)
# cleanup temp
xbmcvfs.delete(temp_zip)
recursive_delete_dir(temp_path)
xbmcgui.Dialog().ok(self.addon.getLocalizedString(32026), self.addon.getLocalizedString(32027))
colorthemes.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录