Reorganising your Music files without having to run an extensive LMS rescan

AVForums

Help Support AVForums:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

Now Playing

AVForums Super Veteran
Joined
May 25, 2010
Messages
1,208
Reaction score
13
Location
South Africa
If you've a LARGE music collection indexed by Logitechmediaserver you'll know that running a rebuild or refresh scan after making extensive changes to the location of the underlying music files can be a time consuming exercise and leave you without music for a few hours to a day.  The scanning engine first scans all files in the directory tree it is pointed to, moved tracks will show  up as new tracks and records pointing to old locations deleted, then artwork scanning is rerun etc. ... you get the picture.

In order to be able to easily distribute and manage my collection across a number of hard drives (and to easily replicate that to other servers with mismateched drive sizes) I completely changed the directory structure of my underlying files.  After moving the underlying files I used Sqliteman to change the underlying file path entries in the database rather than run a rescan.  End result - up and running in minutes like nothing had happened.

Two tables in LMS databases need to have the changes written:
db: persist.db, table: tracks_persistent
db: library.db, table: tracks

Just stop LMS, fire up Sqliteman, open the relevant db and run a script to make the changes for you.  Here's an excerpt to make the same change to each table (the db design leaves a bit to be desired).  You'll obviously need to adapt for your circumstances:

Find all occurrences of folder names beginning with "0" and change their url entry from "audiolib/0-E/" to "audiolib/0-9/"
Code:
update main.tracks_persistent set url = replace(url, 'file:///diskpool/d1/audiolib/0-E/','file:///diskpool/d1/audiolib/0-9/') where url like 'file:///diskpool/d1/audiolib/0-E/0%';

Code:
update main.tracks set url = replace(url, 'file:///diskpool/d1/audiolib/0-E/','file:///diskpool/d1/audiolib/0-9/') where url like 'file:///diskpool/d1/audiolib/0-E/0%';

Minutes rather than hours. ;D When you're done just restart LMS and pick up where you left off listening :thumbs:
 

Latest posts

Top