Exemplo n.º 1
0
def returnFromJelly(status, response):
    """Un-serialize EncodingServer responses"""
    _debug_('returnFromJelly(status, response)', 2)
    if status:
        return (status, unjellyFromXML(response))
    else:
        return (status, response)
Exemplo n.º 2
0
    def getScheduledRecordings(self):
        print 'getScheduledRecordings()'
        file_ver = None
        scheduledRecordings = None

        if os.path.isfile(opts.schedule):
            print 'reading cached file (%s)' % opts.schedule
            if hasattr(self, 'scheduledRecordings_cache'):
                mod_time, scheduledRecordings = self.scheduledRecordings_cache
                try:
                    if os.stat(opts.schedule)[stat.ST_MTIME] == mod_time:
                        print 'Return cached data'
                        return scheduledRecordings
                except OSError, e:
                    print 'exception=%r' % e
                    pass

            try:
                f = open(opts.schedule, 'r')
                scheduledRecordings = unjellyFromXML(f)
                f.close()
            except sux.ParseError, e:
                print '"%s" is invalid, removed' % (opts.schedule)
                os.unlink(opts.schedule)
Exemplo n.º 3
0
    def getScheduledRecordings(self):
        print 'getScheduledRecordings()'
        file_ver = None
        scheduledRecordings = None

        if os.path.isfile(opts.schedule):
            print 'reading cached file (%s)' % opts.schedule
            if hasattr(self, 'scheduledRecordings_cache'):
                mod_time, scheduledRecordings = self.scheduledRecordings_cache
                try:
                    if os.stat(opts.schedule)[stat.ST_MTIME] == mod_time:
                        print 'Return cached data'
                        return scheduledRecordings
                except OSError, e:
                    print 'exception=%r' % e
                    pass

            try:
                f = open(opts.schedule, 'r')
                scheduledRecordings = unjellyFromXML(f)
                f.close()
            except sux.ParseError, e:
                print '"%s" is invalid, removed' % (opts.schedule)
                os.unlink(opts.schedule)
Exemplo n.º 4
0
def returnFromJelly(status, response):
    if status:
        return (status, unjellyFromXML(response))
    else:
        return (status, response)
Exemplo n.º 5
0
            status = False
            if sys.exc_type != socket.error:
                traceback.print_exc()
                _debug_('findNextProgram:%s' % e, 0)

        if self.serverup != serverup:
            self.serverup = serverup
            if serverup:
                _debug_('The record server is up')
            else:
                _debug_('The record server is down')

        if not status:
            return None

        next_program = unjellyFromXML(message)
        return next_program

    def isPlayerRunning(self):
        """
        Check with the record server if suspended by user
        """
        _debug_('isPlayerRunning(self)', 2)
        serverup = True
        try:
            (status, message) = self.server.isPlayerRunning()
            _debug_('status=%s, message=%s' % (status, message), 2)
        except Exception, e:
            serverup = False
            message = None
            if sys.exc_type != socket.error: