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

Re: Restore PlayHistory/DateAdded/Playlists 1.4 (2010-09-03

Post by ZvezdanD »

Onweerwolf wrote:In any case, I've upgraded the first database I made to MM4 and the files that were giving me problems have been fixed using this script.. :D :D :D
I am glad that you solved your problems, but it still would be nice if you send me your databases so I could reproduce and fix bugs that you discovered.
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
MM3 monkey
Posts: 455
Joined: Mon Aug 27, 2007 2:34 am

Re: Restore PlayHistory/DateAdded/Playlists 1.4 (2010-09-03

Post by MM3 monkey »

You're so greedy, ZD. ;)
Onweerwolf
Posts: 705
Joined: Tue Dec 12, 2006 5:32 pm
Location: The Netherlands

Re: Restore PlayHistory/DateAdded/Playlists 1.4 (2010-09-03

Post by Onweerwolf »

I will, I'm just currently executing a dev app that Rusty send me that should also be able to clean up the database by making a new one and copying info from an old one, similar to your script but without the merging ability (i'm guessing). It has been running for 8 hours now and it's still not finished so you'll have to wait a bit before I can produce my two databases for you. Busy weekend ahead also, but I promise I will get them to you eventually. :)
Image
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Restore PlayHistory/Playlists/Metadata 2.0 (2011-07-17[M

Post by ZvezdanD »

Thanks to Onweerwolf and Mizery_Made for databases. There is the new version: 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 when backup is not copy of the current database;
* Fixed: auto-playlists with the condition Playlist "is/is not" xxx when backup is not copy of the current database;
* Fixed: static playlists with incorrectly added/missing tracks when backup is corrupted.

Important:
The default method of restoring static playlists is very slow in MM3, 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.
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 PlayHistory/Playlists/Metadata 2.0 (2011-07-17[M

Post by nynaevelan »

I still get the same error when trying to restore a mm3 db from a mm4 db.

EDIT: Also, as long as I do not check the clear playlist table it works. I had a little problem the first time because I didn't select the restore data only for filter tracks. I didn't select it the first time because I wanted it to restore all tracks, I didn't realize I needed to make a selection there, the wording may be a little misleading. Other than that it worked for a mm3 db.

This is a nice addition to the script because it gives the user the opportunity to downgrade from MM4 without losing any played/playlist/editing data, thanks for this nice upgrade. :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
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Restore PlayHistory/Playlists/Metadata 2.0 (2011-07-17[M

Post by nynaevelan »

One more thing with trying to restore in MM3, once you have run it the first time and closed MM, it greys out the playlist options and you are not allowed to select your choices there unless you delete the settings from the mediamonkey.ini file. I have not tried any testing in MM4 yet so I am not sure if that exhibits the same behavior. Actually even if you clear the settings the playlist options are still greyed out.

EDIT: The file worked semi-perfectly in MM4. I figured out if you pick the playlist options before you select the database, it will accept your choices before greying out the playlist options, otherwise the playlist features will be greyed out and you cannot make any choices there. Other than that it worked perfectly, I only used the playcount, playlist and date added features, I didn't select any of the tag fields.

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 PlayHistory/Playlists/Metadata 2.0 (2011-07-17[M

Post by ZvezdanD »

nynaevelan wrote:I still get the same error when trying to restore a mm3 db from a mm4 db.
Well, it is not the same error, but it will be resolved anyway. Thanks for the report.
nynaevelan wrote:I didn't realize I needed to make a selection there, the wording may be a little misleading.
You know that my English is not very well. I am ready for any suggestion. However, I am not sure that understand what you want to say.
nynaevelan wrote:One more thing with trying to restore in MM3, once you have run it the first time and closed MM, it greys out the playlist options and you are not allowed to select your choices there unless you delete the settings from the mediamonkey.ini file.
Do you have turned off "Restore data only for filtered tracks:" and "Restore data only for xx selected track(s)"?
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 PlayHistory/Playlists/Metadata 2.0 (2011-07-17[M

Post by nynaevelan »

ZvezdanD wrote:
nynaevelan wrote:I still get the same error when trying to restore a mm3 db from a mm4 db.
Well, it is not the same error, but it will be resolved anyway. Thanks for the report.
Sorry I didn't read it, this is the error I get when I try to select the clear playlist table:

Image
estore_playlist error by nynaevelan1, on Flickr
ZvezdanD wrote:
nynaevelan wrote:I didn't realize I needed to make a selection there, the wording may be a little misleading.
You know that my English is not very well. I am ready for any suggestion. However, I am not sure that understand what you want to say.
I am not sure what the correct terminology should be, but it should say you have to select a filter in order for the playcounts to be imported. It did work partially but it only imported playcounts for 1675 tracks instead of for the total 18,933. I am not sure why it picked those 1675.
ZvezdanD wrote:
nynaevelan wrote:One more thing with trying to restore in MM3, once you have run it the first time and closed MM, it greys out the playlist options and you are not allowed to select your choices there unless you delete the settings from the mediamonkey.ini file.
Do you have turned off "Restore data only for filtered tracks:" and "Restore data only for xx selected track(s)"?
No, I had them selected but once I un-selected them I was able to change my playlist options, you have to un-select both to be able to change the playlist options. If this is intended behavior, a warning here may be necessary also.
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 PlayHistory/Playlists/Metadata 2.0 (2011-07-17[M

Post by ZvezdanD »

nynaevelan wrote:Sorry I didn't read it, this is the error I get when I try to select the clear playlist table:
Yes, I found that error, but the first time it was with the play history, not with the playlists.
nynaevelan wrote:I am not sure what the correct terminology should be, but it should say you have to select a filter in order for the playcounts to be imported. It did work partially but it only imported playcounts for 1675 tracks instead of for the total 18,933. I am not sure why it picked those 1675.
Sorry, but I really don't understand. You don't need to select a filter in order for the playcounts to be imported, but If you do that then you would get imported playcounts only for matched filtered tracks. I think it is obvious from the name of that option ("Restore data only for filtered tracks:"). However, If you turn off both "Restore data only for ... tracks" options, then you would get imported playcounts for all matched tracks. Do you want to say that you are getting a different result?
nynaevelan wrote:No, I had them selected but once I un-selected them I was able to change my playlist options, you have to un-select both to be able to change the playlist options. If this is intended behavior, a warning here may be necessary also.
This is intended behavior. It was like that in the previous version of add-on as well. Playlists are independent of filters/collections and you cannot import them for selected or filtered tracks, but only for all tracks in the database. Although, I could add a warning message about that.
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 PlayHistory/Playlists/Metadata 2.0 (2011-07-17[M

Post by nynaevelan »

ZvezdanD wrote:
nynaevelan wrote:I am not sure what the correct terminology should be, but it should say you have to select a filter in order for the playcounts to be imported. It did work partially but it only imported playcounts for 1675 tracks instead of for the total 18,933. I am not sure why it picked those 1675.
Sorry, but I really don't understand. You don't need to select a filter in order for the playcounts to be imported, but If you do that then you would get imported playcounts only for matched filtered tracks. I think it is obvious from the name of that option ("Restore data only for filtered tracks:"). However, If you turn off both "Restore data only for ... tracks" options, then you would get imported playcounts for all matched tracks. Do you want to say that you are getting a different result?
Yes, what I am saying is the first time I ran it I did not select a filter and I did not select that option because I didn't think I needed to because I wanted it to import the playcounts from my entire library. Well when I did that it only imported playcounts for 1675 tracks instead of the 18,637 music/audiobooks which have playcounts.
ZvezdanD wrote:
nynaevelan wrote:No, I had them selected but once I un-selected them I was able to change my playlist options, you have to un-select both to be able to change the playlist options. If this is intended behavior, a warning here may be necessary also.
This is intended behavior. It was like that in the previous version of add-on as well. Playlists are independent of filters/collections and you cannot import them for selected or filtered tracks, but only for all tracks in the database. Although, I could add a warning message about that.
I understand the reasoning behind it but if other users are like me and would select their options from the top down, they will not be able to select their playlist options because they have selected a filter.
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 PlayHistory/Playlists/Metadata 2.0 (2011-07-17[M

Post by ZvezdanD »

nynaevelan wrote:Yes, what I am saying is the first time I ran it I did not select a filter and I did not select that option because I didn't think I needed to because I wanted it to import the playcounts from my entire library. Well when I did that it only imported playcounts for 1675 tracks instead of the 18,637 music/audiobooks which have playcounts.
Could you send me your databases to try to reproduce the problem?
nynaevelan wrote:I understand the reasoning behind it but if other users are like me and would select their options from the top down, they will not be able to select their playlist options because they have selected a filter.
I still think that users should not be able to import their playlists if they have selected a filter, but I will enable that with the mentioned warning message.
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 PlayHistory/Playlists/Metadata 2.0 (2011-07-17[M

Post by nynaevelan »

ZvezdanD wrote: Could you send me your databases to try to reproduce the problem?
I just rebuilt it, you can download from here: http://dl.dropbox.com/u/13254132/mm.db. This is the mm3 database.
ZvezdanD wrote: I still think that users should not be able to import their playlists if they have selected a filter, but I will enable that with the mentioned warning message.
I think they should, there may be some users who want to restore the playcount for selected tracks but at the same time their playlists. This is not something I would do but a warning might be useful to help them know they cannot import playlists at the same time they import filtered playcounts.
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 PlayHistory/Playlists/Metadata 2.0 (2011-07-17[M

Post by nynaevelan »

I am starting to think that the error with the playlists are why only part of the tracks playcounts were imported because I cannot reproduce it now.

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 PlayHistory/Playlists/Metadata 2.0 (2011-07-17[M

Post by ZvezdanD »

nynaevelan wrote:This is the mm3 database.
I need both old (backup) and new (current, before import) databases, but if you cannot reproduce it now, how could I?
nynaevelan wrote:I think they should, there may be some users who want to restore the playcount for selected tracks but at the same time their playlists. This is not something I would do but a warning might be useful to help them know they cannot import playlists at the same time they import filtered playcounts.
As I said, I will enable import of playlists no matter if filtered/selected tracks is turned on. However, I think to rename these options to "Restore playhistory/metadata only for filtered/selected tracks" without adding any new warning message. In that case users would know that these options don't affect playlists. What do you think about that?
nynaevelan wrote:I am starting to think that the error with the playlists are why only part of the tracks playcounts were imported because I cannot reproduce it now.
Well, I don't know. The import of playhistory is done before the script reach the place with that error with the playlists. However, with this version of script I am using Begin Transaction/Commit surrounding all database modifications, so it is quite possible if script is terminated forcibly (or because of the error) that not all previous modifications are written to the database. Ideally, if script is terminated there should not be written any modification, but your example shows different.
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 PlayHistory/Playlists/Metadata 2.0 (2011-07-17[M

Post by nynaevelan »

ZvezdanD wrote: I need both old (backup) and new (current, before import) databases, but if you cannot reproduce it now, how could I?
Here it is, it is a mm4 db: http://dl.dropbox.com/u/13254132/mm%20%282%29.db
ZvezdanD wrote: As I said, I will enable import of playlists no matter if filtered/selected tracks is turned on. However, I think to rename these options to "Restore playhistory/metadata only for filtered/selected tracks" without adding any new warning message. In that case users would know that these options don't affect playlists. What do you think about that?
I think that should work.
ZvezdanD wrote: Well, I don't know. The import of playhistory is done before the script reach the place with that error with the playlists. However, with this version of script I am using Begin Transaction/Commit surrounding all database modifications, so it is quite possible if script is terminated forcibly (or because of the error) that not all previous modifications are written to the database. Ideally, if script is terminated there should not be written any modification, but your example shows different.
This one is over my head.
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
Post Reply