Update Location of Files in Database 1.3 (2012-06-12) [MM2+]

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

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

Update Location of Files in Database 1.3 (2012-06-12) [MM2+]

Post by ZvezdanD »

Description:
This add-on works with MediaMonkey v2.x-4.x (there is also version of the add-on that works with MM v5). Its purpose is to update serial number of a drive and/or paths of files stored in the database, for example after upgrading hard disk or moving files from/to some network drive with UNC path. This add-on could change the mentioned data stored in the database only, but it could also copy the media files from the old to the new location.

Its main advantages to some another similar scripts are the possibility to update location of files on network drives and the option to specify old and new base paths, e.g. if you want to update c:\Documents & Settings\User\Music\ to d:\Music\.

Download:
http://solair.eunet.rs/~zvezdand/Update ... fFiles.htm

If that link doesn't work, please try with this one:
https://zvezdan-d.github.io/UpdateLocationOfFiles.html

Image

What is new:
v1.3.3 - 2012-06-12
* Fixed: display of old UNC paths on some broken/faulty databases.

v1.3.2 - 2012-06-01
* Fixed: update when the old and new paths are same with the same drive letters, but with different drive serial numbers.

v1.3.1 - 2012-02-26
* Fixed: result of searching for existing paths from SynchLocation table.

v1.3 - 2012-02-24
* Added: Copy files from the old to the new location first option;
* Added: update of paths in SynchLocation table;
* Fixed: update of paths in Playlist table;
* Fixed: update of locations when only for existing files option is turned on, the old path is the root of a drive and the old and new drives are the ones with the drive letter (i.e. they are not UNC/URL).

v1.2 - 2012-02-13
* Added: support for mapped network drives;
* Added: support for URL/UPnP old paths (cannot be specified as new paths);
* Added: selection of the new drive/folder in the tree panel after the update;
* Fixed: display of the updated paths in the tracklist;
* Fixed: Update and Cancel buttons could be clicked when searching for existing files if the Update paths only for existing files option is turned off.

v1.1.1 - 2012-02-04
* Fixed: error with MM3 older than 3.1.0.1235.

v1.1 - 2012-01-31
* Added: Update paths only for existing files option;
* Added: support for MM2;
* Fixed: displayed number of existing tracks.

v1.0.1 - 2012-01-25
* Fixed: wrong old paths with missing "\" after drive letter [MM3];
* Fixed: displayed number of existing tracks.

v1.0 - 2012-01-09
* First public version.

Installation:
  • For MediaMonkey 3.0 or higher - just double-click on the UpdateLocationOfFiles-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 IE7 and it changed its extension to a .zip, you should first change it back to a .mmip.
  • For MediaMonkey 2.x - rename a .mmip extension to a .zip, extract the UpdateLocationOfFiles.vbs file to the MediaMonkey's "Scripts" folder and restart MM program.
Usage:
After installation of the add-on you will find the new Update Location of Files in Database option in the Tools / Scripts menu. When you choose that option from the menu, you will get opened the add-on's dialog box. After its first start, the options will be set to their default blank/unchecked states; if you change some option in the dialog box and start the update, the settings will be remembered in the MediaMonkey.ini file, so the next opening of the dialog box will show those last settings. The exception is with the Old drive and Old path combo boxes that will be automatically selected with the drive/path of the selected folder in the Tree panel. However, the old drive/path could be set manually in the mentioned dialog box as well.

With the Old drive and Old path combo boxes you should set the old location of files (source) and with the New path text box you should set the new location of files (destination). To be able to do update, both locations should be correctly specified. If your Old drive/path dropdown lists are not filled with drives/paths, that means that your database is empty, in which case this add-on cannot be used - you should have database that contains files if you want to update their location (as the name of the add-on suggests).

The Old drive combo box shows all drives containing media files that are added to the database (Library). These are the same drives that you have displayed in the Location sub-folder of the Entire Library collection. When you choose drive from that combo box, the Old path combo box will be filled with all folders from that drive containing files in the database including all their parent folders until the root of drive. For example, if I have one track in the database which has the path C:\Music\Pink Floyd\Time.mp3, there would be listed 3 items: C:\, C:\Music\ and C:\Music\Pink Floyd\.

With the Old path combo box you are choosing the base folder that you want to update. This means that you will get updated all files from that folder and its sub(-sub)-folders recursively. This also means that you should select the root of the drive in the Old path combo box if you want to update all files from that drive. For example, if I specify C:\Music\, all files which have that on the begin of the path would be updated, like C:\Music\Pink Floyd\Time.mp3, but not file like C:\My Documents\Pink Floyd\Time.mp3 since it has different base folder.

The Old location label shows how many media and playlist files from the database are located in the base folder (and its sub-folders) selected by Old path; also, it shows how many of those files still physically exist at that location.

For example, if my Old location shows "228831 media files + 1329 playlist files, 229920 existing + 240 missing", that means that I have 228831 records about media files and 1329 records containing the information about playlist files stored into the database. The sum of these two numbers is 230160 files and it is equal to the sum of another two numbers (229920 existing + 240 missing). In another words, of all my media and playlist files referenced in the database I have 240 files that are psychically missing on the location that I have specified with the Old path. It is not displayed how many media or playlist files are existing/missing individually, but only for their sum.

By the way, the records containing information about playlist files are not the same as the records about playlists. The records of playlists could contain the information about the imported playlists files, but if you have playlists that are created by yourself, i.e. they are not created by import from playlist files, then such playlists will not contain the information about playlist files.

In the New path text box you should specify the base folder which would replace the old one after applied the Update option. For example, if the Old path is "c:\Music\" and New path is "d:\Media\My Music\" then all files in the database that have "c:\Music\" on the begin of path will be updated to "d:\Media\My Music\". You could type the new path on keyboard or you could click on the "..." button to choose an existing drive/folder from the Browse for folder dialog box.

Similarly to the Old location, the New location label shows how many media and playlist files from the database physically exist at the base folder (and its sub-folders) specified by New path.

When you change the old or new path, the add-on will start checking for existence of the files at specified locations which could be time consuming, especially with the large databases and/or media files located on network drives. You don't need to wait for the add-on to finish searching for files since it is executed in another thread just for checking purpose and will be canceled if you click on the Update button. However, it is recommended to wait for add-on to finish with that searching because it will display how many files from the database are found on the new specified location.

If the option Copy files from the old to the new location first is turned on, then the files will be physically copied before updating of the database; otherwise, only the data about the location of files in the database will be modified. If you plan to use this option, it is recommended that you temporarily turn off the File Monitor option in the Options dialog box (if you have it already enabled) before you open the add-on's dialog box.

Only the media/playlist files previously stored in the database could be copied. If you have some extra files beside of the media files in their containing folders, e.g. bitmaps with covers or some txt/html files, they would not be copied using the mentioned option; in that case you should use your preferred program for backup to copy files from the old to the new location before you apply this add-on.

If you want to update location in database only for files that exist at the new specified location, you should turn on the option Update paths in database only for files that exist at new location. In that case you should wait for the add-on to finish with search for files before you click on the Update button. However, if you turn that option off, you could click on the Update button immediately after you specify the old and new paths.

The Backup button allows you to save a copy of the current (active) database to some safe place. And finally, when all previously mentioned options are set as wanted, the click on the Update button will start the update action (which could take some time). After the update is finished, the add-on could try to refresh the affected paths in the main filelist, but sometimes that could be unsuccessful because of some limitations in the program itself, in which case the simple restart of the program would help. The paths in the Now Playing panel will be updated as well if the affected files were previously already stored in the database.

Limitations
The UPnP and URL paths cannot be specified for the New path, only paths with a drive letter or network drives with UNC path.

However, you could specify UPnP or URL paths in the Old path.

Important
If you want to use this add-on when replacing the hard disk, it is very important that you turn off the automatic scanning for new media files in the program before you attach your new drive, until you finish with this add-on. If you let the program to automatically scan the new drive adding its media files to the old database, you will end up with the database containing duplicates with files both from the old and new drive.

It is also recommended that you suspend all activities that could modify database, including playback of files (playing info is updated in database), until the add-on finish with updating.

This add-on is mostly useful if you have similar folder structure on the old and new drives, i.e. when the old and new paths have different only base folders. If you have moved media files to the new hard disk using different filenames and/or folder structure than it is stored in the database, then you could try Restore/Synchronize Database add-on instead since it can transfer data even in such situations, but it is much slower.

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 a backup of the current database before you apply this add-on.
Last edited by ZvezdanD on Mon Jun 20, 2022 3:32 pm, edited 9 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
Orbi
Posts: 57
Joined: Wed Jun 30, 2010 2:47 am

Re: Update Location of Files in Database 1.0 (2012-01-09) [M

Post by Orbi »

Very interesting! I have used the 'Change drive ID' script in the past, but this one seems more flexible. I will provide more feedback at some point after using it.

Thanks for this!
CarvedBLock

Please help. Does not do anything?

Post by CarvedBLock »

Hello,

Thank you for developing such a (potentially) useful script.

Unfortunately, it does not seem to be doing anything for me. I run win7, MM 3.2.5.1306.
My old computer died, but I had a copy of the database file and the music files.

So I copied the database file into the new PS's MM directory, installed the script and ran it.

It all remains gray no matter what I try. It does not produce error, and finishes within fractions of a second.

Any help would be greatly appreciated! I DJ sometimes, and some of the metadata is very valuable to me.

Best!
CarvedBlock
ZvezdanD
Posts: 3227
Joined: Thu Jun 08, 2006 7:40 pm

Re: Please help. Does not do anything?

Post by ZvezdanD »

CarvedBLock wrote:It all remains gray no matter what I try.
Could you be more specific what have you tried? What have you specified for Old drive/path and New path? Could you write an example of some file with the old and new paths? Have you got the number of the files existing at the new location which is displayed between Backup and Update buttons?
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
cyberlarson
Posts: 13
Joined: Mon Apr 05, 2010 6:36 pm

Re: Update Location of Files in Database 1.0 (2012-01-09) [M

Post by cyberlarson »

I am trying it now. I, too, am getting a greyed out screen. In task manager, it says it is not responding. I am going to wait to see if it clears up.
cyberlarson
Posts: 13
Joined: Mon Apr 05, 2010 6:36 pm

Re: Update Location of Files in Database 1.0 (2012-01-09) [M

Post by cyberlarson »

I think I solved the problem.

Open MM as Administrator

When you open the script, under "old path", it lists the drive letter only, it should be the drive letter AND the path that MM files are listed. (F:\mediamonkey)

New path should be the new drive and path (L:\mediamonkey)

Before you click on the Update button, the script searches the new location and gives you a status of how many of the files that it found and how many missing. Then you click on update.

The screen shot that you posted is misleading, it shows 0 exists

The screen does grey out, just let it be. Task Manager will show it not responding. I shut down all other programs and the process took about 4-5 minutes to process.

Excellent script!!!! Good work
ZvezdanD
Posts: 3227
Joined: Thu Jun 08, 2006 7:40 pm

Re: Update Location of Files in Database 1.0 (2012-01-09) [M

Post by ZvezdanD »

cyberlarson wrote:Open MM as Administrator
Are you sure that it needs to be opened as Administrator? I cannot try it since I have it in XP, but it should work like any other MM script without such requirement.
cyberlarson wrote:When you open the script, under "old path", it lists the drive letter only, it should be the drive letter AND the path that MM files are listed. (F:\mediamonkey)
The Old path is a combo box with a list of all base paths in your database, which means that you could choose any one from it if you click on the arrow button. For example, if I have one track in the database which has the path C:\Music\Pink Floyd\Money.mp3, there would be listed 3 items: C:\, C:\Music\ and C:\Music\Pink Floyd\.

However, I forgot to write that you could also select the old drive/path before you open that dialog box - just select some missing file in the main tracklist which has the old drive/path or select the missing drive/folder in the Location or My Computer branch of the tree panel and when you open the dialog box it would be automatically selected.

I didn't also write that the old and new paths are in fact the base folders. I think that it is obvious, but I will try to explain it further. For example, if I specify C:\Music\, all files which have that as the base path would be updated, like C:\Music\Pink Floyd\Money.mp3, but not files like C:\My Documents\Pink Floyd\Money.mp3 since it has different base folders.

If you specify just x:\ where "x" is some drive letter, that means that you want to update location for all files residing on that drive. So, if you specify the old path x:\ and the new path y:\, this add-on would behave like Change Drive-ID script with only drive-id and/or drive serial number changed.
cyberlarson wrote:Before you click on the Update button, the script searches the new location and gives you a status of how many of the files that it found and how many missing. Then you click on update.
You don't need to wait for the add-on to finish with the searches for files, you could click on the Update button immediately after you choose old and new paths. That searching for files is executed in another thread just for checking purpose and would be canceled if you click on the Update button. However, it is recommended to wait for add-on to finish with searching because it would display how many files from the database are found on the new specified location.
cyberlarson wrote:The screen shot that you posted is misleading, it shows 0 exists
Why is it misleading? It shows how many files I had existing on the new location, which was 0 since it was not my database, but from some another user.
cyberlarson wrote:Task Manager will show it not responding. I shut down all other programs and the process took about 4-5 minutes to process.
The actual update should finish for only few seconds, but searching for files could lasts a little longer indeed. However, as I said, you don't need to wait for add-on to finish searching, just press Update and it would finish much faster.
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
cyberlarson
Posts: 13
Joined: Mon Apr 05, 2010 6:36 pm

Re: Update Location of Files in Database 1.0 (2012-01-09) [M

Post by cyberlarson »

I certainly didn't mean to insult you. The script worked very well.

I tried it about 4 times, taking notes. The notes are from the last time that worked. I have Win7 Pro.

About the file count prior to clicking on update, The only time it worked properly, was when I waited for the file count to complete and then click Update. The file count was the quickest of all the processes. My library is about 100,000.

The "Run as Admin" comment is based on other scripts that I have installed in MM. For whatever reason, installing scripts in MM seem to work smoothly when I run as admin.
ZvezdanD
Posts: 3227
Joined: Thu Jun 08, 2006 7:40 pm

Re: Update Location of Files in Database 1.0 (2012-01-09) [M

Post by ZvezdanD »

cyberlarson wrote:I certainly didn't mean to insult you.

I tried it about 4 times, taking notes. The notes are from the last time that worked.

About the file count prior to clicking on update, The only time it worked properly, was when I waited for the file count to complete and then click Update.
You didn't insult me. I just wanted to clarify some facts that you mentioned which could mislead other users. If you are sure about them, then that would be bugs of the add-on. Could you upload your database file to some file server like Mediafire packed previously with Zip, so I could try to reproduce those problems by myself?
cyberlarson wrote:The "Run as Admin" comment is based on other scripts that I have installed in MM. For whatever reason, installing scripts in MM seem to work smoothly when I run as admin.
The "Run as Admin" requirement is only for installing the add-ons in MM3 (and MM4 if you decide to install the add-on to all users on the computer) as I already mentioned in the Installation section of the first post. The later usage of the scripts, e.g. after the restart of the program, doesn't require such thing.
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
swjm
Posts: 8
Joined: Tue Jan 24, 2012 12:23 pm

Re: Update Location of Files in Database 1.0 (2012-01-09) [M

Post by swjm »

Hmm, I seem to be having problems as well, unfortunately. No matter what level I select for either side, it simply tells me that all files are missing, and non have been updated.

Right now I have:

Windows 7, MM 3.2.5.1306,

Old Drive: HD:MyBook, ID#######, Not Accessable
Old Path: ?:MusicLibrary\ (I can also select any artist ?:MusicLibrary\MyMusic\Artistshere)
New Path: Where it should be is C:\User\Username\MusicLibrary\MyMusic\Artistshere

Whether I select either side to be at MusicLibrary level or MyMusic level, neither works?

I get a '17002 files, 0 exists, 17002 missing'.

Nothing I do changes the number of missing files...
ZvezdanD
Posts: 3227
Joined: Thu Jun 08, 2006 7:40 pm

Re: Update Location of Files in Database 1.0 (2012-01-09) [M

Post by ZvezdanD »

swjm wrote:Old Path: ?:MusicLibrary\ (I can also select any artist ?:MusicLibrary\MyMusic\Artistshere)
Is it ?:MusicLibrary\ or ?:\MusicLibrary\? You have one missing "\" there. I suppose that your Old path should be ?:\MusicLibrary\MyMusic\ and New path should be C:\User\Username\MusicLibrary\MyMusic\.

OK, here is what you could try:
- find some track in the My Computer branch which is missing from the Library and copy its Path;
- find the same missing track in the Library/Location branch and select it in the main tracklist;
- open the Update Location dialog box and check out if the Old path of that track is correctly displayed;
- paste copied Path excluding the filename and extension in the New path text box (make sure that it ends with "\");
- wait for the add-on to search for file;
- make a screenshot of the dialog box and post it here if you still have displayed 0 existing files.
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
swjm
Posts: 8
Joined: Tue Jan 24, 2012 12:23 pm

Re: Update Location of Files in Database 1.0 (2012-01-09) [M

Post by swjm »

ZvezdanD wrote:
swjm wrote:Old Path: ?:MusicLibrary\ (I can also select any artist ?:MusicLibrary\MyMusic\Artistshere)
Is it ?:MusicLibrary\ or ?:\MusicLibrary\? You have one missing "\" there. I suppose that your Old path should be ?:\MusicLibrary\MyMusic\ and New path should be C:\User\Username\MusicLibrary\MyMusic\.
Hmm. I wonder if that could be the issue? Because as you can see...

Image

.... there is no \ before MusicLibrary in the old path.

and following (I think... It's possible I did something wrong?) your instructions I got this:

Image

Moving either dialogue box up a level or two seemed to make no difference
swjm
Posts: 8
Joined: Tue Jan 24, 2012 12:23 pm

Re: Update Location of Files in Database 1.0 (2012-01-09) [M

Post by swjm »

Also, this may have something to do with the 'no \' issue?

Currently the full old filepath for that exact file is listed as:

'[My Book]\Music Library\My Music\38 Special\_38 Special_ Anthology\.38 Special - Chain Lightnin'.m4p'

Now, it definitely used to say 'G:' instead of [My Book]. I think this may have happened when I originally ran the script, although I'm not at all sure, and could've been cause with my fiddling around with my Terabyte trying to get it not to die.

Basically, I think if that's the issue that this was the cause?
ZvezdanD
Posts: 3227
Joined: Thu Jun 08, 2006 7:40 pm

Re: Update Location of Files in Database 1.0 (2012-01-09) [M

Post by ZvezdanD »

swjm wrote:
ZvezdanD wrote:Is it ?:MusicLibrary\ or ?:\MusicLibrary\? You have one missing "\" there.
Hmm. I wonder if that could be the issue?
Thanks for the report, that was a bug of the add-on in MM3. There is the new release: v1.0.1 - 2012-01-25
* Fixed: wrong old paths with missing "\" after drive letter [MM3];
* Fixed: displayed number of existing tracks.

Please let me know if it is working now as it should.
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
swjm
Posts: 8
Joined: Tue Jan 24, 2012 12:23 pm

Re: Update Location of Files in Database 1.0 (2012-01-09) [M

Post by swjm »

<_<

I'm really sorry if it turns out I'm blind, but did you update the add-on download somewhere I'm not seeing?

Edit: Aha, thanks! :D
Post Reply