def getRecording(self, channelId, startTime): """ @type channelId: int @type startTime: str or datetime.datetime @return: RecordedProgram or None if not found """ if isinstance(startTime, datetime.datetime): from mythbox.mythtv.domain import dbTime2MythTime startTime = dbTime2MythTime(startTime) query = 'QUERY_RECORDING TIMESLOT %s %s' % (channelId, startTime) reply = self._sendRequest(self.cmdSock, [query]) from mythbox.mythtv.domain import RecordedProgram if self._isOk(reply): return RecordedProgram(reply[1:], self.settings, self.translator, self.platform, self.protocol, [self, None][self._db is None]) else: log.debug('Program not found') return None
def test_dbTime2MythTime_ShouldConvertTimeDeltaToString(self): td = datetime.timedelta(seconds=1000) mt = dbTime2MythTime(td) log.debug('MythTime = %s' % mt) self.assertEqual('001640', mt)