changing path to media
#1
I've been using SMB paths for cross platform compatibility, but I'm done with windows so figured I'm try something else.

I'm using a mac, so if I mount the network media drive, it shows up in /Volumes so I grabbed an SQLite editor and ran the following:
Code:
UPDATE path    SET strPath =  replace (strPath,'smb://NAS','/Volumes')
UPDATE movie   SET c22 =  replace (c22,'smb://NAS','/Volumes')
UPDATE episode SET c18 =  replace (c18,'smb://NAS','/Volumes')
UPDATE tvshow  SET c16 =  replace (c16,'smb://NAS','/Volumes')
UPDATE files   SET strFilename =  replace (strFilename,'smb://NAS','/Volumes')
('NAS' being the DNS name of the network storage)

Then edited the sources.xml file with similar changes and launched XBMC

Pleasingly, I was able to play media, a file that was once addressed at smb://NAS/Video/Movies/filmtitle.avi could now be found at /Volumes/Video/filmtitle.avi

However, all fanart and thumbnails were just plain gone; I assume this is because they are stored as a hash of the full filename? I reverted to the backups and the artwork turned up again. Is there any way I can make this change sucessfully?
Reply
#2
mat____ Wrote:I've been using SMB paths for cross platform compatibility, but I'm done with windows so figured I'm try something else.

I'm using a mac, so if I mount the network media drive, it shows up in /Volumes so I grabbed an SQLite editor and ran the following:
Code:
UPDATE path    SET strPath =  replace (strPath,'smb://NAS','/Volumes')
UPDATE movie   SET c22 =  replace (c22,'smb://NAS','/Volumes')
UPDATE episode SET c18 =  replace (c18,'smb://NAS','/Volumes')
UPDATE tvshow  SET c16 =  replace (c16,'smb://NAS','/Volumes')
UPDATE files   SET strFilename =  replace (strFilename,'smb://NAS','/Volumes')
('NAS' being the DNS name of the network storage)

Then edited the sources.xml file with similar changes and launched XBMC

Pleasingly, I was able to play media, a file that was once addressed at smb://NAS/Video/Movies/filmtitle.avi could now be found at /Volumes/Video/filmtitle.avi

However, all fanart and thumbnails were just plain gone; I assume this is because they are stored as a hash of the full filename? I reverted to the backups and the artwork turned up again. Is there any way I can make this change sucessfully?
Yes, the fanarts are hashed on the full file path, so changing the filename will cause you to lose all of them. The existing ones need to be renamed (i don't know of any stand-alone reamers, but if you look at the source of the programs in my sig, you can see how I do it).
It's a CRC hash.

Your other option is to rescrape everything. Run my cleaner when you're done if you want to get rid of the old images.
XBMC.MyLibrary (add anything to the library)
ForTheLibrary (Argus TV & XBMC Library PVR Integration)
SageTV & XBMC PVR Integration
Reply
#3
Thought so, that'll make things more complicated than I'd like!

So the working idea would be to calculate the CRC for the each entry in the database to work out it's current file name, then work out what the CRC would be when it's path is changed, and perform a rename operation on the file and repeat until finished; then perform the database change? Arghh!

Re-scraping is of course simpler but I've picked the artwork for each file, they're not necessarily set to the first one the scraper finds, so everything would change or I'd need to go through them all again (not gonna happen!)

So I need to write a tool to change the filenames then. I expect I can knock something up in bash or php.

This leads me to notice a surprising choice in the database though, why is each entry stored with the canonical path? Why not store a pathID entry and a fileName entry for each file, and then store the path only once in a separate table; isn't that how databases are supposed to work?
Reply

Logout Mark Read Team Forum Stats Members Help
changing path to media0