Last change
on this file since 627 was 627, checked in by Nicholas Riley, 14 years ago |
iOS 4 displays podcast info, finally.
|
File size:
1.4 KB
|
Rev | Line | |
---|
[488] | 1 | #!/usr/bin/python
|
---|
| 2 | # -*- coding: utf-8 -*-
|
---|
| 3 |
|
---|
| 4 | from appscript import *
|
---|
[489] | 5 | from aem import AEEnum
|
---|
[491] | 6 | import sys
|
---|
[489] | 7 | import time
|
---|
[488] | 8 |
|
---|
[489] | 9 | def iTunes_main_pane():
|
---|
[625] | 10 | return app(u'System Events').application_processes[u'iTunes'].windows[u'iTunes'].splitter_groups[1].scroll_areas[1]
|
---|
[488] | 11 |
|
---|
[489] | 12 | def wait_for_podcast_update(iTunes):
|
---|
| 13 | # show 'Podcasts'
|
---|
| 14 | iTunes.playlists[its.special_kind == AEEnum('kSpP')].reveal()
|
---|
| 15 | podcast_status = iTunes_main_pane().outlines[1].rows.static_texts[1].value
|
---|
[491] | 16 | while any(status in (u'downloading', u'queued for download')
|
---|
| 17 | for status in podcast_status.get()):
|
---|
[489] | 18 | time.sleep(0.5)
|
---|
[488] | 19 |
|
---|
[489] | 20 | def wait_for_iPod_update(iTunes):
|
---|
| 21 | # show iPod
|
---|
| 22 | iTunes.sources[its.kind == AEEnum('kPod')].sources[1].library_playlists[1].reveal()
|
---|
| 23 | sync_enabled = iTunes_main_pane().buttons[u'Sync'].enabled
|
---|
[546] | 24 | while True:
|
---|
| 25 | try:
|
---|
| 26 | if sync_enabled.get() == True:
|
---|
| 27 | return
|
---|
| 28 | except CommandError:
|
---|
| 29 | pass
|
---|
[489] | 30 | time.sleep(0.5)
|
---|
| 31 |
|
---|
[488] | 32 | if __name__ == '__main__':
|
---|
[489] | 33 | iTunes = app('iTunes')
|
---|
[609] | 34 | print >> sys.stderr, 'Starting podcast update...'
|
---|
| 35 | iTunes.updateAllPodcasts()
|
---|
[491] | 36 | print >> sys.stderr, 'Synchronizing iPod...'
|
---|
| 37 | iTunes.update()
|
---|
[489] | 38 | wait_for_iPod_update(iTunes)
|
---|
[491] | 39 | print >> sys.stderr, 'Updating podcasts...'
|
---|
[489] | 40 | iTunes.updateAllPodcasts()
|
---|
| 41 | wait_for_podcast_update(iTunes)
|
---|
[546] | 42 | print >> sys.stderr, 'Synchronizing iPod...'
|
---|
[489] | 43 | iTunes.update()
|
---|
[546] | 44 | wait_for_iPod_update(iTunes)
|
---|
[574] | 45 | app(id='net.sabi.UpdatePodcasts').quit()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.