Changeset 1794

Show
Ignore:
Timestamp:
02/21/07 11:22:33 (22 months ago)
Author:
abaumann
Message:

update mototool to new motosync API
remove --list option, because it was too hard to maintain and served little purpose
add code to look for motosync.py in /usr/lib/opensync/python-plugins if no package config was found
update README

Location:
plugins/moto-sync
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • plugins/moto-sync/README

    r1720 r1794  
    3636REQUIREMENTS 
    3737 
    38  * OpenSync 0.20 or later with the python bindings and python-module plugin 
     38 * OpenSync 0.30 or later with the python bindings and python-module plugin 
    3939 * Python 2.4 or newer 
    4040 * The python-dateutil library (at least version 1.1), 
     
    7777        msynctool --addmember phone file-sync 
    7878        msynctool --configure phone 1 # configure moto-sync, as above 
    79         msynctool --configure phone 2 # configure file-sync, set the path 
     79        msynctool --configure phone 2 # configure file-sync, set the path(s) 
     80        msynctool --discover phone 1 
     81        msynctool --discover phone 2 
    8082        msynctool --sync phone # cross your fingers! 
    81  
    82 NB: make sure your file-sync directory has only events and contacts in  
    83 it, no TODO or other data. Otherwise OpenSync will mysteriously  
    84 deadlock, because there were changes from the file-sync that couldn't be  
    85 converted. I'm told that this bug is already fixed by the development  
    86 branch of OpenSync. 
    8783 
    8884 
     
    9187Before doing anything with write enabled, it is probably a good idea to 
    9288backup the data from your phone. You can use the mototool script to 
    93 do this, to delete entries on the phone, or to examine the data that 
    94 moto-sync would send to opensync. Run 'mototool --help' for details 
    95 or, for the impatient, try: 
     89do this, and to delete entries on the phone. Run 'mototool --help' for  
     90details, or, for the impatient, try: 
    9691    mototool -v -d (device string) -f myphone.backup --backup 
    9792 
  • plugins/moto-sync/mototool

    r1608 r1794  
    1616    libdir = child.fromchild.readline().rstrip('\n') 
    1717    if child.wait() != 0 or not os.path.isdir(libdir): 
    18         sys.stderr.write("Error: couldn't locate OpenSync library directory\n") 
    19         sys.exit(1) 
     18        # no pkgconfig, try standard install path 
     19        libdir = '/usr/lib/opensync' 
     20        if not os.path.isdir(libdir): 
     21            sys.stderr.write("Error: couldn't locate OpenSync library directory\n") 
     22            sys.exit(1) 
    2023    sys.path.append(os.path.join(libdir, 'opensync', 'python-plugins')) 
    2124    import motosync 
     
    3538    p.add_option('-f', '--file', dest='filename', 
    3639                 help='name of backup/restore data file') 
    37     p.add_option('--list', action='store_const', dest='mode', const='list', 
    38                  help='list data on the phone in OpenSync XML format') 
    3940    p.add_option('--backup', action='store_const', dest='mode', const='backup', 
    4041                 help='backup entries from the phone to a file') 
     
    4748    options, args = p.parse_args() 
    4849    if not options.mode: 
    49         p.error('one of the list, backup, restore, delete actions is required') 
     50        p.error('one of the backup, restore, or delete actions is required') 
    5051    if options.mode in ['backup', 'restore'] and not options.filename: 
    5152        p.error('this action requires a --file argument') 
     
    110111    prompt_user(options) 
    111112    pc = motosync.PhoneComms(options.device) 
    112  
    113     if options.mode == 'list': 
    114         pa = motosync.PhoneAccess(pc) 
    115         for objtype in options.objtype: 
    116             for change in pa.list_changes(objtype): 
    117                 print change.uid 
    118                 print change.data 
     113    pc.connect() 
    119114 
    120115    if options.mode == 'delete' or options.mode == 'restore': 
     
    163158                pc.write_contact(e) 
    164159 
     160    pc.disconnect() 
     161 
    165162 
    166163if __name__ == "__main__":