Problem to get the thumbnails hash with php script
#1
Hello every body!! I visited a lot of pages and website to get an answer but nothing work. I want to calculate the thumbnails hash of my xbmc but any movie get the good one Sad.

My movies are on my NAS like that : smb://192.168.0.32/Volume_1/squeeze/home/maxime/Videos/Films/XXX.mkv . this is stocked in the xbmc database.

And this is my php function :

PHP Code:
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;
  } 

I use this function with this smb://192.168.0.32/Volume_1/squeeze/home/maxime/Videos/Films/XXX.mkv .

I hope you can help me Smile . Thanks in advance to all and sorry for my english i'm a little french Wink
Reply

Logout Mark Read Team Forum Stats Members Help
Problem to get the thumbnails hash with php script0