Re: [bitpim-cvs-checkins] bitpim midifile.py,NONE,1.1 fileinfo.py,1.11,1.12
"Roger Binns" <[email protected]>
| Newsgroups | gmane.comp.mobile.bitpim.devel |
|---|---|
| Message-ID | <001901c4fbaf$0aa57280$3501a8c0@rogersqyvr14d3> |
> + # locate the 1st sync frame > + found_sync=False > + while offset<(f.size/2): > + # if we can't find it half way into the file, it ain't there The reason I didn't take that approach was because I wanted to mainly deal with correct MP3 files (ie without gratuitious junk at the begining). The more you ignore, the more likely you skip over something erroneously. That said, why does ffmpeg put zeroes at the begining? > - if f.GetByte(self.nextoffset)!=0xff: > + b=f.GetByte(self.nextoffset) > + if b is not None and b!=0xff: > + if __debug__: > + print 'Out of sync, backing up 1 byte' Is the backing up one byte still needed as you fixed the other frame length bugs? > --- NEW FILE: midifile.py --- > ### BITPIM > ### > ### Copyright (C) 2005 Roger Binns <[email protected]> I think you'll find I don't have any copyright on that file :-) > def __get_time_delta(self): > return self.__time_delta > time_delta=property(fget=__get_time_delta) As a stylistic issue there is no need for code like that. Just name the variable self.time_delta. You can make it a property in the future without affecting any calling code. It is also generally not recommended to use double underscores unless you expect derived classes to want to create something with the same name. I presume a variant of the code could also be used to do clipping of midi files, although that isn't very high up on the priority list. Roger ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt