Restore/Synchronize Database 3.1.2 (2013-08-31) [MM3+]

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Restore/Synchronize Database 3.1.2 (2013-08-31) [MM3+]

Post by ZvezdanD »

Description:
The former name of this add-on was Restore PlayHistory/Playlists/Metadata. This add-on works with MediaMonkey v3.0 or higher. It could restore or synchronize (merge) the following data from/to some external (backup) database file:
- playing history (the Played table and Playcount + LastTimePlayed fields in the Songs table),
- playlists (auto-playlists and/or static ones in Playlists and PlaylistSongs tables),
- filters [MM3 db] / collections [MM4 db] and views (Filters, Views and NodeViews tables), and/or
- specified fields from the Songs table (e.g. Artist, Title or DateAdded field, however for some fields some another tables would be updated as well, e.g. Genres and GenresSongs if you specify Genre for restore).

This add-on could restore/synchronize data for all tracks in the current database or just filtered or selected ones. It could import/export data even from/to the backup file which is not a copy of the current database, i.e. the current database could be created from the ground after the last backup, as soon as they contain the same tracks. The track from the backup file is considered as matched with the track from the current database file if they have the same:
1. full path (folders\filename.extension) OR
2. checksum (made after click on Files To Edit / Duplicate Content) OR
3. filename with extension AND FileLength AND Album AND Year AND TrackNumber OR
4. path without drive letter, first folder & extension AND SongLength OR
5. filename without extension AND SongLength AND AlbumArtist AND Album AND Year AND TrackNumber.

The 2-5. criteria cover situations with modified track locations after backup. The 4-5. criteria further cover situations with different audio formats in the backup and current databases, e.g. if the backup database contains .flac tracks and the current one contains .mp3 tracks instead, but with the same filename, song length and other mentioned tags. The 2-5. criteria have the true condition only if there are exactly two matched tracks - if there are three or more tracks matched with those criteria, they would return the false condition and such tracks should have same full paths to be considered as matched. The data for tracks that are not matched between current and backup database files would not be restored.

If you have adequate backup file, this add-on could be used as Undo tool as well. Let say that you have edited some tag/field in bunch of tracks and after that you have changed your mind. Nothing to worry: just select files that are affected, specify which tags you want to restore and the add-on will import that data from the specified backup file into the current database.

Download:
http://solair.eunet.rs/~zvezdand/RestorePlayHistory.htm

Image

What is new:
v3.1.2 - 2013-08-31
* Fixed: error when restoring both Static and AutoPlaylists with Clear Playlists option turned on, if backup DB is from MM 4.0 and current DB is from MM 4.1 or vice versa;
* Fixed: finding of matched tracks in some cases.

v3.1.1 - 2012-05-31
* Fixed: error on restoring auto-playlists with the condition: Tempo/Mood/Occasion/Quality "is" ... (broken since v3.0);
* Fixed: error with Update tags in files too.

v3.1 - 2012-04-04
* Added: option Clear Filters table first (also Views & NodeViews for MM4 db);
* Added: option to import/export Bookmark, Start Time, Stop Time, Skipped # and Type fields [MM4];
* Fixed: error with Update tags in files as well.

v3.0.2 - 2012-01-25
* Fixed: error on import/export of filters when Filter table is empty.

v3.0.1 - 2012-01-12
* Fixed: import/export of filters.

v3.0 - 2012-01-09
* Added: possibility to export data to the external (backup) database file;
* Added: possibility to make a backup of the current database;
* Added: option which allows export/import of filters [MM3 db] / collections [MM4 db] and views;
* Added: option Update tags in files as well which could be used only on import;
* Added: new matching test for path without drive letter, first folder & extension (e.g. if the path is c:\Music\Rock\Pink Floyd\Time.mp3, then only Rock\Pink Floyd\Time would be compared) AND SongLength;
* Changed: calculation of PlayCounter if Clear Played table option is turned off, it is now maximum of 2 values(PlayCounter before import + number of non-existent plays of matched tracks from backup, backup PlayCounter);
* Improved: speed in some cases.

v2.1.3 - 2011-12-09
* Fixed: restoring playlists with some corrupted databases and some MM4 "normal" (?) ones.

v2.1.2 - 2011-11-15
* Fixed: auto-playlists with the condition: Album "equal/doesn't equal" ..., when backup is not copy of the current database.

v2.1.1 - 2011-08-04
* Fixed: restore of metadata stored in the Songs table only (multi-item fields linked to several tables was not affected).

v2.1 - 2011-07-19
* Added: possibility to restore playlists even when Restore data only for filtered/selected tracks options are turned on (playlists would be restored for all tracks anyway);
* Fixed: error when restoring playlists with Clear Playlists table... option turned on when importing data from MM3 backup into MM4 db or vice versa;
* Fixed: dates when importing playhistory from MM4 backup file into MM3 database.

v2.0 - 2011-07-17
* Added: possibility to restore specified fields from the Songs table (Artist, Album, Title, ...);
* Added: option to restore only selected tracks;
* Added: option to restore only tracks from the specified filter [MM3] / collection [MM4];
* Added: option to restore auto-playlists or static playlists independently;
* Added: possibility to import data from MM3 backup file into MM4 database and vice versa;
* Added: more detailed information about the execution time and progress;
* Improved: speed (in some cases drastically);
* Fixed: error when restoring playhistory with Clear Played table... option turned on [MM4];
* Fixed: program hangup with some filters;
* Fixed: program hangup with some auto-playlists having very long tags;
* Fixed: auto-playlists with the condition: Playlist "is/is not" ..., when backup is not copy of the current database;
* Fixed: playlists with incorrectly added/missing tracks when backup is corrupted.

v1.4.2 - 2010-09-03
* Fixed: problem with some auto-playlists when backup is not copy of the current database.

v1.4.1 - 2009-11-16
Fixed: error when database contains multiple playlists with same name on same folder level.

v1.4 - 2009-08-28<br />
- Added: option to restore playlists (both auto-playlists and static ones);
- Added: option to merge playlists (if Clear Playlists... option is turned off);
- Added: extra matching test for FileName/SongLength/Artist/Album/Year/TrackNumber fields (useful if audio format of tracks is different between backup and current database).

v1.3 - 2009-08-26
- Added: extra matching test for FileName.ext/FileLength/Album/Year/TrackNumber fields, i.e. track from current database is same with the track from backup database if all those fields are same, even if their paths and checksums are different.

v1.2 - 2009-08-23
- Added: option to restore Date Added field;
- Added: option to restore only filtered tracks;
- Added: option to merge/clear playstats before restoring data;
- Added: display of the number of tracks in the current database matched to backup.

v1.1.2 - 2009-08-21
- Fixed: work with multiple tracks with same checksum.

v1.1.1 - 2009-08-21
- Fixed: work with databases without track checksums.

v1.1 - 2009-08-21
- Added: matching test for track checksums, i.e. track from current database is same with the track from backup database if checksums are same even if their paths are different;
- Improved: speed drastically (~60 times faster);
- Fixed: matching test for paths now use serial number of disc as well to avoid situations with tracks with same filename, but different drive (c:\track.mp3 and d:\track.mp3 was incorrectly manipulated as one track).

v1.0 - 2009-08-19
- First public version.

Installation:
Just double-click on the RestorePlayHistory-xx.mmip file; if you are on Vista or Win7 and you got "Product installation error", make sure you have MM3 set to Run as Administrator; if you downloaded the installation package with IE and it changed its extension to a .zip, you should first change it back to a .mmip.

Usage:
Choose the Tools | Scripts | Restore/Synchronize Database option, specify the external (backup) database file with which you want to restore data, turn on the Clear Played/Playlists/Filters table... options if you want to restore data or turn them off if you want to merge data, adjust other options, click the Export button if you want to restore data in the external file or click Import if you want to restore data in the current database, and wait for the add-on to finish. It is rather slow and needs several minutes with larger databases.

If you have Clear ... table option turned off, i.e. if you want to merge data, and if you run this add-on twice with the same backup file, it will not add the playhistory/playlists/filters twice - the add-on will compare those data from the backup and current database files and if they are same it will skip them.

This add-on used in MM3 has two possible methods of restoring static playlists. The default method is very slow, but it is more reliable when the backup file contains corrupted database. The another method could cause the missing tracks from playlists and even could crush during the execution in MM4 with the corrupted databases, but it is a way faster. For example, with one test database the faster method in MM3 lasted approx. 150 seconds instead of 1600 with the default method (by the way, the playlists was restored in approx. 40 seconds from the same database in MM4 using the default method). There is no GUI control for choosing the restoring method, so if you want to turn the faster method on, you should open MediaMonkey.ini file into Notepad and enter the line PlistAltMethod = 1 into the [RestorePlayHistory] section; if you want to turn it back to the slower, more reliable method, enter PlistAltMethod = 0 or just remove that line from the .ini file.

There is also one more ini key in the [RestorePlayHistory] section which could be used to speed up the comparison of databases - it is called ExtraMatchTests and could take a value from 0 to 4, which represents the number of additional tests, beside of the base one which compares full paths. Its default value is 4, so all 5 tests mentioned in the Description section are performed. You need to exit the program before you change some value in .ini file.

Important:
This add-on could only restore data from/to some backup file, it cannot restore the current database with itself. You need to have already made the backup file before you get some problem with the current database - nothing can be done if you don't have it.

If you choose the Clear Played table... option, the Played table and playstat fields would be overwritten after applying the Export/Import command! Same state for playlists and filters with the corresponding Clear ... options. If you want to merge data, you should leave those options unchecked.

This add-on is relatively dangerous and could cause some corrupted data in the current database, especially if you forcibly terminate the program during its execution! Please make one more backup of the current database before you apply this add-on. Well, maybe you should make a copy of the backup file itself, because if you mistakenly choose the Export command, this add-on would modify the backup file as well.
Last edited by ZvezdanD on Sat Aug 31, 2013 3:30 pm, edited 24 times in total.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Restore Playing History 1.0 (2009-08-19) [MM3]

Post by nynaevelan »

I get an error when clicking on the link. :(
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
Vyper
Posts: 845
Joined: Tue May 23, 2006 5:53 pm

Re: Restore Playing History 1.0 (2009-08-19) [MM3]

Post by Vyper »

Take the 'l' off the end of the link and it works fine:


http://solair.eunet.rs/~zvezdand/RestorePlayHistory.htm
Stop Button Freak
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Restore Playing History 1.0 (2009-08-19) [MM3]

Post by ZvezdanD »

nynaevelan wrote:I get an error when clicking on the link. :(
Sorry. It is corrected now.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Restore Playing History 1.0 (2009-08-19) [MM3]

Post by nynaevelan »

ZvezdanD wrote: Usage:
Choose the Tools / Scripts / Restore Playing History option, specify backup database file from which you want to restore data and wait for it to finish. It is very slow (~20 minutes)!
How many plays do you have in your played table, it has been over an hour and mine is still going? Should I worry, I have 100,290 in mine.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Restore Playing History 1.0 (2009-08-19) [MM3]

Post by ZvezdanD »

nynaevelan wrote:How many plays do you have in your played table, it has been over an hour and mine is still going? Should I worry, I have 100,290 in mine.
I have almost no plays in my Played table since I am not using MM for reproduction. I tested one your old database with 84819 plays and 14559 tracks. Do you have backup files on some network or external drive?
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Restore Playing History 1.0 (2009-08-19) [MM3]

Post by nynaevelan »

Yes, it is on a networked drive. I will kill it and start it over once I move the file to one of the internal drives.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Restore Playing History 1.0 (2009-08-19) [MM3]

Post by nynaevelan »

Ok:

I am 2 1/2 hours in and it still is not finished, I do not think it is working on my machine. :(
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
Mizery_Made
Posts: 2283
Joined: Tue Aug 29, 2006 1:09 pm
Location: Kansas City, Missouri, United States

Re: Restore Playing History 1.0 (2009-08-19) [MM3]

Post by Mizery_Made »

I've been wanting something like this for a while now. My database has been dragged from 2.5 through most if not all of the 3.0 & 3.1 test builds, so I've often wanted a way to start a fresh database (especially since I have a few minor errors in mine, regarding Devices), but desired a way to retain the Played History data.

However, I know this is about Playing History and such, but would there perhaps be a way to add on the ability to carry over Added date while it was doing all the processing? Not exactly vital, but it could be nice to retain that information for some of my files.
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Restore Playing History 1.0 (2009-08-19) [MM3]

Post by nynaevelan »

Z:

I take back my previous statement I guess I wasn't patient enough, it completed in 6,988 seconds and now I have all my playhistory. THANK YOU VERY MUCH!! :D :D

Mizery:

What I do is use the Reg Ex script to change my timestamp to the added date, so when I created my new database I used the same script to copy the timestamp to the added date field. I'm sure this will not help you if you do not want to change your timestamp, but I prefer my files to have the date they are added to the library.

EDIT: Here's an interesting little tidbit, adding the playhistory made my library go from 134mb to 1.06gb, that's alot of plays!! :D

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Restore Playing History 1.1 (2009-08-21) [MM3]

Post by ZvezdanD »

There is a new update: v1.1 - 2009-08-21
- Added: matching test for track checksums, i.e. track from current database is same with the track from backup database if checksums are same even if their paths are different;
- Improved: speed drastically (~60 times faster);
- Fixed: matching test for paths now use serial number of disc as well to avoid situations with tracks with same filename, but different drive (c:\track.mp3 and d:\track.mp3 was incorrectly manipulated as one track).
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
Mizery_Made
Posts: 2283
Joined: Tue Aug 29, 2006 1:09 pm
Location: Kansas City, Missouri, United States

Re: Restore Playing History 1.1.1 (2009-08-21) [MM3]

Post by Mizery_Made »

Firstly, I posted in the other thread because you posted in there regarding the "checksums" calculated for the Files To Edit - Duplicate Contents node in relation to your script. That sparked my question, and also made it relevant to the other thread.

Secondly, I'm not talking about moving playhistory between two files. My question is how your script will handle two files that are duplicates but are intended to remain in the library since you have added matching on the "checksum."

http://h1.ripway.com/MizeryMade/SQLViewer%20Report.html

Two copies of a song, ripped from two different retail albums, with the same Audio Hash. The question is, how is your script going to handle this instance, when adding the data from the old database to the new one? It checks the audio hash, they're identical. They have different paths though, so would it check the audio hashes in the Songs table, see there's two with identical hashes and then instead use the Path check method on them, or what?
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Restore Playing History 1.1.1 (2009-08-21) [MM3]

Post by ZvezdanD »

OK, now I understand what you are talking about. This is very interesting question and I must say that I didn't think about it. Thanks for pointing me in the right direction. There is a new release: v1.1.2 - 2009-08-21
- Fixed: work with multiple tracks with same checksum.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Restore Playing History 1.1 (2009-08-21) [MM3]

Post by nynaevelan »

ZvezdanD wrote: - Improved: speed drastically (~60 times faster);
Wow this is great it went from 6988 seconds to 442. Great job!!
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Restore Play History/Date Added 1.2 (2009-08-23) [MM3]

Post by ZvezdanD »

There is a new update: v1.2 - 2009-08-23
- Added: option to restore Date Added field;
- Added: option to restore only filtered tracks;
- Added: option to merge/clear playstats before restoring data;
- Added: display of the number of tracks in the current database matched to backup.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
Post Reply