Thanks to wishie on IRC for helping my not run into this issue in the furture.
In C:\Users\.....\AppData\Roaming\XBMC\userdata\advancedsettings.xml
Code:
<advancedsettings>
<pathsubstitution>
<substitute>
<from>special://masterprofile/Thumbnails/</from>
<to>smb://user:pass@server/XBMC/userdata/Thumbnails/</to>
</substitute>
</pathsubstitution>
</advancedsettings>
He also said that the Thumbnails/Video/x/xxxxxx.tbn was a CRC of the path, using that I made a little php script for windows, if your one mac or linux be sure to use / for paths instead of \\
Code:
<?php
// Scotepi
// -------- Change This! ------------------------
$link = mysql_connect('192.168.0.11', 'xbmc', 'xbmc');
mysql_select_db('xbmc_video');
$pathToThumbs = "Thumbnails\\Video\\";
$pathToFanart = "Thumbnails\\Video\\Fanart\\";
$oldServer = "master-chief";
$newServer = "mario";
// ----------------------------------------------
$query = "SELECT strPath,strFilename
FROM path AS p
LEFT JOIN files AS f USING(idPath)
WHERE strFilename IS NOT NULL
AND NOT strFilename = ''";
$result = mysql_query($query);
while ( $row = mysql_fetch_assoc($result) ) {
$newFile = strtolower($row['strPath'].$row['strFilename']);
$newHash = thumbnailHash($newFile);
$newThumb = $pathToThumbs.$newHash{0}."\\".$newHash.'.tbn';
$oldFile = str_replace($newServer, $oldServer, $newFile);
$oldHash = thumbnailHash($oldFile);
$oldThumb = $pathToThumbs.$oldHash{0}.'\\'.$oldHash.'.tbn';
// var_dump($oldFile,$oldHash,$oldThumb,$newFile,$newHash,$newThumb,is_file($oldThumb),is_file($newThumb));echo "<br>";
echo "Looking for {$row['strFilename']}.. ";
if ( is_file($oldThumb) ) {
if ( !is_file($newThumb) ) {
echo "woot :).. ";
rename($oldThumb, $newThumb);
echo " Done<br>\n";
} else {
echo " already have it :?<br>\n";
}
} else {
echo " nope :(<br>\n";
}
}
echo "\n<br>\n All Done..";
// Lets take care of Fanart and show thumbnails
$query = "SELECT c00,c16 FROM `tvshow`"; # Really devs?
$result = mysql_query($query);
while ( $row = mysql_fetch_assoc($result) ) {
$newPath = strtolower($row['c16']);
$newHash = thumbnailHash($newPath);
$newThumb = $pathToThumbs.$newHash{0}."\\".$newHash.'.tbn';
$newArt = $pathToFanart.$newHash.'.tbn';
$oldPath = str_replace($newServer, $oldServer, $newPath);
$oldHash = thumbnailHash($oldPath);
$oldThumb = $pathToThumbs.$oldHash{0}."\\".$oldHash.'.tbn';
$oldArt = $pathToFanart.$oldHash.'.tbn';
// var_dump($row['c00'],$oldPath,$oldHash,$oldThumb,$oldArt,$newPath,$newHash,$newThumb,$newArt,is_file($oldThumb),is_file($newThumb),is_file($oldArt),is_file($newArt)); echo "<br>";
if ( is_file($oldThumb) and !is_file($newThumb) ) {
echo "Moving thumb for {$row['c00']}.";
rename($oldThumb, $newThumb);
echo ".<br>\n";
}
if ( is_file($oldArt) and !is_file($newArt) ) {
echo "Moving art for {$row['c00']}.";
rename($oldArt, $newArt);
echo ".<br>\n";
}
}
// Thanks to wishie - https://github.com/wishie/XBMC-MySQL-Web-Interface/blob/master/medialists/index.php
function thumbnailHash($input) {
$chars = strtolower($input);
$crc = 0xffffffff;
for ($ptr = 0; $ptr < strlen($chars); $ptr++) {
$chr = ord($chars[$ptr]);
$crc ^= $chr << 24;
for ($i=0; $i<8; $i++){
if ($crc & 0x80000000) {
$crc = ($crc << 1) ^ 0x04C11DB7;
} else {
$crc <<= 1;
}
}
}
//Formatting the output in a 8 character hex
if ($crc>=0){
//positive results will hash properly without any issues
return sprintf("%08s",sprintf("%x",sprintf("%u",$crc)));
} else {
/*
* negative values will need to be properly converted to
* unsigned integers before the value can be determined.
*/
//return sprintf("%08s",gmp_strval(gmp_init(sprintf("%u",$crc)),16));
// moded to remove gmp - scotepi
return sprintf("%08s",base_convert(sprintf("%u",$crc),10,16));
}
}
This will require a lot of editing depending on your setup. I lost my thumbs because I move from files from 1 server to another and updated my DB to reflect that. All I had to do was move the thumbnails from the crc of the old path to the new path. The old path as smb://master-chief/ and the new path is smb://mario/ as you can see by the str_replace on $oldPath