Hi,

On 24.01.2011 01:13, Jason Tackaberry wrote:
> On Sun, 2011-01-23 at 14:08 +0100, Dirk Meyer wrote:
>> Add file hash based on calculations from
>> http://trac.opensubtitles.org/projects/opensubtitles/wiki/HashSourceCodes
> 
> Based on the description in the URL, this code is wrong:
> 
>> +            filehash = 0
>> +            if filesize >= 65536 * 2:
>> +                filehash = filesize
>> +                [...]
> 
> That site says:
> 
>         In natural language it calculates: size + 64bit chksum of the
>         first and last 64k (even if they overlap because the file is
>         smaller than 128k)
> 
> Your implementation computes a 0 hash if the file size is less than
> 128k.  But then the Python implementation at that page (which makes me
> bleed from the eyeballs) returns "SizeError" (!!!) in this case too.

My implementation is the one from the side without the things that made
both our eyeballs bleed. That is why I returned 0 which is at least a
number. I did not look much at the code, I only tried the sample file
and was happy. The reason I added the code is that themoviedb has
support to detect the movie based on the hash -- but both files I tried
gave no result. But hey, it is a new feature on the side, let's wait
some weeks and see what will happen.

> So I find myself more than a little irritated having read this page,
> trying to understand how to implement this.  I mean, I realize they're
> not writing software to launch shuttles into space here, but bloody
> hell, a _little_ more rigor would be nice for people like us who are
> trying to make a compatible implementation.

Well, I guess they do not have corner case files. And unlike us they
only use it for videos. But since we already have the code, I added it
to all files. Maybe it is needed later, maybe not.

> Ok, I'm done ranting.  I feel better. 

:)

> I've modified kaa.metadata's
> implementation to handle files less than 128k so the first and second
> hashes will overlap, and for files less than 64k, it will read as many
> full 64-bit values until it reaches EOF.  This makes it work like the
> first C implementation if the unsigned fsize problem were fixed.

Thanks.

But BTW, right now I'm playing with kaa.webmetadata which was the reason
I started coding again. Expect more kaa and Freevo code soon.


Dischi

-- 
Time is the best teacher. Unfortunately it kills all its students.

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to