Re: Filtering encrypted channels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vom: Mon, 6 Apr 2020 15:07:31 +0200

I've fiddled with the settings and when I changed "Audio-Languages" from 1 to 2
and configured Language 1 to german and 2 to english, I could switch to NHK
WORLD-JAPAN which previously didn't work.

I suppose the other unencrypted channels could work, too when I select the
correct audio language.

I'm quite happy the way it is. Thank you so much Olly and Klas for your help!

Just another question: Is there a way to run the script before VDR starts to
tune to a channel? Or after it stops playback of any channel?

I would run the script at midnight and restart VDR to reload the new
channels.conf but when I record something, the recording would be interrupted
that way.
Maybe there's a better solution than checking if VDR is recording, then run the
script and if it's recording just wait for the next day?

Here is the simple python script I use to filter encrypted channels, in case
anyone is interested:

# --------------------------------------------------------------------
#!/usr/bin/env python3

"""filter encrypted channels from VDR channels.conf"""

import sys

# field definitions according to "man 5 vdr" and
# https://github.com/yavdr/vdr/blob/master/channels.c#L571
fields = {
    "full_name": 0,
    "frequency": 1,
    "parameters": 2,
    "source": 3,
    "srate": 4,
    "vpid": 5,
    "apid": 6,
    "tpid": 7,
    "caid": 8,
    "sid": 9,
    "nid": 10,
    "tid": 11,
    "rid": 12
}


if __name__ == "__main__":
    """Usage: vdr_filter_encrpyted.py /etc/vdr/channels.conf"""
    # parse channels.conf
    channels = []
    filename = sys.argv[1]

    with open(filename, encoding="latin-1") as channels_conf:
        for channel in channels_conf:
            # strip trailing newline
            channel = channel.rstrip()
            # split fields
            channels += [ channel.split(':') ]

    print(f"{len(channels)} channels read from {filename}.")

    # save free channels
    unencrypted_count = 0
    with open(filename, encoding="latin-1", mode="w") as channels_conf:
        for channel in channels:
            # is channel encrypted?
            if channel[fields["caid"]] != "0":
                # skip
                continue
            # write to channels.conf
            channels_conf.write(":".join(channel) + "\n")
            unencrypted_count += 1

    print(f"{unencrypted_count} unencrypted channels written")



Regards,
Daniel

_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr



[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux