Changeset 640 for trunk


Ignore:
Timestamp:
04/27/11 04:43:06 (14 years ago)
Author:
Nicholas Riley
Message:

Actually update all the iOS devices.

The code makes an assumption that the first iOS device finishes
syncing last. This is actually the case for me as my iPod touch is
much slower at syncing, so I may not fix it for a while.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Update Podcasts/update_podcasts.py

    r639 r640  
    99def iTunes_main_pane():
    1010    return app(u'System Events').application_processes[u'iTunes'].windows[u'iTunes'].scroll_areas[1]
     11
     12def iOS_devices(iTunes):
     13    return iTunes.sources[its.kind == AEEnum('kPod')]
    1114
    1215def wait_for_podcast_update(iTunes):
     
    2124def sync_devices(iTunes):
    2225    try:
    23         iTunes.update()
     26        iOS_devices(iTunes).update()
    2427    except CommandError:
    2528        print >> sys.stderr, 'No iOS devices detected.  Waiting for an iOS device...'
     
    2730            time.sleep(0.5)
    2831            try:
    29                 iTunes.update()
     32                iOS_devices(iTunes).update()
    3033                return
    3134            except CommandError:
     
    3336
    3437    # show first iOS device
    35     iTunes.sources[its.kind == AEEnum('kPod')].sources[1].library_playlists[1].reveal()
     38    iOS_devices(iTunes).sources[1].library_playlists[1].reveal()
    3639
    37     # wait for update to complete
     40    # wait for update to complete - XXX wait for all
    3841    def sync_enabled():
    3942        try:
Note: See TracChangeset for help on using the changeset viewer.