Exemplo n.º 1
0
 def getRecordings(self, recordingGroup='default', title='all shows'):
     """
     Returns a list of RecordedProgram for the given recording group and show title (both case insensetive).
     
     @param recordingGroup: Recording group name or 'All Groups'
     @type recordingGroup: string
     @param title: Title of program or 'All Shows'
     @type title: string
     @rtype: RecordedProgram[]
     """
     # TODO: Optimize so it doesn't get all recordings and filters locally
     programs = []
     offset = 0
     reply = self._sendRequest(self.cmdSock, self.protocol.genQueryRecordingsCommand())   
     numRows = int(reply.pop(0))
     
     recordingGroup = recordingGroup.upper()
     title = title.upper()
     from mythbox.mythtv.domain import RecordedProgram
     
     for i in xrange(numRows):
         response = reply[offset:offset+self.protocol.recordSize()]
         # use of self._db intentional
         p = RecordedProgram(response, self.settings, self.translator, self.platform, self.protocol, [self, None][self._db is None])
         if  recordingGroup.upper() in ('ALL GROUPS', p.getRecordingGroup().upper(),) and \
             title.upper() in ('ALL SHOWS', p.title().upper(),):
             programs.append(p) 
         offset += self.protocol.recordSize()
     return programs
Exemplo n.º 2
0
    def getRecordings(self, recordingGroup='default', title='all shows'):
        """
        Returns a list of RecordedProgram for the given recording group and show title (both case insensetive).
        
        @param recordingGroup: Recording group name or 'All Groups'
        @type recordingGroup: string
        @param title: Title of program or 'All Shows'
        @type title: string
        @rtype: RecordedProgram[]
        """
        # TODO: Optimize so it doesn't get all recordings and filters locally
        programs = []
        offset = 0
        reply = self._sendRequest(self.cmdSock,
                                  self.protocol.genQueryRecordingsCommand())
        numRows = int(reply.pop(0))

        recordingGroup = recordingGroup.upper()
        title = title.upper()
        from mythbox.mythtv.domain import RecordedProgram

        for i in xrange(numRows):
            response = reply[offset:offset + self.protocol.recordSize()]
            # use of self._db intentional
            p = RecordedProgram(response, self.settings, self.translator,
                                self.platform, self.protocol,
                                [self, None][self._db is None])
            if  recordingGroup.upper() in ('ALL GROUPS', p.getRecordingGroup().upper(),) and \
                title.upper() in ('ALL SHOWS', p.title().upper(),):
                programs.append(p)
            offset += self.protocol.recordSize()
        return programs