From fd963ac9edb96cbcf3fa2ad9e390ea3dcd2fb954 Mon Sep 17 00:00:00 2001 From: Artem Baguinski Date: Fri, 18 Apr 2008 13:06:00 +0200 Subject: [PATCH] fixed writing: create iTunes{SD,Stats}_track records need these to easily access make_default of individual records --- shuffle.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/shuffle.py b/shuffle.py index 59c53d8..c03faeb 100644 --- a/shuffle.py +++ b/shuffle.py @@ -14,13 +14,7 @@ from records import * READ = 'rb' WRITE = 'w+b' -iTunesSD = Record([ - Record([ - Field(Uint24(), 'len(tracks)'), - Field(Uint24(), const = 0x010800), - Field(Uint24(), '%reclen%', check = True), - Skip(9)]), - ListField('tracks', Record([ +iTunesSD_track = Record([ Field(Uint24(), '%reclen%', check = True), Skip(3), Field(Uint24(), 'starttime', default = 0), @@ -34,19 +28,29 @@ iTunesSD = Record([ Field(ZeroPaddedString(522, 'UTF-16-LE'), 'filename'), Field(Bool8(), 'shuffleflag'), Field(Bool8(), 'bookmarkflag'), - Skip(1)]))], - BIG_ENDIAN) + Skip(1)]) -iTunesStats = Record([ +iTunesSD = Record([ Record([ - Field( Uint24(), 'len(tracks)'), - Skip(3)]), - ListField('tracks', Record([ + Field(Uint24(), 'len(tracks)'), + Field(Uint24(), const = 0x010800), + Field(Uint24(), '%reclen%', check = True), + Skip(9)]), + ListField('tracks', iTunesSD_track)], + BIG_ENDIAN) + +iTunesStats_track = Record([ Field( Uint24(), '%reclen%', check = True), Field( Int24(), 'bookmarktime', default = -1), Skip(6), Field( Uint24(), 'playcount', default = 0), - Field( Uint24(), 'skippedcount', default = 0)]))], + Field( Uint24(), 'skippedcount', default = 0)]) + +iTunesStats = Record([ + Record([ + Field( Uint24(), 'len(tracks)'), + Skip(3)]), + ListField('tracks', iTunesStats_track)], LITTLE_ENDIAN) # Here I disagree with the format from URL, but I'm not sure about nothing -- 2.11.4.GIT