javascript to generate crc code for thumbnails. - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Discussions (https://forum.kodi.tv/forumdisplay.php?fid=222) +--- Forum: Off-Topic (https://forum.kodi.tv/forumdisplay.php?fid=113) +--- Thread: javascript to generate crc code for thumbnails. (/showthread.php?tid=58389) |
javascript to generate crc code for thumbnails. - Fiasco - 2009-09-22 Would it be possible to get a javascript function for AJAX purposes that can take the path/filename and convert it to the correct thumbnail (tbn) filename? - Fiasco - 2009-09-22 Or, add the crc of the thumb to the database? - Fiasco - 2009-09-23 this what is listed on the thumbnail wiki page for generating the thumb crc/name. Code: public string Hash(string input) Here is my (failed) javascript Code: function findCRC( string ) { C:\Movies\Singles.iso generates -43a5d0a9 (should generate 405f3ec2) C:\Movies\Wag The Dog.iso generates -1e3e89c7 (should generate 30d882a2) Help! - Fiasco - 2009-09-23 OK I've gotten closer!!! It returns some values correctly! Some are not. Any suggestions I'll gratefully accept!! FindCRC( "C:\Movies\Wag The Dog.iso" ); returns 30d882a2 (CORRECT!) FindCRC( "C:\Movies\The Wedding Singer.iso"); returns 4bbcf3ea (CORRECT!) FindCRC("C:\Movies\Singles.iso"); returns 405f3ec2 (CORRECT!) FindCRC("C:\Movies\The Adventures of Ford Fairlane.iso"); returns -a2a374c (WRONG!) FindCRC("C:\Movies\Identity.iso"); returns -6ed4f2f4 (WRONG!); Code: Number.prototype.unsign = function(bytes) { - Fiasco - 2009-09-23 sooo close argghhhhh - Fiasco - 2009-09-23 HOOORAY!!!!! How to convert the path + filename to the CRC code for thumbnails in javascript. Call from javascript: var thumbcrc = FindCRC( "C:\Movie\Adventures Of Ford Fairlane.iso"); Code: Number.prototype.unsign = function(bytes) { - kevbrown - 2009-11-19 I'm wanting to do the same thing in PHP. I want to do some tinkering with a web based library editor, but I can't for the life of me figure this out. There's a crc32 function within PHP, but that doesn't return the right value, so I wrap dechex to convert to hex, still no dice. Based on what I "think" your function is doing, I'm then performing this on the lower case string. Also - what path does it use, the full path to the file, just the file name? How does it work with stacked items? Have you tried that? - Fiasco - 2009-11-19 full path to the filename as in the example - tjpoe - 2009-12-18 did you ever figure this out in PHP? i'm trying to do the same thing. tried : crc32 ( $path . $file ). also tried dechex( crc32( $path . $file ) ) but both were a no go. - forumReader - 2010-03-21 Fiasco Wrote:HOOORAY!!!!! Hi, very great job done. but when i try the exambles on xbmc:wiki- Thumbnails, some get the wrong hash. I tried some from my own and 2 did not work. 123456789 returns 376e6e7 should return: 0376e6e7 F:\Videos\Nosferatu.avi returns 2a6ec78d -> correct smb://user:pass@server/share/directory/ returns c5559f13 -> correct smb://user:pass@server/share/directory/file.ext retutns 8ce36055 -> correct im trying to fix it but its very hard.. on smb:// devices it works fine: smb://data:data@michi_lap/e/musik/paul kalkbrenner - berlin calling bonus/01 aaron.mp3 should return: 20ae3cc1 but on local device: e:\musik\paul kalkbrenner - berlin calling bonus\01 aaron.mp3 it returns: c8caa9e4 but should return: 614b6c10 some other examble: e:\\musik\\clueso - gute musik\\clueso - gute musik - 15 - vergessen ist so leicht - maskulin.mp3 returns: c17f5fd6 should return: e09ff0ca ore did id did something wrong? - forumReader - 2010-03-21 Found the error: (by reading in the xbmc:wiki) the thumbnail is often generated by the folder name (if you use folder.jpg). but in some cases the thumbnail is extra created for files to. - Nick8888 - 2010-11-15 PHP Version - http://forum.xbmc.org/showthread.php?tid=85445 - baderj - 2012-02-27 forumReader Wrote:123456789 returns 376e6e7 The function Code: CRC.toString(16); Here's the revised Code: Code: Number.prototype.unsign = function(bytes) { |