- Timestamp:
- 04/24/11 20:35:29 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Update Podcasts/update_podcasts.py
r630 r639 14 14 iTunes.playlists[its.special_kind == AEEnum('kSpP')].reveal() 15 15 podcast_status = iTunes_main_pane().outlines[1].rows.static_texts[1].value 16 # XXX this can fail if iTunes is hidden; fix it 16 17 while any(status in (u'downloading', u'queued for download') 17 18 for status in podcast_status.get()): 18 19 time.sleep(0.5) 19 20 20 def sync_ iPod(iTunes):21 def sync_devices(iTunes): 21 22 try: 22 23 iTunes.update() 23 24 except CommandError: 24 print >> sys.stderr, 'No i Pod detected. Waiting for iPod...'25 print >> sys.stderr, 'No iOS devices detected. Waiting for an iOS device...' 25 26 while True: 26 27 time.sleep(0.5) … … 31 32 pass 32 33 33 # show iPod34 # show first iOS device 34 35 iTunes.sources[its.kind == AEEnum('kPod')].sources[1].library_playlists[1].reveal() 35 36 … … 52 53 print >> sys.stderr, 'Starting podcast update...' 53 54 iTunes.updateAllPodcasts() 54 print >> sys.stderr, 'Synchronizing i Pod...'55 sync_ iPod(iTunes)55 print >> sys.stderr, 'Synchronizing iOS devices...' 56 sync_devices(iTunes) 56 57 print >> sys.stderr, 'Updating podcasts...' 57 58 iTunes.updateAllPodcasts() 58 59 wait_for_podcast_update(iTunes) 59 print >> sys.stderr, 'Synchronizing i Pod...'60 sync_ iPod(iTunes)60 print >> sys.stderr, 'Synchronizing iOS devices...' 61 sync_devices(iTunes) 61 62 app(id='net.sabi.UpdatePodcasts').quit()
Note:
See TracChangeset
for help on using the changeset viewer.