service.libreelec.settings icon indicating copy to clipboard operation
service.libreelec.settings copied to clipboard

Replace filter used in backup selection and add hostname to default backup file name

Open antonlacon opened this issue 4 months ago • 0 comments

xbmcgui.dialog.browse (https://alwinesch.github.io/group__python___dialog.html#ga2ece1ca620087a97233713710eac1b83) is used to select the backup file to be restored. '??????????????.tar' serves as the "mask" to filter the selected file to an acceptable format. In short, if a user selects a file that isn't 14 characters followed by .tar, it gets rejected and silently replaced with the default value of the backup directory, which the addon then rejects and does nothing.

This removes the "mask" altogether, and instead does a post-selection check to see if the chosen file ends in one of: .tar, .tar.gz, .tar.bz2, or .tar.xz. This matches the busybox restore script (https://github.com/LibreELEC/LibreELEC.tv/blob/9ea3926457cf8b162b2e7f16faf7a8928270929b/packages/mediacenter/LibreELEC-settings/scripts/backup-restore#L11-L15). If the file doesn't match, it tells the user they made an invalid choice.

No image-side changes are needed for the above; the busybox script was changed pre-LE10 to accommodate #162

With relaxed backup file selection, change the default backup naming from $DATESTAMP.tar to $HOSTNAME-$DATESTAMP.tar. My hope is that this will be clearer when looking at these files later, even if leaving at the default hostname. Additionally, if a user has multiple LE boxes, hopefully they have unique hostnames (ex: LE-LivingRoom or LE-RPi5).

~~TODO localization~~

antonlacon avatar Mar 08 '24 05:03 antonlacon