mrrfv / open-android-backup

Back up your device without vendor lock-ins, using insecure software or root. Supports encryption and compression out of the box. Works cross-platform.
http://openandroidbackup.me/
GNU General Public License v3.0
674 stars 37 forks source link

make compression level adjustable #105

Closed 3eggert closed 4 months ago

3eggert commented 4 months ago

I added a simple method to use different compression levels. I used level 0 (no compression) and it made only little difference in file size:

-rw-rw-r-- 1 eggert eggert 51G Feb 23 14:01 open-android-backup-02-23-2024-11-52-03.7z # default -rw-rw-r-- 1 eggert eggert 53G Feb 23 19:00 open-android-backup-02-23-2024-18-23-18.7z # level 0

but it is significantly faster. 7z is always used as before, it just uses the compression level.

mrrfv commented 4 months ago

Looks good, but there some things that need to be done before this can be merged:

  1. The user should be presented with the choices [0 | 1 | 3 | 5 | 7 | 9 ] instead of 0-9 according to the 7-Zip documentation.
  2. You should also update the "Automation/Unattended Backups" section of the README so it includes information about the compression_level environment variable.
  3. The choice between compression levels currently doesn't sound very clear for people who never touched the 7-Zip CLI, I suggest that it's written similarly to below instead:
  cecho "Choose the compression level."
  cecho "- 0 is no compression, and is the fastest."
  cecho "- 3 is fast compression."
  cecho "- 5 is normal compression, which is a balance between speed and file size."
  cecho "- 7 is maximum compression, it was the previous default."
  cecho "- 9 is the slowest, but provides the best compression."
  cecho "A larger number means better compression at the expense of RAM usage and backup speed."
  cecho "Press Enter to pick your preferred compression level."
3eggert commented 4 months ago

I added the purposed changes.

mrrfv commented 4 months ago

Sweet, thanks!