I want to move my music files to a new drive, but want to be able to keep the ratings I've assigned to them. The files are currently in the library by means of a watch folder.
If I move the files to a new location and add the new folder as a watch folder, I get duplicates in the library. Obviously deleting the original list from the library is not the solution because I would lose all the ratings I've assigned.
What are the steps I should take to do this without damaging my current setup?
Moving files to a new location
Re: Moving files to a new location
Right now this is a shortcoming in Play, and you can't do it. I plan on adding this ability for the next release.
However, Play stores all the track information in an sqlite3 database. If you wanted to modify the database directly to point at the file's new locations it shouldn't be too hard, it would just require a little bit of SQL. If you're interested I can post some code to help.
However, Play stores all the track information in an sqlite3 database. If you wanted to modify the database directly to point at the file's new locations it shouldn't be too hard, it would just require a little bit of SQL. If you're interested I can post some code to help.
Re: Moving files to a new location
That would be great. What do I need to do?
Re: Moving files to a new location
First you will need to download sqlite. You can compile from source, use MacPorts to install it, or just download the precompiled OS X binaries.
You will be editing the ~/Library/Application Support/Play/Library.sqlite3 file.
Start up sqlite using
You may first want to check out the contents of the file:
This will display 10 tracks from your library.
Here is some sample output:
The part you will be replacing is the url field, which is displayed as the second block in the output, in the case above the URL is file://localhost/Users/xxx/Music/Sheryl%20Crow/The%20Very%20Best%20of%20Sheryl%20Crow/17%20First%20Cut%20Is%20The%20Deepest%20(Country%20Version).flac.
You'll need to know both the new path and the old path for the files, and be able to convert them to URL encoding. If you don't have any weird characters URL encoding will just replace spaces with %20.
Let's say you moved your files from /Users/xxx/Music to /External HD/Music. The original URL prefix would be file://localhost/Users/xxx/Music and the new URL prefix will be file://localhost/External%20HD/Music.
You can replace all instances of the old prefix with the new prefix using
That should do it.
You definitely want to make a back up of your Library.sqlite3 file before you edit it in this way, just in case something weird happens. If you need help converting filesystem paths to URLs I can help with that also.
You will be editing the ~/Library/Application Support/Play/Library.sqlite3 file.
Start up sqlite using
Code: Select all
% sqlite ~/Library/Application\ Support/Play/Library.sqlite3
Code: Select all
sqlite> select * from streams limit 10;
Here is some sample output:
Code: Select all
227|file://localhost/Users/xxx/Music/Sheryl%20Crow/The%20Very%20Best%20of%20Sheryl%20Crow/17%20First%20Cut%20Is%20The%20Deepest%20(Country%20Version).flac|-1|-1|232184246.579575|||||||First Cut Is The Deepest (Country Version)|The Very Best Of Sheryl Crow|Sheryl Crow|Sheryl Crow|Rock|Cat Stevens|2003||17|17|1|1||USAM10300536|0602498611548|||||||||FLAC|FLAC|FLAC|16|2|44100.0|9903480|
You'll need to know both the new path and the old path for the files, and be able to convert them to URL encoding. If you don't have any weird characters URL encoding will just replace spaces with %20.
Let's say you moved your files from /Users/xxx/Music to /External HD/Music. The original URL prefix would be file://localhost/Users/xxx/Music and the new URL prefix will be file://localhost/External%20HD/Music.
You can replace all instances of the old prefix with the new prefix using
Code: Select all
sqlite> update streams set url=replace(url, "file://localhost/Users/xxx/Music", "file://localhost/External%20HD/Music");
You definitely want to make a back up of your Library.sqlite3 file before you edit it in this way, just in case something weird happens. If you need help converting filesystem paths to URLs I can help with that also.
Re: Moving files to a new location
In case you want to perform modifications offline in a text editor editing in sql syntax you can do it like this:
Using Terminal, cd to the folder where you want to dump your library. Then...
... modify Library.sql to your heart's content ...
... done.
Using Terminal, cd to the folder where you want to dump your library. Then...
Code: Select all
sqlite3 ~/Library/Application\ Support/Play/Library.sqlite3 .dump > Library.sql
Code: Select all
mv ~/Library/Application\ Support/Play/Library.sqlite3 ~/Library/Application\ Support/Play/Library.sqlite3.backup
Code: Select all
sqlite3 ~/Library/Application\ Support/Play/Library.sqlite3 < Library.sql