VX-4500 Voice Memos Working

Dustin <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <[email protected]>
I figured out why my Voice Memos were being saved on the phone as EVRC, I had a few on there that I had recorded in the middle of a phone call, and the call was placed with EVRC so it saved it as those. If you do a normal voice memo, it saves as QCELP. I added the code to download the voice memos from the phone when you get the ringtones and then convert it. I have it convert to MP3 but it could be changed to WAV like the code for the 4650 does. Here is the diff for com_lgvx4500.py
   
    RCS file: /cvsroot/bitpim/bitpim/com_lgvx4500.py,v
  retrieving revision 1.15
  diff -u -r1.15 com_lgvx4500.py
  --- com_lgvx4500.py 6 Oct 2005 00:26:29 -0000 1.15
  +++ com_lgvx4500.py 21 Dec 2005 02:28:47 -0000
  @@ -17,11 +17,16 @@
  import time
  import cStringIO
  import sha
  +import re
  +import sys
  +import os
  
  # my modules
  import common
  import copy
  +import conversions
  import p_lgvx4500
  +import p_brew
  import com_lgvx4400
  import com_brew
  import com_phone
  @@ -47,21 +52,24 @@
  ( 50, "download/dloadindex/brewRingerIndex.map", "user/sound/ringer", "ringers", 30),
  )
  
  - builtinimages= ('Foliage', 'Castle', 'Dandelion', 'Golf course', 'Icicles', 
  - 'Orangutan', 'Lake', 'Golden Gate', 'Desert')
  + builtinimages={ 80: ('Foliage', 'Castle', 'Dandelion', 'Golf course', 'Icicles', 
  + 'Orangutan', 'Lake', 'Golden Gate', 'Desert') }
  
  - builtinringtones= ('Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'Ring 6',
  - 'Ring 7', 'Ring 8', 'Annen Polka', 'Pachelbel Canon', 
  - 'Hallelujah', 'La Traviata', 'Leichte Kavallerie Overture', 
  - 'Mozart Symphony No.40', 'Bach Minuet', 'Farewell', 
  - 'Mozart Piano Sonata', 'Sting', 'O solemio', 
  - 'Pizzicata Polka', 'Stars and Stripes Forever', 
  - 'Pineapple Rag', 'When the Saints Go Marching In', 'Latin', 
  - 'Carol 1', 'Carol 2', 'Chimes high', 'Chimes low', 'Ding', 
  - 'TaDa', 'Notify', 'Drum', 'Claps', 'Fanfare', 'Chord high', 
  - 'Chord low') 
  - 
  + builtinringtones={ 1: ('Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'Ring 6',
  + 'Ring 7', 'Ring 8', 'Annen Polka', 'Pachelbel Canon', 
  + 'Hallelujah', 'La Traviata', 'Leichte Kavallerie Overture', 
  + 'Mozart Symphony No.40', 'Bach Minuet', 'Farewell', 
  + 'Mozart Piano Sonata', 'Sting', 'O solemio', 
  + 'Pizzicata Polka', 'Stars and Stripes Forever', 
  + 'Pineapple Rag', 'When the Saints Go Marching In', 'Latin', 
  + 'Carol 1', 'Carol 2'), 
  + 100: ( 'Chimes high', 'Chimes low', 'Ding', 
  + 'TaDa', 'Notify', 'Drum', 'Claps', 'Fanfare', 'Chord high', 
  + 'Chord low')
  + }
  
  + VoiceMemoDir='VoiceDB/All/Memos'
  +
  def __init__(self, logtarget, commport):
  com_lgvx4400.Phone.__init__(self,logtarget,commport)
  self.mode=self.MODENONE
  @@ -72,6 +80,90 @@
  #e.unknown20c="\x00\x00\x00\x00\x00\x31\x02"
  return e
  
  + def getmediaindex(self, builtins, maps, results, key):
  + """Gets the media (wallpaper/ringtone) index
  +
  + @param builtins: the builtin list on the phone
  + @param results: places results in this dict
  + @param maps: the list of index files and locations
  + @param key: key to place results in
  + """
  + media=com_lgvx4400.Phone.getmediaindex(self, (), maps, results, key)
  +
  + # builtins
  + for k,e in builtins.items():
  + c=k
  + for name in e:
  + media[c]={ 'name': name, 'origin': 'builtin' }
  + c+=1
  + # voice memos index
  + if key=='ringtone-index':
  + try:
  + vmemo_files=self.listfiles(self.VoiceMemoDir)
  + self.log(vmemo_files)
  + keys=vmemo_files.keys()
  + self.log(keys)
  + keys.sort()
  + _idx_cnt=210
  + for k in keys:
  + if k.endswith('.qcp'):
  + num_str=k[-8:-4]
  + media[_idx_cnt]={ 'name': 'VoiceMemo'+num_str,
  + 'origin': 'voicememo' }
  + self.log(media[_idx_cnt])
  + _idx_cnt+=1
  + except:
  + if __debug__:
  + raise
  + return media
  +
  + # Ringtone stuff------------------------------------------------------------
  + def getringtones(self, result):
  + result=com_lgvx4400.Phone.getringtones(self, result)
  + if not conversions.helperavailable('pvconv'):
  + return result
  + media=result['ringtone']
  + # get& convert the voice memo files
  + _qcp_file=common.gettempfilename('qcp')
  + _wav_file=common.gettempfilename('wav')
  + try:
  + vmemo_files=self.listfiles(self.VoiceMemoDir)
  + keys=vmemo_files.keys()
  + for k in keys:
  + if k.endswith('.qcp'):
  + key_name='VoiceMemo'+k[-8:-4]
  + file(_qcp_file, 'wb').write(self.getfilecontents(k, True))
  + conversions.convertqcptowav(_qcp_file, _wav_file)
  + tmp_mp3=conversions.converttomp3(_wav_file, 24, 16000, 1)
  + _mp3_file=common.stripext(_qcp_file)+'.mp3'
  + file(_mp3_file, 'wb').write(tmp_mp3)
  + media[key_name]=file(_mp3_file, 'rb').read()
  + except:
  + if __debug__:
  + raise
  + try:
  + os.remove(_qcp_file)
  + os.remove(_wav_file)
  + os.remove(_mp3_file)
  + except:
  + pass
  + result['ringtone']=media
  + return result
  +
  + def saveringtones(self, results, merge):
  + _new_ringtones=results.get('ringtone', {})
  + _rt_index=results.get('ringtone-index', {})
  + # list of voicememo names
  + _voice_memo_l=[x['name'] for k,x in _rt_index.items() \
  + if x.get('origin', '')=='voicememo']
  + # list of media to delete
  + _del_keys=[k for k,x in _new_ringtones.items() \
  + if x.get('name', None) in _voice_memo_l]
  + for k in _del_keys:
  + del _new_ringtones[k]
  + results['ringtone']=_new_ringtones
  + return com_lgvx4400.Phone.saveringtones(self, results, merge)
  +
  my_model='VX4500'
  
  def getphoneinfo(self, phone_info):



Dustin Heimerl

AIM: hypercooljake
MSN: [email protected]
Cell Phone: (920)-915-7271
Email: [email protected] or [email protected]
http://www.uberprofile.info
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.