Advertisement
Guest User

Untitled

a guest
Feb 8th, 2015
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. #
  4. # Prints various details about recordings. The Storage Group
  5. # is hardcoded to "Default"!
  6. #
  7.  
  8. headingPrinted = False
  9.  
  10. import argparse, sys
  11. from MythTV import MythBE, Recorded
  12.  
  13. try:
  14.     be = MythBE()
  15. except:
  16.     print 'Is mythbackend running?'
  17.     sys.exit(1)
  18.  
  19. recs = Recorded.getAllEntries()
  20.  
  21. sortedRecordings = sorted(recs, key = lambda recs: (recs.title, recs.starttime))
  22.  
  23. for recording in sortedRecordings:
  24.     if recording.recgroup != 'LiveTV' and \
  25.             recording.recgroup != 'Deleted':
  26.         if headingPrinted == False:
  27.             print '\nRecordings:\n'
  28.             print '  {0:<17.17}  {1:<30.30}\t{2:<10.10} {3}' \
  29.                 .format('Start Time', 'Title', 'Subtitle', 'File')
  30.             headingPrinted = True
  31.         print '  {0:}  {1:<30.30}\t{2:<10.10} {3}' \
  32.             .format(recording.starttime.strftime("%b %d %Y %H:%M"),
  33.             recording.title.encode('utf-8'),
  34.             recording.subtitle.encode('utf-8'),
  35.             be.fileExists(recording.basename, 'Default'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement