backuprestore.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:script.skin.helper.skinbackup 作者: marcelveldt 项目源码 文件源码
def backup(self, filters=None, backup_file="", silent=False):
        '''create skin backup'''
        if not filters:
            filters = []

        if not backup_file:
            return

        # create temp path
        temp_path = self.create_temp()
        zip_temp = u'%s/skinbackup-%s.zip' % (temp_path, datetime.now().strftime('%Y-%m-%d %H.%M'))
        temp_path = temp_path + "skinbackup/"

        # backup skinshortcuts preferences
        if not filters or (filters and "skinshortcuts" in filters):
            self.backup_skinshortcuts(temp_path + "skinshortcuts/")

        # backup skin settings
        if "skinshortcutsonly" not in filters:
            skinsettings_path = os.path.join(temp_path, u"guisettings.txt")
            self.backup_skinsettings(skinsettings_path, filters, temp_path)

        # zip the backup
        zip_temp = xbmc.translatePath(zip_temp).decode("utf-8")
        zip_tofile(temp_path, zip_temp)

        # copy file to destination - wait untill it's really copied
        copy_file(zip_temp, backup_file, True)

        # cleanup temp
        recursive_delete_dir(temp_path)
        xbmcvfs.delete(zip_temp)

        # show success message
        if not silent:
            xbmcgui.Dialog().ok(self.addon.getLocalizedString(32004), self.addon.getLocalizedString(32005))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号