コード例 #1
0
def main(opts):
    MythBE.getPendingRecordings.handler = MyProgram
    be = MythBE()
    now = datetime.now()

    if not opts.plaintext:
        print '<h3>Upcoming Recordings:</h3>'
        print '<div class="schedule">'

    count = 0
    for rec in be.getPendingRecordings():
        if not ((opts.filter&2**0 and rec.is_scheduled) or
                (opts.filter&2**1 and rec.is_duplicate) or
                (opts.filter&2**2 and rec.is_deactivated) or
                (opts.filter&2**3 and rec.is_conflict)):
            continue
        if opts.time and (opts.time < rec.recstartts):
            continue
        if now > rec.recendts:
            continue
        if opts.count and (opts.count <= count):
            break
        count += 1

        if opts.plaintext:
            print '{0} - {1}'.format(rec.starttime.strftime('%m/%d, %I:%M %p'),
                                     rec.callsign)
            if rec.subtitle:
                print '{0.title} - {0.subtitle}'.format(rec)
            else:
                print '{0.title}'.format(rec)
            print rec.description
            print ''
        else:
            print '<a href="#">{0} - {1} - {2}'.format(rec.starttime.strftime('%m/%d, %I:%M %p'),
                                     rec.callsign,
                                     rec.title),
            if rec.subtitle:
                print rec.subtitle,
            print '<br /><span><strong>{0.title}</strong>'.format(rec),
            print rec.starttime.strftime('%m/%d, %I:%M %p'),
            print '<br /><em>{0.description}<br/></span></a><hr />'

    if not opts.plaintext:
        print '</div>'
コード例 #2
0
def main(opts):
    MythBE.getPendingRecordings.handler = MyProgram
    be = MythBE()
    now = datetime.now()

    if not opts.plaintext:
        print '<h3>Upcoming Recordings:</h3>'
        print '<div class="schedule">'

    count = 0
    for rec in be.getPendingRecordings():
        if not ((opts.filter & 2**0 and rec.is_scheduled) or
                (opts.filter & 2**1 and rec.is_duplicate) or
                (opts.filter & 2**2 and rec.is_deactivated) or
                (opts.filter & 2**3 and rec.is_conflict)):
            continue
        if opts.time and (opts.time < rec.recstartts):
            continue
        if now > rec.recendts:
            continue
        if opts.count and (opts.count <= count):
            break
        count += 1

        if opts.plaintext:
            print '{0} - {1}'.format(rec.starttime.strftime('%m/%d, %I:%M %p'),
                                     rec.callsign)
            if rec.subtitle:
                print '{0.title} - {0.subtitle}'.format(rec)
            else:
                print '{0.title}'.format(rec)
            print rec.description
            print ''
        else:
            print '<a href="#">{0} - {1} - {2}'.format(
                rec.starttime.strftime('%m/%d, %I:%M %p'), rec.callsign,
                rec.title),
            if rec.subtitle:
                print rec.subtitle,
            print '<br /><span><strong>{0.title}</strong>'.format(rec),
            print rec.starttime.strftime('%m/%d, %I:%M %p'),
            print '<br /><em>{0.description}<br/></span></a><hr />'

    if not opts.plaintext:
        print '</div>'
コード例 #3
0
ファイル: betterMovies.py プロジェクト: dhaber/mythtv
#	return a.recgroup == "Movies" and (float(a.channum) < 500 or getCommMethod(a.chanid) <> -2 or a.starttime < magic)
	return a.recgroup == "Movies" and (getCommMethod(a.chanid) <> -2 or a.starttime < magic)

def getChannel(chanid):
	for c in channels:
		if c.chanid == chanid:
			return c

def getCommMethod(chanid):
	c = getChannel(chanid);
	return c.commmethod


myth = MythBE()
channels = list(Channel.getAllEntries())
pending = filter(filterPMovies, myth.getPendingRecordings())
all_movies = filter(filterPMovies, myth.getRecordings())
recorded = filter(filterRMovies, all_movies)

for r in sorted(recorded, key=lambda a: a.title):

	def r_filter(a):
		return a.title == r.title

	my_rec = filter(r_filter, all_movies)

	def p_filter(a):
		for b in my_rec:
			if a.title <> b.title:
				return False
コード例 #4
0
ファイル: dupes.py プロジェクト: dhaber/mythtv
        seen[marker] = 1 
        result.append(item) 
    return result

def pendFun(x):
	out = x.title + "-"
	if x.subtitle is not None:
		out += x.subtitle
	return out

def goodRec(x):
	return x.recgroup <> 'Sports' and x.subtitle is not None and x.title not in titlesIgnore and (x.recstatus == Program.rsWillRecord or x.recstatus == Program.rsConflict) 

myth = MythBE()
mythDB = MythDB()
pending = uniq(filter(goodRec, myth.getPendingRecordings()), pendFun)

for p in sorted(pending, key=pendFun):
#	print p.title
	olds = list(mythDB.searchOldRecorded(title=p.title, subtitle=p.subtitle, recstatus=-3, duplicate=1))
#	olds = filter(lambda x: x.programid == "", olds)
	if len(olds) > 0:
		print "%s %s (%s) %s" % (p.title, p.subtitle, p.starttime, p.recstatus)
		for o in olds:
			if o.programid == "":
				print "\tNo Old Program Id"

			if o.programid <> "" and o.programid <> p.programid:
#			if o.programid <> p.programid:
				print "\tDifferent Program Ids"
コード例 #5
0
ファイル: soccer.py プロジェクト: dhaber/mythtv
	for programTeam in programTeams:
		if isTeamMatch(team, programTeam):
			return True
	return False

try:
    opts, args = getopt.getopt(sys.argv[1:],"h:",["hours="])
except getopt.GetoptError:
    print 'soccer.py -h <hours a recording can be late - default 1>'
    sys.exit(2)

hours = 1
for o, a in opts:
    if o == "-h":
        hours = int(a)


myth = MythBE()
pending = filter(sportsRecs, myth.getPendingRecordings())

# get the output from the schedule
output = check_output(["/usr/bin/java", "-jar", "/opt/soccer/soccerschedule.jar", "--weeks=2"])

# split the output into lines and then filter only the real output
lines = filter(filterOutput,output.splitlines())
for line in lines:
	data = getData(line)
	if not hasMatches(data, pending):
		print "%s %s vs. %s (%s) on %s " % (data[0], " ".join(data[3]), " ".join(data[2]), data[1], data[4])

コード例 #6
0
ファイル: late.py プロジェクト: dhaber/mythtv
#!/usr/bin/python

from MythTV import MythBE, Program
from datetime import timedelta, datetime, time

def willRec(x):
	return x.recstatus == Program.rsWillRecord and x.airdate is not None

myth = MythBE()
pending = filter(willRec, myth.getPendingRecordings())

print "%-20.20s %-35.35s %-20s %-20s" % ("title", "subtitle", "original date", "record start time")
for p in sorted(pending, key=lambda a: a.title):
	diff = p.starttime - datetime.combine(p.airdate, time(tzinfo=p.starttime.tzinfo))
	if diff > timedelta(days=1,hours=6) and diff < timedelta(days=24):
		print "%-20.20s %-35.35s %-20s %-20s" % (p.title, p.subtitle, p.airdate, p.starttime)