예제 #1
0
    def __init__(self, name, host):
        """Initialize the Enigma2 device."""
        _LOGGER.debug("__init__)")
        self._unique_id = None
        self._name = name
        self._powerstate = None
        self._volume = False
        self._muted = None
        self._current_channel = None
        self._current_program = None
        self._channel_list = []
        self._channel_dict = {}
        self._statusinfo = None
        self._update_status = True

        try:
            from enigma2_http_api.controller import Enigma2APIController
            self.enigma2 = Enigma2APIController(remote_addr=host)
        except Exception as e:
            _LOGGER.debug("Exception: %e", e)
            _LOGGER.debug("Unexpected error: %s", sys.exc_info()[0])

        self.load_channels()

        if self._name == 'Enigma2 STB':
            try:
                about = self.enigma2.get_about()
                self._unique_id = 'enigma2' + about['info']['boxtype'] + about[
                    'info']['ifaces'][0]['mac'].replace(':', '')
                self._name = about['info']['brand'] + ' ' + about['info'][
                    'model']
            except Exception as e:
                _LOGGER.debug("Exception: %e", e)
                _LOGGER.debug("Unexpected error: %s", sys.exc_info()[0])
예제 #2
0
        pprint.pformat(
            EAC.get_epgbouquet(bouquet_ref=bouquet_reference,
                               filter_func=filter_simple_events)))

    fox_hd_s = '1:0:19:7C:6:85:FFFF0000:0:0:0:'
    LOG.info(pprint.pformat(EAC.get_zap(fox_hd_s)))
    LOG.info(
        pprint.pformat(
            EAC.get_epgservice(fox_hd_s, filter_func=filter_simple_events)))


if __name__ == '__main__':
    if not REMOTE_ADDR:
        sys.exit(-1)
    DUMP_REQUESTS = tempfile.mkdtemp()
    print "REMOTE_ADDR={!s}, DUMP_REQUESTS={!s}".format(
        REMOTE_ADDR, DUMP_REQUESTS)
    EAC = Enigma2APIController(remote_addr=REMOTE_ADDR,
                               dump_requests=DUMP_REQUESTS)

    demo_search()
    demo_about()
    demo_subservices()
    demo_services()
    demo_allservices()
    demo_list_timers()
    demo_movielist()
    # demo_zap_and_list_epg()
    print "REMOTE_ADDR={!s}, DUMP_REQUESTS={!s}".format(
        REMOTE_ADDR, DUMP_REQUESTS)