Sony Ericsson W705 Renumbering

Posted: October 8, 2011 in Technical
Tags: ,

Like all Egyptians, I had to modify all my phone book to be in-sync with the new numbering domains. First of all I tried to download the tool provided by Vodafone Engezly, After installation I ran the phone book updater, and I got a very nice message “No Contacts Need To Be Changed” :D.

A friend told me about some desktop “Windows” tool to do the job, “EgyMobiED“, I followd the steps and after some hassle I managed to backup my contacts using Windows 7 Bluetooth devices, and searched my disk till I found where does Windows 7 store them(*.VCF format files) for further Restore operation.

I tried EgyMobiED and it did the job well, Now I have to get them back to my mobile, I deleted all my contacts using Sony Ericsson PC Companion Phone Contacts tool, and tried to restore the contacts using Windows 7 Bluetooth Devices Restore Backed-up contacts and found that I have to accept each contact on my mobile (pressing accept and minimize per each contact) and I have 385 one ! :S, Moreover it failed multiple times  and I had to restart the operation and uncheck the restored contacts, So it was just like a nightmare!

I googled and found some Sony Ericsson tool called Sync Phones which requires Windows Contacts (*.CONTACT format files), So I imported my *.VCF files into Windows Contacts, and smoothly synchronized my  mobile with Windows Contacts.

Now I have all my contacts again on phone, But I found a new problem!!! 😀

My problem was historical to some extent, Since I migrated from Nokia mobile 2 years ago using the same technique (Windows 7 Bluetooth Devices tools), the imported contacts was in that format:

BEGIN:VCARD
VERSION:2.1
N;CHARSET=UTF-8:Foo;
FN;CHARSET=UTF-8:Bar
TEL:0123456789
X-IRMC-LUID:0002000004F4
END:VCARD

The Number filed was like that (TEL:0123456789), which Windows Contacts did not recognize in importing from VCF format to CONTACT format .

So I had to replace all my VCF contacts to Windows Contacts recognizable format by replacing all “TEL:” with “TEL;CELL”, So it is time for Python 😀

I quickly wrote this snippet and managed to convert my number field to recognizable one and re-synchronized my phone again, and IT WORKS 😀

'''
Created on Oct 8, 2011

@author: arefaey
'''
import os
src = '/home/arefaey/Desktop/src'
dest = '/home/arefaey/Desktop/dest'
inputs  = os.listdir(src)
outputs = os.listdir(dest)
for contact in inputs:
    f = os.path.join(src, contact)
    f = open(f, 'r')
    o = os.path.join(dest, contact)
    o = open(o, 'w')
    for line in f.readlines():
        line = line.replace('TEL:', 'TEL;CELL:')
        o.writelines(line)
        o.flush()
    print 'Contact : %s is done' % contact

Now all contacts turned into this format:

BEGIN:VCARD
VERSION:2.1
N;CHARSET=UTF-8:Foo;
FN;CHARSET=UTF-8:Bar
TEL;CELL:0123456789
X-IRMC-LUID:0002000004F4
END:VCARD

For sure I had some victims when a VCF file contains both “TEL:” and “TEL;CELL:” so after refactoring I had duplicate CELL fields and the mobile just recognized the first, isA I will implement a new snipped to resolve this issue :D.

Thanks Ayman for your nice tool.

Advertisements
Comments
  1. Aiman Tarek says:

    hello Ahmed,
    I think this too much to do a simple task… you had one of 2 options

    #1 using windows contacts
    connect the phone via bluetooth or use the cable, open Sony Ericsson PC companion, choose sync phone, check contacts, advanced -> “replace PC content with phone content”, then use the tool, resync but choose “replace phone content with PC content”
    this option make use of windows “.contact” files, but any number placed in “other” on your phone isn’t recognized as a number in “.contact” file

    #2 using a simple trick
    connect your phone, open Sony Ericsson PC companion, choose “Phone Contacts”, wait for it to load all mobile contacts then go to
    C:\Users\Aiman\AppData\Local\Sony Ericsson\Sony Ericsson PC Companion\some number\Sync\SyncML
    copy “contacts.txt” to any folder, change extension to “.vcf” and pleae don’t open it you’ll have to close N number of windows as many as you contacts
    now modify the VCF file get it back to your mobile, but not sure how your device will deal with such a file

    good luck and thanks for sharing this experience with me 🙂

  2. Montaro says:

    Thanks Ayman,
    The much effort was really to refactor all my contacts number from the “other” field to “Cell” one, which needed some Python intervention after converting them to “.contact” format.

  3. At a shell prompt:
    for FILE in $(ls src/); do sed ‘s/TEL:/TEL;CELL/’ $FILE > dest/$FILE; done

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s