def TunerInfo(type=None): if type: discover = getdeviceinfo.discoverdata(type) nochl = getlineup.noofchannels( type, config.hrtunerproxy.bouquets_list[type].value) BaseURL[type] = 'BaseURL: %s\n' % str(discover["BaseURL"]) FriendlyName[type] = 'FriendlyName: %s\n' % str( discover["FriendlyName"]) TunerCount[type] = 'TunerCount: %s\n' % str( getdeviceinfo.tunercount( type)) if type != 'iptv' else 'TunerCount: %s\n' % str( config.hrtunerproxy.iptv_tunercount.value) Source[type] = 'Source: %s\n' % str(tunerfolders[type]).title( ) if type != 'iptv' else 'Source: %s\n' % str( tunerfolders[type]).upper() NoOfChannels[type] = 'Channels: %s\n\n' % str(nochl) else: global choicelist choicelist = [] for type in tunerTypes: discover = getdeviceinfo.discoverdata(type) nochl = getlineup.noofchannels(type, 'all') BaseURL[type] = 'BaseURL: %s\n' % str(discover["BaseURL"]) FriendlyName[type] = 'FriendlyName: %s\n' % str( discover["FriendlyName"]) TunerCount[type] = 'TunerCount: %s\n' % str( getdeviceinfo.tunercount( type)) if type != 'iptv' else 'TunerCount: %s\n' % str( config.hrtunerproxy.iptv_tunercount.value) Source[type] = 'Source: %s\n' % str(tunerfolders[type]).title( ) if type != 'iptv' else 'Source: %s\n' % str( tunerfolders[type]).upper() NoOfChannels[type] = 'Channels: %s\n\n' % str(nochl)
def TunerInfo(): for type in tunerTypes: if path.exists('/www/%s/lineup_status.json' % tunerfolders[type]): remove('/www/%s/lineup_status.json' % tunerfolders[type]) if path.exists('/www/%s/lineup.json' % tunerfolders[type]): remove('/www/%s/lineup.json' % tunerfolders[type]) if path.exists('/www/%s/discover.json' % tunerfolders[type]): rename('/www/%s/discover.json' % tunerfolders[type], '/etc/enigma2/%s.discover' % type) if path.exists('/www/%s/device.xml' % tunerfolders[type]): rename('/www/%s/device.xml' % tunerfolders[type], '/etc/enigma2/%s.device' % type) if path.exists('/www/%s' % tunerfolders[type]) and not listdir( '/www/%s' % tunerfolders[type]): rmdir('/www/%s' % tunerfolders[type]) discover = getdeviceinfo.discoverdata(type) BaseURL[type] = 'BaseURL: %s\n' % str(discover["BaseURL"]) FriendlyName[type] = 'FriendlyName: %s\n' % str( discover["FriendlyName"]) TunerCount[type] = 'TunerCount: %s\n' % str( getdeviceinfo.tunercount(type)) Source[type] = 'Source: %s\n' % str(tunerfolders[type]).title() NoOfChannels[type] = 'Channels: %s\n\n' % str( getlineup.noofchannels(type)) if getdeviceinfo.tunercount(type) > 0 and getlineup.noofchannels( type) > 0: choicelist.append((type, str(tunerfolders[type]).title()))
def startssdp(dvbtype): discover = getdeviceinfo.discoverdata(dvbtype) device_uuid = discover['DeviceUUID'] if config.hrtunerproxy.debug.value: logger.info('Starting SSDP for %s, device_uuid: %s' % (dvbtype,device_uuid)) local_ip_address = getIP() ssdp = SSDPServer() ssdp.register('local', 'uuid:{}::upnp:rootdevice'.format(device_uuid), 'upnp:rootdevice', 'http://{}:{}/device.xml'.format(local_ip_address,tunerports[dvbtype])) thread_ssdp = threading.Thread(target=ssdp.run, args=()) thread_ssdp.daemon = True # Daemonize thread thread_ssdp.start()
def do_GET(self): try: for x in str(self.headers).split('\r\n'): if x.startswith('Host:'): host = x break self.port = int(host.split(':')[2]) except: print '[Plex DVR API] USING DEFAULT PORT' self.port = 6081 tunertype = porttypes[self.port] if self.path == '/': self.path = '/device.xml' if self.path.endswith(".html"): mimeType = 'text/html' elif self.path.endswith(".json"): mimeType = 'application/javascript' elif self.path.endswith(".xml"): mimeType = 'application/xml' elif self.path.endswith(".ico"): mimeType = 'image/x-icon' if self.path.endswith("lineup_status.json"): self.send_response(200) self.send_header('Content-type', mimeType) self.end_headers() self.wfile.write(json.dumps(getlineupstatus.lineupstatus(tunertype))) elif self.path.endswith("lineup.json"): self.send_response(200) self.send_header('Content-type', mimeType) self.end_headers() self.wfile.write(json.dumps(getlineup.lineupdata(getIP(), tunertype))) elif self.path.endswith("discover.json"): self.send_response(200) self.send_header('Content-type', mimeType) self.end_headers() self.wfile.write(json.dumps(getdeviceinfo.discoverdata(tunertype))) elif self.path.endswith("device.xml"): self.send_response(200) self.send_header('Content-type', mimeType) self.end_headers() self.wfile.write(getdeviceinfo.devicedata(tunertype)) else: self.send_error(404,'[Plex DVR API] File not found!') print '[Plex DVR API] file type not coded:',self.path return
def do_GET(self): try: for x in str(self.headers).split('\r\n'): if x.startswith('Host:'): host = x break self.port = int(host.split(':')[2]) except: if config.hrtunerproxy.debug.value: logger.info('USING DEFAULT PORT: 6081') self.port = 6081 tunertype = porttypes[self.port] if self.path == '/': self.path = '/device.xml' if self.path.endswith(".html"): mimeType = 'text/html' elif self.path.endswith(".json"): mimeType = 'application/javascript' elif self.path.endswith(".xml"): mimeType = 'application/xml' elif self.path.endswith(".css"): mimeType = 'text/css' elif self.path.endswith(".ico"): mimeType = 'image/x-icon' if self.path.endswith("lineup_status.json"): self.send_response(200) self.send_header('Content-type', mimeType) self.end_headers() self.wfile.write( json.dumps(getlineupstatus.lineupstatus(tunertype))) elif self.path.endswith("lineup.json"): self.send_response(200) self.send_header('Content-type', mimeType) self.end_headers() self.wfile.write( json.dumps( getlineup.lineupdata( getIP(), tunertype, config.hrtunerproxy.bouquets_list[tunertype].value))) elif self.path.endswith("discover.json"): self.send_response(200) self.send_header('Content-type', mimeType) self.end_headers() self.wfile.write(json.dumps(getdeviceinfo.discoverdata(tunertype))) elif self.path.endswith("device.xml"): self.send_response(200) self.send_header('Content-type', mimeType) self.end_headers() self.wfile.write(getdeviceinfo.devicedata(tunertype)) elif self.path.endswith("tuners.html"): self.send_response(200) self.send_header('Content-type', mimeType) self.end_headers() self.wfile.write(getdeviceinfo.tunerstatus(tunertype)) elif self.path.endswith("style.css"): self.send_response(200) self.send_header('Content-type', mimeType) self.end_headers() self.wfile.write("""html { width:100%; height: 100%;} body {background: #777 url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48cmFkaWFsR3JhZGllbnQgaWQ9InJnIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iNzUlIj48c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNjA2Yzg4IiBzdG9wLW9wYWNpdHk9IjEiLz48c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMxMzE3MjEiIHN0b3Atb3BhY2l0eT0iMSIvPjwvcmFkaWFsR3JhZGllbnQ+PHJlY3QgeD0iLTUwIiB5PSItNTAiIHdpZHRoPSIxMDEiIGhlaWdodD0iMTAxIiBmaWxsPSJ1cmwoI3JnKSIgLz48L3N2Zz4K) no-repeat center center fixed;background-size: cover;font-family: sans-serif;} .B {background: #fff;margin: 9.5em;border: 3px solid #000;box-shadow: 10px 10px 50px #000;display: table} .C, .W {margin: auto;margin-top: 1em;padding: 10px;} .C {width: 21em;} .W {width: 80em;} .S, .T {color: #fff;margin: -10px -10px 10px -10px;} .S {background: #393;padding: 2px 20px;font-size: 0.8em;} .T {background: #000;padding-left: 20px;font-weight: 700;} .TE {background: #a00;} .BE {background: #f00;color: #fff;border-color:#a00;} a {text-decoration: none;} a:hover {text-decoration: underline;} a,a:visited {color: #00f;} table {width: inherit;} td img {margin-right:5px;} .L * {border-bottom: 1px solid black;} td {white-space: nowrap;} td:first-child {text-align: center;} button { margin-top: 0.25em; }""") else: self.send_error(404, '[HRTunerProxy] File not found!') if config.hrtunerproxy.debug.value: logger.info('file type not coded:', self.path) return
TunerCount[type] = 'TunerCount: %s\n' % str( getdeviceinfo.tunercount( type)) if type != 'iptv' else 'TunerCount: %s\n' % str( config.hrtunerproxy.iptv_tunercount.value) Source[type] = 'Source: %s\n' % str(tunerfolders[type]).title( ) if type != 'iptv' else 'Source: %s\n' % str( tunerfolders[type]).upper() NoOfChannels[type] = 'Channels: %s\n\n' % str(nochl) if config.hrtunerproxy.debug.value: TunerInfo() TunerInfoDebug() for type in tunerTypes: discover = getdeviceinfo.discoverdata(type) if getdeviceinfo.tunercount(type) > 0: choicelist.append((type, str(tunerfolders[type]).title())) config.hrtunerproxy.type = ConfigSelection(choices=choicelist) if config.hrtunerproxy.debug.value: logger.info('Using Tuner: %s' % str(config.hrtunerproxy.type.value)) tunerTypes = [] for type in config.hrtunerproxy.type.choices.choices: tunerTypes.append(type[0]) class HRTunerProxy_Setup(ConfigListScreen, Screen): if isDreamOS: # check if DreamOS image skin = "%s/skins/dreamos_main.xml" % (path.dirname(