示例#1
0
def SetTopBoxChannel_post_delete(sender, instance, **kwargs):
    if RTESServer.objects.all().exists():
        # import pdb; pdb.set_trace()
        if instance.channel.sink.content_type.name == 'Entrada CAS IPv4':
            log.debug('Now we need to detache settopbox + domain with this channel [%s]', instance)
            stb = SetTopBox.objects.filter(id=instance.settopbox_id).all()[0]
            ch = instance.channel.sink.sink.sink.pk
            admin = adminMgmtService()
            token = admin.login(RTESServer.objects.all()[0].username, RTESServer.objects.all()[0].password)
            unlink_entitlement_device(token, ch, stb.mac)
            delete_db_deviceentitlement(stb.mac, ch)
示例#2
0
def SetTopBox_post_delete(sender, instance, **kwargs):
    if RTESServer.objects.all().exists():
        devices_list = []
        admin = adminMgmtService()
        token = admin.login(RTESServer.objects.all()[0].username, RTESServer.objects.all()[0].password)
        log.debug('Deleting: %s', instance)
        device = deviceMgmtService()
        device_tupla = (instance.mac.replace(':', '').upper(), 'STB_IPTV', '1', instance.mac.replace(':', '').upper())
        devices_list.append(device_tupla)
        device.remove_devices(token, devices_list)
        admin.logout(token)
        delete_db_device(instance.mac.replace(':', '').upper())
示例#3
0
def create_device(instance):
    devices_list = []
    admin = adminMgmtService()
    token = admin.login(RTESServer.objects.all()[0].username, RTESServer.objects.all()[0].password)
    if get_network(token) < 0:
        add_network(token, get_free_network(token))
    log.debug('Creating: %s', instance)
    device = deviceMgmtService()
    device_tupla = (instance.mac.replace(':', '').upper(), 'STB_IPTV', get_network(token), instance.mac.replace(':', '').upper())
    devices_list.append(device_tupla)
    device.add_devices(token, devices_list)
    save_db_device(get_network(token), instance.mac.replace(':', '').upper())
    admin.logout(token)
示例#4
0
def multicast_output_post_delete(sender, instance, **kwargs):
    if RTESServer.objects.all().exists():
        if instance.sink.content_type.name == 'Entrada CAS IPv4':
            channel_id = instance.sink.sink.pk
            rtes_config = RTESServer.objects.all()[0]
            rtes = realTimeEncryptionService()
            admin = adminMgmtService()
            token = admin.login(RTESServer.objects.all()[0].username, RTESServer.objects.all()[0].password)
            if get_network(token) < 0:
                add_network(token, get_free_network(token))
            rtes.delete_stream(token, rtes_config.name, channel_id, instance.sink.sink.sink.ip, instance.sink.sink.sink.port, instance.ip, instance.port, get_network(token))
            remove_entitlement(token, channel_id, get_network(token))
            admin.logout(token)
            delete_db_entitlement(channel_id)
示例#5
0
def multicast_output_post_save(sender, instance, created, **kwargs):
    if RTESServer.objects.all().exists():
        if instance.sink.content_type.name == 'Entrada CAS IPv4':
            ip = instance.ip
            dev = instance.server.get_netdev(instance.nic_sink.ipv4)
            instance.server.create_route(ip, dev)
            channel_id = instance.sink.sink.pk
            if created:
                rtes_config = RTESServer.objects.all()[0]
                rtes = realTimeEncryptionService()
                admin = adminMgmtService()
                token = admin.login(RTESServer.objects.all()[0].username, RTESServer.objects.all()[0].password)
                if get_network(token) < 0:
                    add_network(token, get_free_network(token))
                rtes.create_stream(token, rtes_config.name, channel_id, instance.sink.sink.sink.ip, instance.sink.sink.sink.port, instance.ip, instance.port, get_network(token))
                create_entitlement(token, channel_id, get_network(token))
                admin.logout(token)
                save_db_entitlement(channel_id, instance.sink.sink.sink.ip, instance.sink.sink.sink.port, instance.ip, instance.port)
            else:
                pass