def ReplaceContents(self, name, origin, new_file_name):
     """Replace the contents of 'file_name' by the contents of
     'new_file_name' by going through the image converter dialog
     """
     file_stat=os.stat(new_file_name)
     mtime=file_stat.st_mtime
     afi=fileinfo.identify_audiofile(new_file_name)
     if afi.size<=0:
         return # zero length file or other issues
     newext,convertinfo=self.mainwindow.phoneprofile.QueryAudio(
         None, common.getext(new_file_name), afi)
     if convertinfo is not afi:
         filedata=None
         try:
             filedata=self.ConvertFormat(new_file_name, convertinfo)
         except:
             pass
         if filedata is None:
             return
     else:
         filedata=open(new_file_name, "rb").read()
     max_size=getattr(convertinfo, 'MAXSIZE', None)
     if max_size is not None and len(filedata)>max_size:
         self.log('ringtone %s is too big!'%common.basename(file))
         dlg=wx.MessageDialog(self,
                              'Ringtone %s may be too big.  Do you want to proceed anway?'%common.basename(file),
                              'Warning',
                              style=wx.YES_NO|wx.ICON_ERROR)
         dlg_resp=dlg.ShowModal()
         dlg.Destroy()
         if dlg_resp==wx.ID_NO:
             return
     self.AddToIndex(name, origin, filedata, self._data, mtime)
示例#2
0
 def _add_files(self, index_key, media_key, media_path,
                new_list, fundamentals):
     """Add new file using OBEX"""
     _index=fundamentals.get(index_key, {})
     _media=fundamentals.get(media_key, {})
     _adding_ringtones=index_key=='ringtone-index'
     for _file in new_list:
         _data=self._item_from_index(_file, 'data', _media)
         if not _data:
             self.log('Failed to write file %s due to no data'%_file)
             continue
         if self._item_from_index(_file, None, _index) is None:
             # new file
             _name=_file
             if _adding_ringtones and \
                common.getext(_name).lower()=='mp3':
                 # need to adjust the file name since this model only
                 # accepts qcp and mid files (AFAIK).
                 _name='%s.mid'%common.stripext(_name)
             _file_name='%(pathname)s/%(filename)s'% \
                         { 'pathname': media_path,
                           'filename': _name }
             try:
                 self.obex.writefile(_file_name, _data)
             except:
                 self.log('Failed to write OBEX file '+_file_name)
                 if __debug__:
                     raise
示例#3
0
 def _add_files(self, index_key, media_key, media_path, new_list,
                fundamentals):
     """Add new file using OBEX"""
     _index = fundamentals.get(index_key, {})
     _media = fundamentals.get(media_key, {})
     _adding_ringtones = index_key == 'ringtone-index'
     for _file in new_list:
         _data = self._item_from_index(_file, 'data', _media)
         if not _data:
             self.log('Failed to write file %s due to no data' % _file)
             continue
         if self._item_from_index(_file, None, _index) is None:
             # new file
             _name = _file
             if _adding_ringtones and \
                common.getext(_name).lower()=='mp3':
                 # need to adjust the file name since this model only
                 # accepts qcp and mid files (AFAIK).
                 _name = '%s.mid' % common.stripext(_name)
             _file_name='%(pathname)s/%(filename)s'% \
                         { 'pathname': media_path,
                           'filename': _name }
             try:
                 self.obex.writefile(_file_name, _data)
             except:
                 self.log('Failed to write OBEX file ' + _file_name)
                 if __debug__:
                     raise
 def make_new_media_entry(self, entry, index, type):
     c=self.protocolclass.content_entry()
     e=self.protocolclass.content_entry()
     name=common.stripext(entry['name'])
     ext=common.getext(entry['name'])
     data=entry.get("data", None)
     add_to_index='index'
     c.type='!C'
     c.index1=index
     c.name1=name
     try:
         c.mime_type=self.__mimetype[ext]
     except:
         add_to_index='none'
         return c, e, add_to_index
     if c.mime_type=='application/java-archive':
         c.content_type='Games'
         e.location_maybe='midlet:'+name
         add_to_index='content'
     elif type=='ringers':
         c.content_type='Ringers'
     else:
         c.content_type='Screen Savers'
     c.size=`((3024+len(data))/1008)*1008`
     e.type='!E'
     e.index2=index
     e.name2=name
     return c, e, add_to_index
示例#5
0
文件: ringers.py 项目: deosai/bitpim
 def ReplaceContents(self, name, origin, new_file_name):
     """Replace the contents of 'file_name' by the contents of
     'new_file_name' by going through the image converter dialog
     """
     file_stat=os.stat(new_file_name)
     mtime=file_stat.st_mtime
     afi=fileinfo.identify_audiofile(new_file_name)
     if afi.size<=0:
         return # zero length file or other issues
     newext,convertinfo=self.mainwindow.phoneprofile.QueryAudio(
         None, common.getext(new_file_name), afi)
     if convertinfo is not afi:
         filedata=None
         try:
             filedata=self.ConvertFormat(new_file_name, convertinfo)
         except:
             pass
         if filedata is None:
             return
     else:
         filedata=open(new_file_name, "rb").read()
     # check for the size limit on the file, if specified
     max_size=getattr(convertinfo, 'MAXSIZE', None)
     if max_size is not None and len(filedata)>max_size:
         # the data is too big
         self.log('ringtone %s is too big!'%common.basename(file))
         with guihelper.WXDialogWrapper(wx.MessageDialog(self,
                                                         'Ringtone %s may be too big.  Do you want to proceed anway?'%common.basename(file),
                                                         'Warning',
                                                         style=wx.YES_NO|wx.ICON_ERROR),
                                        True) as (dlg, dlg_resp):
             if dlg_resp==wx.ID_NO:
                 return
     self.AddToIndex(name, origin, filedata, self._data, mtime)
 def makegcd(self, filename,size,mimetable):
     "Build a GCD file for filename"
     ext=common.getext(filename.lower())
     try:
         mimetype=mimetable[ext]
     except:
         return ""
     noextname=common.stripext(filename)
     gcdcontent="Content-Type: "+mimetype+"\nContent-Name: "+noextname+"\nContent-Version: 1.0\nContent-Vendor: BitPim\nContent-URL: file:"+filename+"\nContent-Size: "+`size`+"\n\n\n"
     return gcdcontent
 def makegcd(self,filename,size):
     "Build a GCD file for filename"
     ext=common.getext(filename.lower())
     noextname=common.stripext(filename)
     try:
         mimetype=self.__mimetype[ext]
         gcdcontent="Content-Type: "+mimetype+"\nContent-Name: "+noextname+"\nContent-Version: 1.0\nContent-Vendor: BitPim\nContent-URL: file://"+filename+"\nContent-Size: "+`size`+"\nContent-Description: Content for V10044 LG PM225"+"\n\n\n"
     except:
         gcdcontent="Content-Name: "+noextname+"\nContent-Version: 1.0\nContent-Vendor: BitPim\nContent-URL: file://"+filename+"\nContent-Size: "+`size`+"\n\n\n"
     return gcdcontent
 def _getmimetype(self, name):
     ext=common.getext(name.lower())
     if len(ext): ext="."+ext
     if ext==".jpeg":
         return "image/jpg" # special case
     for mt,extension in self.__mimetoextensionmapping.items():
         if ext==extension:
             return mt
     self.log("Unable to figure out a mime type for "+name)
     assert False, "No idea what type "+ext+" is"
     return "x-unknown/x-unknown"
示例#9
0
 def _getmimetype(self, name):
     ext = common.getext(name.lower())
     if len(ext): ext = "." + ext
     if ext == ".jpeg":
         return "image/jpg"  # special case
     for mt, extension in self.__mimetoextensionmapping.items():
         if ext == extension:
             return mt
     self.log("Unable to figure out a mime type for " + name)
     assert False, "No idea what type " + ext + " is"
     return "x-unknown/x-unknown"
示例#10
0
    def makegcd(self, filename, size, mimetable):
        "Build a GCD file for filename"
        ext = common.getext(filename.lower())
        try:
            mimetype = mimetable[ext]
        except:
            return ""

        noextname = common.stripext(filename)
        gcdcontent = "Content-Type: " + mimetype + "\nContent-Name: " + noextname + "\nContent-Version: 1.0\nContent-Vendor: BitPim\nContent-URL: file:" + filename + "\nContent-Size: " + ` size ` + "\n\n\n"
        return gcdcontent
 def OnLaunch(self, _):
     item=self.GetSelectedItems()[0]
     temp=common.gettempfilename(common.getext(item.name))
     me=self._data[self.database_key][item.key]
     f=open(temp, "wb")
     f.write(me.mediadata)
     f.close()
     if guihelper.IsMac():
         import findertools
         findertools.launch(temp)
         return
     cmd=guihelper.GetOpenCommand(item.mimetypes, temp)
     if cmd is None:
         wx.Bell()
     else:
         wx.Execute(cmd, wx.EXEC_ASYNC)
	def makejad(self,filename,size):

        "Build a JAD file for filename"

        ext=common.getext(filename.lower())

        noextname=common.stripext(filename)

        jadcontent="MIDlet-1: "+noextname+", "+noextname+".png, BitPim\nMIDlet-Jar-Size: "+`size`+"\nMIDlet-Jar-URL: "+filename+"\nMIDlet-Name: "+noextname+"\nMIDlet-Vendor: Unknown\nMIDlet-Version: 1.0\nMicroEdition-Configuration: CLDC-1.0\nMicroEdition-Profile: MIDP-1.0\nContent-Folder: Games\n\n\n"

        return jadcontent

	brew_version_file='ams/version.txt'
	    brew_version_txt_key='ams_version.txt'
	    my_model='PM225'
	    def getphoneinfo(self, phone_info):
示例#13
0
文件: ringers.py 项目: deosai/bitpim
 def OnAddFiles(self, filenames):
     for file in filenames:
         if file is None: continue  # failed dragdrop?
         file_stat=os.stat(file)
         mtime=file_stat.st_mtime
         if self._raw_media:
             target=self.get_media_name_from_filename(file)
             data=open(file, 'rb').read()
             self.AddToIndex(target, self.active_section, data, self._data, mtime)
         else:
             # do we want to convert file?
             afi=fileinfo.identify_audiofile(file)
             if afi.size<=0: continue # zero length file or other issues
             newext,convertinfo=self.mainwindow.phoneprofile.QueryAudio(None, common.getext(file), afi)
             if convertinfo is not afi:
                 filedata=None
                 wx.EndBusyCursor()
                 try:
                     filedata=self.ConvertFormat(file, convertinfo)
                 finally:
                     # ensure they match up
                     wx.BeginBusyCursor()
                 if filedata is None:
                     continue
             else:
                 filedata=open(file, "rb").read()
             # check for the size limit on the file, if specified
             max_size=getattr(convertinfo, 'MAXSIZE', None)
             if max_size is not None and len(filedata)>max_size:
                 # the data is too big
                 self.log('ringtone %s is too big!'%common.basename(file))
                 with guihelper.WXDialogWrapper(wx.MessageDialog(self,
                                                                 'Ringtone %s may be too big.  Do you want to proceed anway?'%common.basename(file),
                                                                 'Warning',
                                                                 style=wx.YES_NO|wx.ICON_ERROR),
                                                True) as (dlg, dlg_resp):
                     if dlg_resp==wx.ID_NO:
                         continue
             target=self.get_media_name_from_filename(file, newext)
             self.AddToIndex(target, self.active_section, filedata, self._data, mtime)
     self.OnRefresh()
示例#14
0
 def OnAddFiles(self, filenames):
     for file in filenames:
         if file is None: continue  # failed dragdrop?
         file_stat=os.stat(file)
         mtime=file_stat.st_mtime
         if self._raw_media:
             target=self.get_media_name_from_filename(file)
             data=open(file, 'rb').read()
             self.AddToIndex(target, self.active_section, data, self._data, mtime)
         else:
             # do we want to convert file?
             afi=fileinfo.identify_audiofile(file)
             if afi.size<=0: continue # zero length file or other issues
             newext,convertinfo=self.mainwindow.phoneprofile.QueryAudio(None, common.getext(file), afi)
             if convertinfo is not afi:
                 filedata=None
                 wx.EndBusyCursor()
                 try:
                     filedata=self.ConvertFormat(file, convertinfo)
                 finally:
                     # ensure they match up
                     wx.BeginBusyCursor()
                 if filedata is None:
                     continue
             else:
                 filedata=open(file, "rb").read()
             # check for the size limit on the file, if specified
             max_size=getattr(convertinfo, 'MAXSIZE', None)
             if max_size is not None and len(filedata)>max_size:
                 # the data is too big
                 self.log('ringtone %s is too big!'%common.basename(file))
                 with guihelper.WXDialogWrapper(wx.MessageDialog(self,
                                                                 'Ringtone %s may be too big.  Do you want to proceed anway?'%common.basename(file),
                                                                 'Warning',
                                                                 style=wx.YES_NO|wx.ICON_ERROR),
                                                True) as (dlg, dlg_resp):
                     if dlg_resp==wx.ID_NO:
                         continue
             target=self.get_media_name_from_filename(file, newext)
             self.AddToIndex(target, self.active_section, filedata, self._data, mtime)
     self.OnRefresh()
 def OnAddFiles(self, filenames):
     self.thedir=self.mainwindow.ringerpath
     for file in filenames:
         if file is None: continue  # failed dragdrop?
         if self._raw_media:
             decoded_file=self.decodefilename(file)
             target=self.getshortenedbasename(decoded_file)
             open(target, 'wb').write(open(file, 'rb').read())
             self.AddToIndex(str(os.path.basename(target)).decode(fileview.media_codec))
         else:
             afi=fileinfo.identify_audiofile(file)
             if afi.size<=0: continue # zero length file or other issues
             newext,convertinfo=self.mainwindow.phoneprofile.QueryAudio(None, common.getext(file), afi)
             if convertinfo is not afi:
                 filedata=None
                 wx.EndBusyCursor()
                 try:
                     filedata=self.ConvertFormat(file, convertinfo)
                 finally:
                     wx.BeginBusyCursor()
                 if filedata is None:
                     continue
             else:
                 filedata=open(file, "rb").read()
             max_size=getattr(convertinfo, 'MAXSIZE', None)
             if max_size is not None and len(filedata)>max_size:
                 self.log('ringtone %s is too big!'%common.basename(file))
                 dlg=wx.MessageDialog(self,
                                      'Ringtone %s may be too big.  Do you want to proceed anway?'%common.basename(file),
                                      'Warning',
                                      style=wx.YES_NO|wx.ICON_ERROR)
                 dlg_resp=dlg.ShowModal()
                 dlg.Destroy()
                 if dlg_resp==wx.ID_NO:
                     continue
             decoded_file=self.decodefilename(file)
             target=self.getshortenedbasename(decoded_file, newext)
             open(target, "wb").write(filedata)
             self.AddToIndex(str(os.path.basename(target)).decode(fileview.media_codec))
     self.OnRefresh()
 def makejad(self,filename,size):
     "Build a JAD file for filename"
     ext=common.getext(filename.lower())
     noextname=common.stripext(filename)
     jadcontent="MIDlet-1: "+noextname+", "+noextname+".png, BitPim\nMIDlet-Jar-Size: "+`size`+"\nMIDlet-Jar-URL: "+filename+"\nMIDlet-Name: "+noextname+"\nMIDlet-Vendor: Unknown\nMIDlet-Version: 1.0\nMicroEdition-Configuration: CLDC-1.0\nMicroEdition-Profile: MIDP-1.0\nContent-Folder: Games\n\n\n"
     return jadcontent
	def makegcd(self, filename,size,mimetable):

        "Build a GCD file for filename"

        ext=common.getext(filename.lower())

        try:

            mimetype=mimetable[ext]

        except:

            return ""

        noextname=common.stripext(filename)

        gcdcontent="Content-Type: "+mimetype+"\nContent-Name: "+noextname+"\nContent-Version: 1.0\nContent-Vendor: BitPim\nContent-URL: file:"+filename+"\nContent-Size: "+`size`+"\n\n\n"

        return gcdcontent

	def saveringtones(self, result, merge):

        dircache=self.DirCache(self)

        media_prefix=self.protocolclass.RINGERPREFIX

        endtransactionpath=self.protocolclass.ENDTRANSACTION

        media=result.get('ringtone', {})

        media_index=result.get('ringtone-index', {})

        media_names=[x['name'] for x in media.values()]

        index_names=[x['name'] for x in media_index.values()]

        if merge:

            del_names=[]

        else:

            del_names=[common.stripext(x) for x in index_names if x not in media_names]

            gcdpattern=re.compile("[\n\r]Content-Name: +(.*?)[\n\r]")

        new_names=[x for x in media_names if x not in index_names]

        progressmax=len(del_names)+len(new_names)

        progresscur=0

        self.log("Writing ringers")

        self.progress(progresscur, progressmax, "Writing ringers")

        for icnt in range(1,101):

            if not (new_names or del_names):

                break

            fname=media_prefix+`icnt`

            fnamegcd=media_prefix+`icnt`+".gcd"

            fstat=dircache.stat(fnamegcd)

            if del_names and fstat:

                gcdcontents=dircache.readfile(fnamegcd)

                thisfile=gcdpattern.search(gcdcontents).groups()[0]

                if thisfile in del_names:

                    self.log("Deleting ringer "+thisfile)

                    self.progress(progresscur, progressmax, "Deleting ringer "+thisfile)

                    progresscur+=1

                    dircache.rmfile(fname)

                    dircache.rmfile(fnamegcd)

                    del_names.remove(thisfile)

                    fstat=False

            if new_names and not fstat:

                newname=new_names.pop()

                contents=""

                for k in media.keys():

                    if media[k]['name']==newname:

                        contents=media[k]['data']

                        break

                contentsize=len(contents)

                if contentsize:

                    gcdcontents=self.makegcd(newname,contentsize,self.__audio_mimetype)

                    self.log("Writing ringer "+newname)

                    self.progress(progresscur, progressmax, "Deleting ringer "+newname)

                    progresscur+=1

                    dircache.writefile(fname,contents)

                    dircache.writefile(fnamegcd,gcdcontents)

        fstat=dircache.stat(endtransactionpath)

        self.log("Finished writing ringers")

        self.progress(progressmax, progressmax, "Finished writing ringers")

        if fstat:

            dircache.rmfile(endtransactionpath)

        result['rebootphone']=True

        return

	def savewallpapers(self, result, merge):

        dircache=self.DirCache(self)

        media_prefix=self.protocolclass.WALLPAPERPREFIX

        endtransactionpath=self.protocolclass.ENDTRANSACTION

        media=result.get('wallpapers', {})

        for i in media.keys():

            try:

                if media[i]['origin']=='camera':

                    del media[i]

            except:

                pass

        media_index=result.get('wallpaper-index', {})

        media_names=[x['name'] for x in media.values()]

        index_names=[x['name'] for x in media_index.values()]

        if merge:

            del_names=[]

        else:

            del_names=[common.stripext(x) for x in index_names if x not in media_names]

            gcdpattern=re.compile("[\n\r]Content-Name: +(.*?)[\n\r]")

        new_names=[x for x in media_names if x not in index_names]

        progressmax=len(del_names)+len(new_names)

        progresscur=0

        self.log("Writing images")

        self.progress(progresscur, progressmax, "Writing images")

        for icnt in range(1,101):

            if not (new_names or del_names):

                break

            fname=media_prefix+`icnt`

            fnamegcd=media_prefix+`icnt`+".gcd"

            fstat=dircache.stat(fnamegcd)

            if del_names and fstat:

                gcdcontents=dircache.readfile(fnamegcd)

                thisfile=gcdpattern.search(gcdcontents).groups()[0]

                if thisfile in del_names:

                    self.log("Deleting image "+thisfile)

                    self.progress(progresscur, progressmax, "Deleting image "+thisfile)

                    progresscur+=1

                    dircache.rmfile(fname)

                    dircache.rmfile(fnamegcd)

                    del_names.remove(thisfile)

                    fstat=False

            if new_names and not fstat:

                newname=new_names.pop()

                contents=""

                for k in media.keys():

                    if media[k]['name']==newname:

                        contents=media[k]['data']

                        break

                contentsize=len(contents)

                if contentsize:

                    gcdcontents=self.makegcd(newname,contentsize,self.__image_mimetype)

                    self.log("Writing image "+newname)

                    self.progress(progresscur, progressmax, "Deleting image "+newname)

                    progresscur+=1

                    dircache.writefile(fname,contents)

                    dircache.writefile(fnamegcd,gcdcontents)

        fstat=dircache.stat(endtransactionpath)

        self.log("Finished writing images")

        self.progress(progressmax, progressmax, "Finished writing images")

        if fstat:

            dircache.rmfile(endtransactionpath)

        result['rebootphone']=True

        return

	"Talk to a Samsung SPH-A620 phone"

class  Profile (com_samsung_packet.Profile) :
	protocolclass=Phone.protocolclass
	    serialsname=Phone.serialsname
	    MAX_RINGTONE_BASENAME_LENGTH=19
	    RINGTONE_FILENAME_CHARS="abcdefghijklmnopqrstuvwxyz0123456789_ ."
	    RINGTONE_LIMITS= {
        'MAXSIZE': 30000
    }
	    phone_manufacturer='SAMSUNG'
	    phone_model='SPH-A620/152'
	    def __init__(self):

        com_samsung_packet.Profile.__init__(self)

        self.numbertypetab=numbertypetab

	_supportedsyncs=(
        ('phonebook', 'read', None),  
        ('phonebook', 'write', 'OVERWRITE'),  
        ('wallpaper', 'read', None),  
        ('wallpaper', 'write', None), 
        ('ringtone', 'read', None),   
        ('ringtone', 'write', None),
        ('calendar', 'read', None),   
        ('calendar', 'write', 'OVERWRITE'),   
        ('todo', 'read', None),     
        ('todo', 'write', 'OVERWRITE'),  
        ('memo', 'read', None),     
        ('memo', 'write', 'OVERWRITE'),  
        )
	    __audio_ext={ 'MIDI': 'mid', 'PMD': 'pmd', 'QCP': 'qcp' }
	    def QueryAudio(self, origin, currentextension, afi):

        print "afi.format=",afi.format

        if afi.format in ("MIDI", "PMD", "QCP"):

            for k,n in self.RINGTONE_LIMITS.items():

                setattr(afi, k, n)

            return currentextension, afi

        d=self.RINGTONE_LIMITS.copy()

        d['format']='QCP'

        return ('qcp', fileinfo.AudioFileInfo(afi, **d))
	def make_new_media_entry(self, entry, index, type):

        c=self.protocolclass.content_entry()

        e=self.protocolclass.content_entry()

        name=common.stripext(entry['name'])

        ext=common.getext(entry['name'])

        data=entry.get("data", None)

        add_to_index='index'

        c.type='!C'

        c.index1=index

        c.name1=name

        try:

            c.mime_type=self.__mimetype[ext]

        except:

            add_to_index='none'

            return c, e, add_to_index

        if c.mime_type=='application/java-archive':

            c.content_type='Games'

            e.location_maybe='midlet:'+name

            add_to_index='content'

        elif type=='ringers':

            c.content_type='Ringers'

        else:

            c.content_type='Screen Savers'

        c.size=`((3024+len(data))/1008)*1008`

        e.type='!E'

        e.index2=index

        e.name2=name

        return c, e, add_to_index

	def makegcd(self,filename,size):

        "Build a GCD file for filename"

        ext=common.getext(filename.lower())

        noextname=common.stripext(filename)

        try:

            mimetype=self.__mimetype[ext]

            gcdcontent="Content-Type: "+mimetype+"\nContent-Name: "+noextname+"\nContent-Version: 1.0\nContent-Vendor: BitPim\nContent-URL: file://"+filename+"\nContent-Size: "+`size`+"\nContent-Description: Content for V10044 LG PM225"+"\n\n\n"

        except:

            gcdcontent="Content-Name: "+noextname+"\nContent-Version: 1.0\nContent-Vendor: BitPim\nContent-URL: file://"+filename+"\nContent-Size: "+`size`+"\n\n\n"

        return gcdcontent

	def makejad(self,filename,size):

        "Build a JAD file for filename"

        ext=common.getext(filename.lower())

        noextname=common.stripext(filename)

        jadcontent="MIDlet-1: "+noextname+", "+noextname+".png, BitPim\nMIDlet-Jar-Size: "+`size`+"\nMIDlet-Jar-URL: "+filename+"\nMIDlet-Name: "+noextname+"\nMIDlet-Vendor: Unknown\nMIDlet-Version: 1.0\nMicroEdition-Configuration: CLDC-1.0\nMicroEdition-Profile: MIDP-1.0\nContent-Folder: Games\n\n\n"

        return jadcontent

	brew_version_file='ams/version.txt'
	    brew_version_txt_key='ams_version.txt'
	    my_model='PM225'
	    def getphoneinfo(self, phone_info):

        self.log('Getting Phone Info')

        try:

            s=self.getfilecontents('ams/version.txt')

            if s[:5]==self.my_model:

                phone_info.append('Model:', self.my_model)

                phone_info.append('ESN:', self.get_brew_esn())

                req=p_brew.firmwarerequest()

                txt=self.getfilecontents("nvm/nvm/nvm_0000")[207:217]

                phone_info.append('Phone Number:', txt)

        except:

            pass

        return

	"Talk to the LG PM225 cell phone"
	def makegcd(self,filename,size):

        "Build a GCD file for filename"

        ext=common.getext(filename.lower())

        noextname=common.stripext(filename)

        try:

            mimetype=self.__mimetype[ext]

            gcdcontent="Content-Type: "+mimetype+"\nContent-Name: "+noextname+"\nContent-Version: 1.0\nContent-Vendor: BitPim\nContent-URL: file://"+filename+"\nContent-Size: "+`size`+"\nContent-Description: Content for V10044 LG PM225"+"\n\n\n"

        except:

            gcdcontent="Content-Name: "+noextname+"\nContent-Version: 1.0\nContent-Vendor: BitPim\nContent-URL: file://"+filename+"\nContent-Size: "+`size`+"\n\n\n"

        return gcdcontent

	def makejad(self,filename,size):

        "Build a JAD file for filename"

        ext=common.getext(filename.lower())

        noextname=common.stripext(filename)

        jadcontent="MIDlet-1: "+noextname+", "+noextname+".png, BitPim\nMIDlet-Jar-Size: "+`size`+"\nMIDlet-Jar-URL: "+filename+"\nMIDlet-Name: "+noextname+"\nMIDlet-Vendor: Unknown\nMIDlet-Version: 1.0\nMicroEdition-Configuration: CLDC-1.0\nMicroEdition-Profile: MIDP-1.0\nContent-Folder: Games\n\n\n"

        return jadcontent

	brew_version_file='ams/version.txt'
	    brew_version_txt_key='ams_version.txt'
	    my_model='PM225'
	    def getphoneinfo(self, phone_info):

        self.log('Getting Phone Info')

        try:

            s=self.getfilecontents('ams/version.txt')

            if s[:5]==self.my_model:

                phone_info.append('Model:', self.my_model)

                phone_info.append('ESN:', self.get_brew_esn())

                req=p_brew.firmwarerequest()

                txt=self.getfilecontents("nvm/nvm/nvm_0000")[207:217]

                phone_info.append('Phone Number:', txt)

        except:

            pass

        return

	"Talk to the LG PM225 cell phone"