Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Autosave & Autobackup (foo_jesus) (Read 169508 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Autosave & Autobackup (foo_jesus)

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 hour
  • Autosave 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 minutes
  • Always, 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 day
  • On 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 minute
  • Every 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: 0
  • Files 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.dat
  • Directory 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: autobackup
  • Number 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.
Full-quoting makes you scroll past the same junk over and over.

Autosave & Autobackup (foo_jesus)

Reply #1
Wow, I've been waiting for ages for such component. Could be very useful for people who like playing with ColumnsUI or PanelsUI. Thanks

Autosave & Autobackup (foo_jesus)

Reply #2
Thanks Yirkha for this useful component (foo_jesus...  ). This could even have been a part of foobar2000 !

Now for the "just a little improvement" thing  : saving your config, playlists & co. is nice, but it has happened to me more than once in the past to end up with a corrupt foobar2000.cfg file (because of other software running and making fb2k crash, not enough free memory which would mess up with foobar quitting, whatever). In that case, you'd better have a recent backup of that precious cfg file if you don't want to start all over again. So, would it be a good idea to automatically backup the foobar2000.cfg in the same folder ? (maybe some foobar2000.cfg.bak, I don't know, you get the point).

Thanks again.

Autosave & Autobackup (foo_jesus)

Reply #3
Thanks for the great component. I am just wondering if you can add a menu item or I can create a command button to save all configurations on demand. Sometimes I know that I have made a few changes to configurations and playlists, if I don't save them I might lose them all should there be a crash.

ftc

Autosave & Autobackup (foo_jesus)

Reply #4
Great improvement to foobar2000.
Really thanks for this component!

BTW, there is a better name for it?

Edit: typo.

Autosave & Autobackup (foo_jesus)

Reply #5
Who else saves better than Jesus?

Autosave & Autobackup (foo_jesus)

Reply #6
first save yourself (File > Save Configuration), then ask Jesus


Autosave & Autobackup (foo_jesus)

Reply #8
I am just wondering if you can add a menu item or I can create a command button to save all configurations on demand.


This ability actually exists already. It's not visible on the menu, but you can bind File->Save Configuration to a keyboard shortcut or to a button (the latter I've only tested in Columns UI because I am deeply lazy, but there's no reason it shouldn't work in Default as well).

Anyhow, thanks for the component, Yirkha!

Autosave & Autobackup (foo_jesus)

Reply #9

I am just wondering if you can add a menu item or I can create a command button to save all configurations on demand.


This ability actually exists already. It's not visible on the menu, but you can bind File->Save Configuration to a keyboard shortcut or to a button (the latter I've only tested in Columns UI because I am deeply lazy, but there's no reason it shouldn't work in Default as well).

Anyhow, thanks for the component, Yirkha!


Thanks, DocBeard. It was not obvious to me before, now I know.

Autosave & Autobackup (foo_jesus)

Reply #10
Saving your config, playlists & co. is nice, but it has happened to me more than once in the past to end up with a corrupt foobar2000.cfg file (because of other software running and making fb2k crash, not enough free memory which would mess up with foobar quitting, whatever). In that case, you'd better have a recent backup of that precious cfg file if you don't want to start all over again. So, would it be a good idea to automatically backup the foobar2000.cfg in the same folder ?
It's the core what does the saving, this component only launches the menu command to do it, so there is no reliable control over that part.

Maybe start using Windows Vista…

ETA: mikusr reminded me that "Previous versions" is available only in Business, Enterprise and Ultimate SKU's.
Full-quoting makes you scroll past the same junk over and over.

Autosave & Autobackup (foo_jesus)

Reply #11
Would it be possible to add an option to save every time playback of a new track starts?

Autosave & Autobackup (foo_jesus)

Reply #12
I thought about that initially, then everything became time-based, so I abandoned it. I also don't like constant updates, because when something bad happens while saving, it creates much bigger problems. I guess I made it usable with rather long intervals also because I don't care about recent activity much. I was only surprised sometimes when my changes from last month were gone or so.

But oh well, you are second to ask for this, I will give it another thought.
Full-quoting makes you scroll past the same junk over and over.

Autosave & Autobackup (foo_jesus)

Reply #13
praise the lord!

Thanks for a plugin that is useful. I can't tell you how many times I've had to redo things to my theme/layout, remake playlists, etc because  they went into oblivion. This plugin is probably essential enough to most users that it should be a built-in feaure of foobar2000.

Autosave & Autobackup (foo_jesus)

Reply #14
v0.0.2 released, first post in this topic updated.
Full-quoting makes you scroll past the same junk over and over.

Autosave & Autobackup (foo_jesus)

Reply #15
Thank you Yirkha, this component kind of made my day.

Autosave & Autobackup (foo_jesus)

Reply #16
What a cool name for a plugin. WWJD?

Its a great plugin, saves me the hassle of redoing all those keyboard configs.  Thanks Yirkha

Autosave & Autobackup (foo_jesus)

Reply #17
Cool component, this should save me some work after my neighborhood's frequent pawer outages lol
we was young an' full of beans

Autosave & Autobackup (foo_jesus)

Reply #18
Thanks Yirkha for this useful component (foo_jesus...  ). This could even have been a part of foobar2000 !

Now for the "just a little improvement" thing  : saving your config, playlists & co. is nice, but it has happened to me more than once in the past to end up with a corrupt foobar2000.cfg file (because of other software running and making fb2k crash, not enough free memory which would mess up with foobar quitting, whatever). In that case, you'd better have a recent backup of that precious cfg file if you don't want to start all over again. So, would it be a good idea to automatically backup the foobar2000.cfg in the same folder ? (maybe some foobar2000.cfg.bak, I don't know, you get the point).

Thanks again.

Going further, it would be useful if the plugin could make whole config backups at set intervals, timestamped into an alternate directory (like backup\20081119\). The shadow copy functionality in Vista is very useful but not available for all.

Also, best plugin description ever.

Autosave & Autobackup (foo_jesus)

Reply #19
Yes, some of us don't want to use Vista because XP is lighter and better for a HTPC.
Moderation: This point has been disputed, see the split topic [a href='index.php?showtopic=68732']here[/a].[/size]

Any backup software could automatically make those foobar.cfg backups, but it would be even better if a foobar component (or foobar itstelf... hint, hint  ) could do it.

Autosave & Autobackup (foo_jesus)

Reply #20
It's the core what does the saving, this component only launches the menu command to do it, so there is no reliable control over that part.

Ummm... unless there's no way to know where the config file itself resides couldn't the component just do a regular ol' file copy to a (configurable) backup directory *before* making Foobar2000 save it's configuration? That should pretty much have the desired effect...
np: 4'33"

Autosave & Autobackup (foo_jesus)

Reply #21
Thank you, such ideas are welcome.

It is possible to retrieve the path of profile directory.

Now what files should be copied? You can't know if some component writes extra configuration files (e.g. PlaybackStatistics.dat).

Copying everything is not a good solution - for example, portable installations use the installation directory as profile directory, so all components and any other random junk someone stores there would be copied as well each time.

Configurable list of files to back up? No thanks.
Full-quoting makes you scroll past the same junk over and over.

Autosave & Autobackup (foo_jesus)

Reply #22
thanks for the work on the plug-in, trying it out today.  it's pretty much exactly what i've been hoping for and i'm glad i just happened to stumble on it today.

I agree, there is no need to automatically copy the files from the %appdata%\foobar2000 and %programfiles%\foobar2000 folders, you can easily do that already do that using backup scripts (robocopy or winrar, etc).  besides it doesn't really need to be done that often.

the most useful thing for me is the autosaving of playlists and playback stats database.

will be very useful on my work laptop, where I have to test software and occasionally BSOD after hours of having foobar open playing tracks.  I use foo_removeplayed, so this will awesome as i won't have to manually edit any playlists i was listening to after a crash.

also, i didn't know about the hidden menu file -> save configuration ;-) learn something new about foobar every day i guess.

Autosave & Autobackup (foo_jesus)

Reply #23
v.0.0.3 released, addresses issue with autosaving after number of tracks with Preferences dialog open.
Full-quoting makes you scroll past the same junk over and over.

Autosave & Autobackup (foo_jesus)

Reply #24
Doesn't work with foobar2000 0.9.5.6 anymore.
On startup you get the message: Module "foo_jesus.dll" has been removed since last run. Would you like to keep its settings?
After answering the question for keeping the settings with yes or now you get:
Failed to load DLL: foo_jesus.dll
Reason: Die angegebene Prozedur wurde nicht gefunden.
(Translation: The specified procedure could not be found)