예제 #1
0
    def P_eventview(self, request):
        event = {}
        event['sref'] = ""
        event['title'] = ""
        event['picon'] = ""
        event['shortdesc'] = ""
        event['longdesc'] = ""
        event['begin'] = 0
        event['end'] = 0
        event['duration'] = 0
        event['channel'] = ""

        eventid = getUrlArg(request, "eventid")
        ref = getUrlArg(request, "eventref")
        if ref and eventid:
            event = getEvent(ref, eventid)['event']
            event['id'] = eventid
            event['picon'] = getPicon(ref)
            event['end'] = event['begin'] + event['duration']
            event['duration'] = int(event['duration'] / 60)
            event['start'] = event['begin']
            event['begin'] = strftime("%H:%M", (localtime(event['begin'])))
            event['end'] = strftime("%H:%M", (localtime(event['end'])))

        return {"event": event}
예제 #2
0
    def P_getservices(self, request):
        sRef = getUrlArg(request, "sRef", "")
        includePicon = (getUrlArg(request, "picon", "") == '1')
        services = []

        CalcPos = False

        if sRef == "":
            sRef = '%s FROM BOUQUET "bouquets.tv" ORDER BY bouquet' % (
                service_types_tv)
            CalcPos = True
        elif ' "bouquets.radio" ' in sRef:
            CalcPos = True
        elif ' "bouquets.tv" ' in sRef:
            CalcPos = True

        serviceHandler = eServiceCenter.getInstance()
        serviceslist = serviceHandler.list(eServiceReference(sRef))
        fulllist = serviceslist and serviceslist.getContent("RN", True)

        pos = 0
        oPos = 0
        for item in fulllist:
            oldoPos = oPos
            if CalcPos:
                sref = item[0].toString()
                serviceslist = serviceHandler.list(eServiceReference(sref))
                sfulllist = serviceslist and serviceslist.getContent(
                    "RN", True)
                for sitem in sfulllist:
                    sref = sitem[0].toString()
                    hs = (int(sref.split(":")[1]) & 512)
                    sp = (sref[:7] == '1:832:D')
                    if not hs or sp:  # 512 is hidden service on sifteam image. Doesn't affect other images
                        oPos = oPos + 1
                        if not sp and sitem[
                                0].flags & eServiceReference.isMarker:
                            oPos = oPos - 1
            sref = item[0].toString()
            hs = (int(sref.split(":")[1]) & 512)
            sp = (sref[:7] == '1:832:D')
            if not hs or sp:  # 512 is hidden service on sifteam image. Doesn't affect other images
                pos = pos + 1
                service = {}
                if CalcPos:
                    service['startpos'] = oldoPos
                service['pos'] = pos
                service['servicereference'] = sref
                service['isgroup'] = '0'
                service['ismarker'] = '0'
                service['isprotected'] = '0'
                if includePicon:
                    try:
                        service['picon'] = getPicon(sref)
                    except:
                        service['picon'] = ''
                if sp:
                    service['ismarker'] = '2'
                    service['servicename'] = ''
                else:
                    service['servicename'] = item[1]
                    if item[0].flags & eServiceReference.isGroup:
                        gservices = []
                        service['isgroup'] = '1'
                        # get members of group
                        gserviceslist = serviceHandler.list(
                            eServiceReference(sref))
                        gfulllist = gserviceslist and gserviceslist.getContent(
                            "RN", True)
                        for gitem in gfulllist:
                            gservice = {}
                            gservice['servicereference'] = gitem[0].toString()
                            gservice['servicename'] = gitem[1]
                            gservices.append(gservice)
                        service['members'] = gservices

                    if item[0].flags & eServiceReference.isMarker:
                        service['ismarker'] = '1'
                        # dont inc the pos for markers
                        pos = pos - 1
                        service['pos'] = 0
                if not sp and config.ParentalControl.configured.value and config.ParentalControl.servicepinactive.value:
                    sref = item[0].toCompareString()
                    protection = parentalControl.getProtectionLevel(sref)
                    if protection != -1:
                        if config.ParentalControl.type.value == "blacklist":
                            if sref in parentalControl.blacklist:
                                if "SERVICE" in parentalControl.blacklist[
                                        sref]:
                                    service['isprotected'] = '1'
                                elif "BOUQUET" in parentalControl.blacklist[
                                        sref]:
                                    service['isprotected'] = '2'
                                else:
                                    service['isprotected'] = '3'
                        elif config.ParentalControl.type.value == "whitelist":
                            if sref not in parentalControl.whitelist:
                                if item[0].flags & eServiceReference.isGroup:
                                    service['isprotected'] = '5'
                                else:
                                    service['isprotected'] = '4'
                services.append(service)
        return {"services": services}