Win Calculating Hash of Thumbnails
#1
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

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($source0, -4);
         }
      }
      
$hash substr($hash8);
   }
   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($source0, -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);
?>
Fileservers:
Core i5 2500k, 16 GB RAM, Areca 1280ML 24x RAID Controller, 4x 2TB Samsung HDD, 6x 500 GB Samsung HDD, VM ESXi 4.1, Windows 7 x64
Synology Diskstation 2413+, 6x 6 TB WD RED, 6x 3 TB WD RED

My PC:
Intel Core i7 2600K, 16 GB RAM, 240 GB SSD, Geforce GTX660, Windows 7 x64

HTPC:
Zotac ZBOX ID91, 8 GB RAM, 64 GB Crucial M4 SSD, Windows 7 x64
Reply
#2
The hash is on the URL of the art. It's JPG or PNG based on whether there's transparency.

The easiest way to do this is just look in Texture13.db - everything you need is there.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply

Logout Mark Read Team Forum Stats Members Help
Calculating Hash of Thumbnails0