Re: bitpim-cvs-checkins digest, Vol 1 #630 - 6 msgs
Todd Imboden <[email protected]>
| Newsgroups | gmane.comp.mobile.bitpim.devel |
|---|---|
| Message-ID | <[email protected]> |
Stephen, since you started with the amsregistry with packets I added a few lines to your amsanalyze that would get rid of the code I made to get the ringtones without the packet descriptions.... here's the diff.... it removes the need for the getamsindices and the getamstext
com_samsungspha620.py.diff
(application/octet-stream, 3.7 KB)
Index: com_samsungspha620.py
===================================================================
RCS file: /cvsroot/bitpim/bitpim/com_samsungspha620.py,v
retrieving revision 1.19
diff -r1.19 com_samsungspha620.py
49c49
< #self.amsanalyze()
---
> self.amsanalyze(results)
75c75
< def amsanalyze(self):
---
> def amsanalyze(self,results):
78a79,80
> rt={} #Todd added for ringtone index
> j=0 #Todd added for ringtone index
93c95
< downloaddomain_ptr=ams.info[i].downloaddomain_ptr
---
> #downloaddomain_ptr=ams.info[i].downloaddomain_ptr
95,97c97,99
< if downloaddomainptr_ptr:
< print self.getstring(ams.strings,misc_ptr)
< print ams.info[i].num2,ams.info[i].num6, ams.info[i].num7, ams.info[i].num8, ams.info[i].num9, ams.info[i].num12, ams.info[i].num13, ams.info[i].num14, ams.info[i].num15, ams.info[i].num16, ams.info[i].num17
---
> #if downloaddomainptr_ptr:
> # print self.getstring(ams.strings,misc_ptr)
> print ams.info[i].num2, ams.info[i].num7, ams.info[i].num8, ams.info[i].num9, ams.info[i].num12, ams.info[i].num13, ams.info[i].num14, ams.info[i].num15, ams.info[i].num16, ams.info[i].num17
98a101,114
>
> # Todd's added info
> if filetype==12: #this will add the file extension
> if mimetype=="audio/vnd.qcelp":
> filetype='.qcp'
> elif mimetype=="audio/midi":
> filetype='.mid'
> elif mimetype=="application/x-pmd":
> filetype='.pmd'
> else:
> filetype=''
> rt[j]={'name':name+filetype,'location':'ams/'+dir,'origin':'ringers'}
> j+=1
> results['ringtone-index']=rt
205,233d220
< def getamsindices(self, results):
< info_offset=900
< label_offset=14420
< contents=self.getfilecontents(self.__ams_index_file)
< records=ord(contents[37424]) #this tells how many records there are in the ams file
< offset=0
< rt={}
< j=0
< for i in range(records):
< info=struct.unpack('8hl8h',contents[info_offset+offset:info_offset+offset+36])
< if info[9]==12: #ringtone file
< rt_name=self.getamstext(label_offset,info[2],contents)
< rt_dir='ams/'+self.getamstext(label_offset,info[0],contents)
< rt_type=self.getamstext(label_offset,info[10],contents)
< if rt_type=="audio/vnd.qcelp":
< rt_filetype='.qcp'
< elif rt_type=="audio/midi":
< rt_filetype='.mid'
< elif rt_type=="application/x-pmd":
< rt_filetype='.pmd'
< else:
< rt_filetype=''
< rt_file=rt_name+rt_filetype
< rt[j]={'name':rt_file,'location':rt_dir,'origin':'ringers'}
< j+=1
< offset+=36
< results['ringtone-index']=rt
< return
<
241,251d227
< def getamstext(self, offset,location,contents): #this reads from the amsregistry file until it hits the spacer which is '00'
< length=1
< i=0
< while i==0:
< if common.hexify(contents[offset+location+length])=='00':
< i=1
< else:
< length+=1
< amstext=contents[offset+location:offset+location+length]
< return amstext
<
254d229
< self.getamsindices(results)