コード例 #1
0
 def checkRecordingStatus(self):
     """Checks whether the backend is currently recording."""
     try:
         recbe = MythBE()
         for recorder in recbe.getRecorderList():
             if recbe.isRecording(recorder):
                 self.isrecording = True
                 break
     except:
         # If we can't connect to it then it can't be recording.
         self.isrecording = False
コード例 #2
0
ファイル: screen.py プロジェクト: DirkUK/RPi-InfoScreen-Kivy
 def checkRecordingStatus(self):
     """Checks whether the backend is currently recording."""
     try:
         recbe = MythBE()
         for recorder in recbe.getRecorderList():
             if recbe.isRecording(recorder):
                 self.isrecording = True
                 break
     except:
         # If we can't connect to it then it can't be recording.
         self.isrecording = False
コード例 #3
0
ファイル: mythrecordtest.py プロジェクト: dougt/myth-hacks
db = MythDB()

if db == None:
  print "Database could not be open or found"
  exit()


be = None
be = MythBE()

if be == None:
  print "Backend could not be found."
  #exit()


for x in be.getRecorderList():
  print "Tuner " + str(x) + " is recording: " + str(be.getCurrentRecording(x).title)

fs = be.getFreeSpace()
print "----------------------------------"
for x in fs:
  print "Host: " + x.host
  print "\tPath: " + x.path
  print "\t\tTotal space: " + str(x.totalspace / 1024 / 1024) + "MB"
  print "\t\tFree  space: " + str(x.freespace / 1024  / 1024) + "MB"
  print "\t\tUsed  space: " + str(x.usedspace / 1024  / 1024) + "MB"
  print "----------------------------------"


prog = be.getRecordings()
prog[0].keys()
コード例 #4
0
ファイル: mythstatuscheck.py プロジェクト: dougt/myth-hacks
if db == None:
    sendMessage("Database could not be open or found")
    exit(-1)

be = None
try:
    be = MythBE()
except:
    be = None

if be == None:
    sendMessage("Backend could not be found")
    exit(-1)

if len(be.getRecorderList()) != 2:
    sendMessage("Tuner list is not what we expected")
    exit(-1)

#if strftime("%S") == str('00') || strftime("%S") == str('30'):
#  exit(0)

for x in be.getRecorderList():

    filename = str(be.getCurrentRecording(x).filename)
    title = str(be.getCurrentRecording(x).title)
    channel = str(be.getCurrentRecording(x).channum)
    start = str(be.getCurrentRecording(x).starttime)

    # this is weird.  x still returns something (a None program)
    # even though nothing is being recorded
コード例 #5
0
from MythTV import MythDB, MythBE

db = None
db = MythDB()

if db == None:
    print "Database could not be open or found"
    exit()

be = None
be = MythBE()

if be == None:
    print "Backend could not be found."
    #exit()

for x in be.getRecorderList():
    print "Tuner " + str(x) + " is recording: " + str(
        be.getCurrentRecording(x).title)

fs = be.getFreeSpace()
print "----------------------------------"
for x in fs:
    print "Host: " + x.host
    print "\tPath: " + x.path
    print "\t\tTotal space: " + str(x.totalspace / 1024 / 1024) + "MB"
    print "\t\tFree  space: " + str(x.freespace / 1024 / 1024) + "MB"
    print "\t\tUsed  space: " + str(x.usedspace / 1024 / 1024) + "MB"
    print "----------------------------------"
コード例 #6
0
ファイル: syncdeletes.py プロジェクト: jmoney1217/mythtools
def main():
	' setup logger, all to stdout and INFO and higher to LOGFILE '
	logging.basicConfig(format='%(message)s',
				level=logging.NOTSET)
	loggingfile = logging.handlers.RotatingFileHandler(LOGFILE, maxBytes=(MAXLOGSIZE), backupCount=MAXLOGS)
	loggingfile.setLevel(logging.INFO)
	formatter = logging.Formatter('%(asctime)s: %(message)s', datefmt='%m-%d %H:%M')
	loggingfile.setFormatter(formatter)
	logging.getLogger('').addHandler(loggingfile)

	' connect to mythtv database '
	db = MythDB()
	be = MythBE(db=db)

	' loop all files in lib_dir that are symlinks and create listing '
	listings = []
	for ld in LIBDIR:
		for dp, dn, files in os.walk(ld):
			for file in files:
				filepath = os.path.join(dp,file)
				if (os.path.islink(filepath)):
					listings.append(lib_listing(filepath))

	' get list of all recordings from MythDB, link with library, figure out their status '
	recordings = []
	activeRecordings = []
	activeJobs = []
	newExpireList = []
	mythrecordings = db.searchRecorded()
	recorderList = be.getRecorderList()
	for mrec in mythrecordings:
		logging.debug(mrec)
		rec = recording(mrec)
		recordings.append(rec)

		' skip items already set to autoexpire '
		if (rec.mythrec.autoexpire == 1):
			logging.debug(" - already set to expire, skip")
			continue

		' loop through the list of library items looking for matching recordings, linking them '
		for l in listings:
			if rec.match(l.symlink):
				if rec.lib_listing != None:
					logging.error("UH OH! Linking with something already linked!")
				else:
					rec.lib_listing = l

		' figure out if the recording is active '
		for recorder in recorderList:
			arec = be.getCurrentRecording(recorder)
			if (arec['title'] is not None) and (arec['chanid'] is not 0) and \
			   (arec == rec.program):
				logging.debug(" - currently recording, skip")
				activeRecordings.append(rec)
				rec.state = RecordingState.Recording
				break
		if (rec.state != RecordingState.Recorded):
			continue

		' figuire if the recording is part of an active job '
		jobs = db.searchJobs() #need to generate jobs on each loop
		for job in jobs:
			if job.status in [Job.ABORTING, Job.ERRORING, Job.PAUSED, Job.PENDING, \
					  Job.QUEUED, Job.RETRY, Job.RUNNING, Job.STARTING, Job.STOPPING]:
				jobrec = Recorded((job.chanid, job.starttime), db=db)
				if rec.mythrec == jobrec:
					logging.debug(" - currently part of a job, skip")
					activeJobs.append(rec)
					rec.state = RecordingState.BusyJob
					break
		if (rec.state != RecordingState.Recorded):
			continue

		' potentially add to auto-expire list, and set orphaned recordings to auto-expire '
		if (rec.lib_listing == None) and (rec.state == RecordingState.Recorded):
			logging.debug(" - no link, auto-expire")
			newExpireList.append(rec)
			# rec.mythrec.delete(force=True, rerecord=False)
			rec.mythrec.autoexpire = 1
			rec.mythrec.update()

	' log summary '
	logging.info("")
	logging.info("** Summary **")
	logging.info(" [MythDB Recordings][%s]" % len(recordings))
	logging.info("  - active recordings: %s" % len(activeRecordings))
	for arec in activeRecordings:
		logging.info("   - %s [%s]" % (arec.program, arec.metadata.filename))
	logging.info("  - in progress jobs: %s" % len(activeJobs))
	for ajobs in activeJobs:
		logging.info("   - %s [%s]" % (ajobs.program, ajobs.metadata.filename))

	logging.info("")
	logging.info(" [Mythical Links][%s]" % len(listings))
	logging.info("  - new auto-expire items: %s" % len(newExpireList))
	for d in newExpireList:
		logging.info( "   - %s [%s]" % (d.program, d.metadata.filename))
コード例 #7
0
ファイル: mythstatuscheck.py プロジェクト: dougt/myth-hacks
if db == None:
  sendMessage("Database could not be open or found")
  exit(-1)

be = None
try:
  be = MythBE()
except:
  be = None

if be == None:
  sendMessage("Backend could not be found")
  exit(-1)

if len(be.getRecorderList()) != 2:
  sendMessage("Tuner list is not what we expected")
  exit (-1)

#if strftime("%S") == str('00') || strftime("%S") == str('30'):
#  exit(0)

for x in be.getRecorderList():

  filename = str(be.getCurrentRecording(x).filename)
  title    = str(be.getCurrentRecording(x).title)
  channel  = str(be.getCurrentRecording(x).channum)
  start    = str(be.getCurrentRecording(x).starttime)

  # this is weird.  x still returns something (a None program)
  # even though nothing is being recorded