Migrates video DB and thumbnails
Hey!I wrote a migration script which migrated my video library from 'ftp://user:password@192.168.168.1:21/Media/Video' to '/Volumes/Media/Video'.
It connects to the sqlite DB in ~/Library/Application Support/Plex/userdata/Database/MyVideos34.db and updates the tables "path" and "files". After this update it moves the thumbnail to the new location.
Basically it works like this:
<br />
select idPath, strPath from path<br />
select idFile, strFilename from files<br />
select strPath || strFilename as strPath from files,path where files.idPath = path.idPath<br />
<br />
while (files)<br />
regex replace new filename/pathname<br />
update table<br />
rename "$path/Thumbnails/Video/".substr($crc_old, 0, 1)."/".$crc_old.".tbn",<br />
"$path/Thumbnails/Video/".substr($crc_new, 0, 1)."/".$crc_new.".tbn";<br />
<br />
This script does not know anything about pictures, music or profiles.
It assumes that your Plex DB is located at "~/Library/Application Support/Plex/userdata/Database/MyVideos34.db"
Watch out: It may eat your firstborn! Always make a backup of your userdata folder:
cp -R ~/Library/Application\ Support/Plex/userdata ~/Library/Application\ Support/Plex/userdataold
Use it like this:
perl ~/Downloads/migrate.txt 'ftp://user:password@192.168.168.1:21/Media/Video' '/Volumes/Media/Video'
or for example
perl ~/Downloads/migrate.txt '/Users/elbarto/Video' '/Volumes/Media/Video'
Happy migrating!