SHOW:
|
|
- or go back to the newest paste.
| 1 | #!/usr/bin/env python | |
| 2 | ||
| 3 | # | |
| 4 | # Save: upcoming_check.py | |
| 5 | # Do: chmod 755 upcoming_check.py | |
| 6 | # Run: ./upcoming_check.py | |
| 7 | # Written by Bill Meek, http://www.gossamer-threads.com/lists/mythtv/users/577513#577513 | |
| 8 | # Prints a list of upcoming recordings | |
| 9 | # | |
| 10 | ||
| 11 | from MythTV import MythBE | |
| 12 | import re,sys | |
| 13 | ||
| 14 | try: | |
| 15 | be = MythBE() | |
| 16 | except: | |
| 17 | print 'Unable to connect to the backend' | |
| 18 | sys.exit(1) | |
| 19 | ||
| 20 | headingNotPrinted = True | |
| 21 | upcomingCount = 0 | |
| 22 | ||
| 23 | for recording in be.getUpcomingRecordings(): | |
| 24 | if headingNotPrinted: | |
| 25 | print '\nUpcoming recordings...' | |
| 26 | print '\n chanid Starttime\t\tTitle\t\t Subtitle' | |
| 27 | headingNotPrinted = False | |
| 28 | print u' {0:<7} {1}\t{2:<20.20} {3:<29.29}' \
| |
| 29 | .format(recording.chanid, | |
| 30 | recording.starttime.strftime("%b %d %Y %H:%M"),
| |
| 31 | recording.title, | |
| 32 | recording.subtitle) | |
| 33 | upcomingCount = upcomingCount + 1 | |
| 34 | ||
| 35 | print '\n Upcoming Shows: {0}.\n'.format(upcomingCount)
| |
| 36 | ||
| 37 | headingNotPrinted = True | |
| 38 | ||
| 39 | conflictCount = 0 | |
| 40 | ||
| 41 | # The following is commented out because getConflictedRecordings isn't | |
| 42 | # available in 0.21. | |
| 43 | # for recording in be.getConflictedRecordings(): | |
| 44 | # if headingNotPrinted: | |
| 45 | # print '\nAll conflicts...' | |
| 46 | # print '\n ChanID Starttime\t\tTitle' | |
| 47 | # headingNotPrinted = False | |
| 48 | # print u' {0} {1}\t{2}' \
| |
| 49 | # .format(recording.chanid, | |
| 50 | # recording.starttime.strftime("%b %d %Y %H:%M"),
| |
| 51 | # recording.title) | |
| 52 | # conflictCount = conflictCount + 1 | |
| 53 | # | |
| 54 | # if conflictCount: | |
| 55 | # print '\n Conflicts: {0}.\n'.format(conflictCount) |