Posts: 26,215
Joined: Oct 2003
Reputation:
187
It may be that the code in the wiki is incorrect (though I'd be surprised). Basically we have a utf8 string, we lower case it (assuming ascii), and then crc32. There's a bunch of different ways to do crc32 (seed, methods etc.).
Cheers,
Jonathan
Posts: 3,077
Joined: Jun 2009
The wiki code for Hash calculation is OK, I've updated it some times ago to correct bugs.
The main problem is to find what XBMC will use to do the calculation
And for image no luck they use another system
(Remark : half of the things for calculation are exception needing code reading to find :p )
Quote:CStdString CTextureCache::GetImageHash(const CStdString &url) const
299 {
300 struct __stat64 st;
301 if (CFile::Stat(url, &st) == 0)
302 {
303 int64_t time = st.st_mtime;
304 if (!time)
305 time = st.st_ctime;
306 if (time || st.st_size)
307 {
308 CStdString hash;
309 hash.Format("d%"PRId64"s%"PRId64, time, st.st_size);
310 return hash;
311 }
312 }
313 CLog::Log(LOGDEBUG, "%s - unable to stat url %s", __FUNCTION__, url.c_str());
314 return "";
315 }
Since i don't use image in my software i don't have c# equivalent but you should be able to convert.
The main problem will be to access the file to be able to stats the files
You should check the Textures.db if you use a recent XBMC since it seems it contains the correct data.
Posts: 26,215
Joined: Oct 2003
Reputation:
187
That is not the hash that you're looking for.
See the GetCacheFile or some such in the same .cpp.
Posts: 26,215
Joined: Oct 2003
Reputation:
187
Unless you update the database, XBMC will re-cache those images either way.
Posts: 51
Joined: May 2010
Reputation:
0
OK, imagehash is also solved, it takes the format d<seconds_since_epoch_of_file_modified>d<file_size_in_bytes>
@jmarshall: I have tons of pictures on network drive, and when browse to them it takes ages for my ATV to create&display thumbnails. So I decided, to make a batch procedure, which I'd run during the night and get all my thumbs ready to display.