Autosave & Autobackup (foo_jesus)
2009-01-08 21:51:40
This component allows periodic automatic saving of configuration and other data in foobar2000 and keeping backup copies of the profile folder. The save operation itself does the same as (hidden) command "File > Save Configuration", that means it saves configuration (the whole configuration subfolder), Media library database (database.*), playlists and any additional data managed by other components (for example current theme or playback statistics). Backup process stores configurable list of files and directories into a ZIP archive with file name like "autobackup.20091005-121722.zip" in user-specified folder. A ZIP archive is used to have everything in one file, as well as compress the (often large) database files a bit, using the fastest, but still significant and useful compression method. Very small files, as well as not much compressible files like archives and compressed images are not (re)compressed. Configuration is possible through the following settings, available in "Autosave & Autobackup" branch in Advanced preferences:Autosave while playing, every X minutes (0 = off) Time is counted when playback is active (i.e. not stopped nor paused) and when it exceeds this value, configuration is saved. Default value: 1 hourAutosave when playback stops, after X minutes (0 = off) When playback was active, then stopped or paused for this amount of time, configuration is saved. Default value: 5 minutesAlways, no more than X minutes since last autosave (0 = off) Regardless of activity, when the last time autosave was run is more than so many minutes ago, configuration is saved. Default value: 1 dayOn startup, after X minutes (backup only, 0 = off) After specified number of minutes after startup, a new backup archive with the current configuration is created. Note this trigger does not execute (the more intrusive) save configuration command, assuming nothing has changed since startup yet and because its point is to store the base configuration the application has been started with. Default value: 1 minuteEvery X tracks (0 = off) Each time a track ends (it has played all the way through or another has been started manually, except when shutting down), a counter is incremented. When it exceeds this value, configuration is saved. Note that saving this way more often than 30 seconds since last autosave is blocked to avoid lock up or crash problems when going through a playlist too fast (e.g. on very short files or invalid entries). Default value: 0Files and directories to back up (sep. by ;, relative to profile folder, wildcards supported) Items to store to the backup archive. Those which are not found are silently ignored. If an item is found out to be a directory, all files in it are added recursively. Default value: configuration;playlists;index-data;theme.fth;PlaybackStatistics.datDirectory where to store the backup .zip files Specifies directory for the automatically created backups of the files and folders set above. If it doesn't exists, the component will attempt to create it. Can be either a relative path (in the fb2k's profile directory) or absolute, e.g. for storing the backups on external/remote disk. Default value: autobackupNumber of backup copies to keep Each time a new backup archive is created, older files matching "autobackup.*.zip" in the profile directory are deleted, to leave just last this number of them. Default: 2 All counters are reset whenever autosave is activated due to any of the criteria. For example, when using both "while playing (minutes)" and "after X tracks", whichever applies first will trigger the save. A message like "Autosaving... (A)" is logged to console each time, among others to avoid "bug reports" regarding random lags. One of the letters PITA at the end reveals the reason – while Playing, when Idle, after Track or Always. Note that configuration saving can be a resource intensive operation, particularly with larger libraries or playlists. It should not disturb playback, however user interface lag might occur. The subsequent backup operation is run in a detached thread with lowered priority. I've made the default settings rather conservative and according to my typical usage – each hour when foobar2000 is happily playing minimized, five minutes after everything has stopped and I'm going to do something else, then at least once a day just as a safety measure (if I haven't actually played anything and only experimented with some configuration changes, for example). Your comments and suggestions are welcome. Latest version: Autosave & Autobackup v10 [2010/09/23]Dowload links: foo_jesus-v10.zip (43 KB) foo_jesus.dll (89 KB) mirror Changelog: v10 [2010/09/23] - New: Use zlib1.dll bundled with core - the component needs foobar2000 v1.1 or newer now. - New: Don't compress .rar and .7z files (added to existing .zip, .jpg, .jpeg and .png). - New: Updated default backup item list: removed "foobar2000.cfg", added "index-data" (used e.g. by Playback Statistics v3.0+). Note: If you are upgrading from a previous version and changed the default pattern, you ought to do this manually. - Fixed: Filter . and .. pseudo-directories when backing up the whole profile folder (using * as the mask). v9 [2010/04/20] - New: Option for setting delay of the first backup after startup. - Fixed: Even lower priority for the backup thread. v8 [2010/01/03] - Fixed: Relative paths to destination directory. v7 [2010/01/02] - New: Backup ZIP files use compression. - New: Configurable backup destination directory. - Fixed: Added 30 second limit for per-track autosave to avoid main thread overload. v6 [2009/11/20] - Added a few things to ease debugging of obscure problems in other components. v5 [2009/10/05] - Fixed: Crash with empty backup filename pattern list. v4 [2009/10/04] - New: Added backup features. v0.0.3 [2009/03/21] - Fixed: Crash when autosaving after number of tracks with Preferences dialog open. v0.0.2 [2009/01/09] – New: Ability to save each time a configured number of tracks has been played. v0.0.1 [2009/01/08] – Initial release.