robweber / xbmcbackup

Backup Addon for Kodi
MIT License
107 stars 48 forks source link

System Settings Updates - Matrix #170

Closed robweber closed 3 years ago

robweber commented 3 years ago

This both fixes #169 and enhances the overall system settings backup and restore process.

Old Process

The old restore process read in the guisettings.xml file (hopefully already restored as part of restoral operation). It then pulled the currently running system settings via a System.GetSettings JSON call and compared them. Where different it would then update the settings.

Issues

There are two main issues with this process. The first is that it assumed all read in values where either strings or integers. The xml structure didn't give a type so this was inferred. The actual definitions of these settings included more types than this, including boolean and list values. As a result these were not set correctly. The second issue is that this system relied on the end-user to have made sure to back up the guisettings.xml file and include it as part of their restore. This wasn't very well documented for the end user and may have resulted in these settings just not being available. Many users assume database backups are sufficient to capture UI settings.

New Method

The new method tries to fix these issues. As part of every backup the contents of the System.GetSettings call exported as part of the validation file. This captures the UI settings on every backup run, regardless of if they will be restored. It also captures the definitions of the settings and types of each - which are useful for the restore operation. As part of the restores these settings are updated in Kodi, again where different than current, but only if one of two conditions is true. The first is if the new "always prompt restore" option is unchecked (default). This assumes the user will want UI settings restored, when found, by default. If checked the user will be prompted at the time of the restore and can accept or decline that the settings be updated.