class test_Methodheap_MythDB_002(unittest.TestCase): """Test method 'searchOldRecorded' from MythTV.MythDB().""" @classmethod def setUpClass(cls): # get the global test environment global TestEnv cls.testenv = TestEnv def setUp(self): self.mydb = MythDB() def test_Methodheap_MythDB_002_searchOldRecorded_01(self): """Test 'searchOldRecorded' method from MythTV.MythDB() via 'chanid'. """ recs = self.mydb.searchOldRecorded(chanid = self.testenv['RECCHANID']) rec02 = next(recs) self.assertTrue(isinstance(rec02, OldRecorded)) def test_Methodheap_MythDB_002_searchOldRecorded_02(self): """Test 'searchOldRecorded' method from MythTV.MythDB() via 'chanid', 'title'. """ recs = self.mydb.searchOldRecorded( chanid = self.testenv['RECCHANID'] , title = self.testenv['RECTITLE'] ) rec02 = next(recs) self.assertTrue(isinstance(rec02, OldRecorded)) # check if accessing a property works self.assertTrue(rec02.recordid == int(self.testenv['RECRECORDID'])) def test_Methodheap_MythDB_002_searchOldRecorded_03(self): """Test 'searchOldRecorded' method from MythTV.MythDB() via 'chanid' and 'starttime'- """ # get the 'progstart' time of the 'recorded' table: rec = Recorded((int(self.testenv['RECCHANID']), int(self.testenv['RECSTARTTIMEMYTH'])), db = self.mydb) starttime_utc_iso = rec.progstart.utcisoformat() +"Z" # use 'progstart' as 'starttime' in the oldrecored table, like '2019-03-05T12:55:00Z': recs = self.mydb.searchOldRecorded( chanid = self.testenv['RECCHANID'] , starttime = starttime_utc_iso ) rec02 = next(recs) self.assertTrue(isinstance(rec02, OldRecorded)) # check if accessing a property works self.assertTrue(rec02.recordid == int(self.testenv['RECRECORDID']))
def test_repr_002_01(self): """ Test '__repr__' and '__str__' methods from dataheap.py """ chanid = self.testenv['RECCHANID'] starttimemyth = self.testenv['RECSTARTTIMEMYTH'] title = self.testenv['RECTITLE'] c_s = (chanid, starttimemyth) db = MythDB() # Recorded class r = Recorded(c_s, db=db) print() print(repr(r)) print(str(r)) # Markup table m = r.markup print() print(repr(m)) print(str(m)) # one entry of the marlup table: print() print(repr(m[0])) print(str(m[0])) # one value of a single entry: print() print(repr(m[0].mark)) print(str(m[0].mark)) print() print(repr(m[0].data)) print(str(m[0].data)) # Artwork a = r.artwork print() print(repr(a)) print(str(a)) # Coverart of an Artwork ac = a.coverart print() print(repr(ac)) print(str(ac)) # Program of the recorded entry: prgrm = r.getRecordedProgram() print() print(repr(prgrm)) print(str(prgrm)) # OldRecorded of the recorded entry: oldrecs = db.searchOldRecorded(chanid=chanid, title=title) oldrec = next(oldrecs) print() print(repr(oldrec)) print(str(oldrec))
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" elif p.description <> o.description: print "\tDifferent Description" elif p.seriesid <> o.seriesid: print "\tDifferent Series Ids"