Hello,
I'm creating a website that generates a report of my movies in my mysql database. I'm also trying to display the cover of the movie.
The webserver is running on the same maschine where ma movies are stored.
In Eden i was able to calculate the hash with the function mentioned in the Wiki, but with the latest Frodo releases I'm unable to get the correct hash
E.g.
SQL Statement: select * from movie
Filename (attribute 'c22'): smb://FILESERVER/HD204UI 3/Collections/Alfred Hitchcock The Masterpiece Collection/Marnie.mkv
Hash returned by php: 977296af
Then i extend the extension .jpg and insert Thumbnails\9\ at the beginning
Thumbnails\9\977296af.jpg
Do you have any idea why this is not working anymore?
Then i'm also interessed in how i can retrieve the correct jpg-files for actors, fanarts, ...
Would be great if you can give me hint and/or correct my source-code.
Thanks a lot
I'm creating a website that generates a report of my movies in my mysql database. I'm also trying to display the cover of the movie.
The webserver is running on the same maschine where ma movies are stored.
In Eden i was able to calculate the hash with the function mentioned in the Wiki, but with the latest Frodo releases I'm unable to get the correct hash
E.g.
SQL Statement: select * from movie
Filename (attribute 'c22'): smb://FILESERVER/HD204UI 3/Collections/Alfred Hitchcock The Masterpiece Collection/Marnie.mkv
Hash returned by php: 977296af
Then i extend the extension .jpg and insert Thumbnails\9\ at the beginning
Thumbnails\9\977296af.jpg
Do you have any idea why this is not working anymore?
Then i'm also interessed in how i can retrieve the correct jpg-files for actors, fanarts, ...
Would be great if you can give me hint and/or correct my source-code.
Thanks a lot
PHP Code:
<?php
$verb = mysql_connect("fileserver","xbmc","xbmc") or die ("Keine Verbindung möglich");
mysql_select_db("xbmc_vid_20121108_72") or die ("DB nicht vorhanden");
echo '<head>
<style type="text/css">
.kursiv { font-size:80%;font-family:Verdana;}
.grosskursiv { font-size:90%;font-family:Verdana; }
</style>
</head>';
function _get_hash($file_path)
{
$chars = strtolower($file_path);
$crc = 0xffffffff;
for ($ptr = 0; $ptr < strlen($chars); $ptr++)
{
$chr = ord($chars[$ptr]);
$crc ^= $chr << 24;
for ((int) $i = 0; $i < 8; $i++)
{
if ($crc & 0x80000000)
{
$crc = ($crc << 1) ^ 0x04C11DB7;
}
else
{
$crc <<= 1;
}
}
}
// Système d'exploitation en 64 bits ?
if (strpos(php_uname('m'), '_64') !== false)
{
//Formatting the output in a 8 character hex
if ($crc>=0)
{
$hash = sprintf("%16s",sprintf("%x",sprintf("%u",$crc)));
}
else
{
$source = sprintf('%b', $crc);
$hash = "";
while ($source <> "")
{
$digit = substr($source, -4);
$hash = dechex(bindec($digit)) . $hash;
$source = substr($source, 0, -4);
}
}
$hash = substr($hash, 8);
}
else
{
//Formatting the output in a 8 character hex
if ($crc>=0)
{
$hash = sprintf("%08s",sprintf("%x",sprintf("%u",$crc)));
}
else
{
$source = sprintf('%b', $crc);
$hash = "";
while ($source <> "")
{
$digit = substr($source, -4);
$hash = dechex(bindec($digit)) . $hash;
$source = substr($source, 0, -4);
}
}
}
return $hash;
}
echo '<table border="1" style="border-collapse:collapse">';
$result = mysql_query("select * from movie",$verb);
while ($row_proz = mysql_fetch_array($result))
{
$test = _get_hash($row_proz['c22']);
$strFirstChar = substr($test,0,1);
$strImageFile = "Thumbnails\\".$strFirstChar."\\".$test.".jpg";
echo '
<div style="page-break-inside:avoid">
<tr>
<td width=800px valign=top nowrap><font class="grosskursiv"><b>'.$row_proz['c00'].'</b></font><br><br><font class="kursiv">'.$row_proz['c14'].'<br>'.$row_proz['c07'].'<br>'.$row_proz['c22'].'<br>'.$strImageFile.'<br>'.$row_proz['c01'].'</font></td>
<td valign=top height="200" nowrap><p><img src="'.$strImageFile.'" width="150" height="200" alt="'.$strImageFile.'"></p></td>
</tr>
</div> ' ;
}
mysql_free_result($result);
echo '</table>';
mysql_close($verb);
?>