Hi List,
i'm using vdr 2.2.0-r5 + vnsi + kodi and I wonder if there is a way to automatically filter encrypted tv channels from channels.conf.
My Problem is, that new channels are constantly added but pay TV channels can't be encrypted. So I have to remove them manually once a week or so. Disabling auto-adding new channels would require me to manually scan once in a while. Disabling it is the best "solution" I came up with until now.
If there would be a way to periodically filter them (e.g. at night), I would be very happy.
Regards, Daniel
On 05.04.20 17:57, Daniel wrote:
If there would be a way to periodically filter them (e.g. at night), I would be very happy.
svdrpsend lstc with some cut and grep magic should do the trick. Something like:
svdrpsend -p2001 lstc | grep -v OBSOLETE -a | cut -d":" -f1,11,12 | grep -va ":1:" | cut -d"-" -f2
would return a list of all channels that have a CA defined. Adding another cut would allow you to put it into a for loop inside bash.
Vom: Sun, 5 Apr 2020 19:39:45 +0200
svdrpsend -p2001 lstc | grep -v OBSOLETE -a | cut -d":" -f1,11,12 | grep -va ":1:" | cut -d"-" -f2
would return a list of all channels that have a CA defined. Adding another cut would allow you to put it into a for loop inside bash.
Thank you. I'm not sure what this does. Are channels with defined CA encrypted?
Meaning, when field 11 in channels.conf is 1 it is free and if it's != 1 it's encrypted?
regards, Daniel
Vom: Sun, 5 Apr 2020 23:42:30 +0200
On 05.04.20 19:53, Daniel wrote:
Meaning, when field 11 in channels.conf is 1 it is free and if it's != 1 it's encrypted?
That is my understanding of man 5 vdr
Hm, how do you read it's field 11 from man 5 vdr? It totally confused me since the CHANNELS section mentions from left to right documentation of fields:
Name, Frequency, Parameters, Source, Strate, VPID, APID, TPID, Conditional access, SID, NID, TID and RID
which would make field 11 the NID and field 9 the conditional access field.
My channels.conf has 13 fields. An example line would be
SWR RP HD;ARD:330000:C0M256:C:6900:5131=27:0;5132=deu@106,5133=mis@106:5134;5135=deu:0:10304:1:1051:0
So if it's field 9, then
cut -d":" -f1,9 /etc/vdr/channels.conf | grep -E ':0$'
should display only free channels, but it also displays
Eurosport360HD 5,Eurosp360 5;SKY:378000:C0M256:C:6900:0:0:0:0:310:133:4:0
(complete line) for example.
If it's field 11, then only free channels are listed but some free channels are missing, like
PHOENIX HD;ARD:474000:C0M256:C:6900:581=27:0;582=deu@106,583=mul@106:584:0:10331:61441:10009:0
Is something wrong with my file? Kodi can show PHOENIX HD and can't decrypt Eurosport360HD 5
I'm not sure if it's ok to paste my complete channels.conf for clarification to the list (if that helps). It has 463 lines.
Regards, Daniel
On 06.04.20 00:10, Daniel wrote:
Vom: Sun, 5 Apr 2020 23:42:30 +0200
On 05.04.20 19:53, Daniel wrote:
Meaning, when field 11 in channels.conf is 1 it is free and if it's != 1 it's encrypted?
The CA ID is stored in field number 9.
'1' means that this channel is "hardwired" to device 1, whether it's encrypted or not. Generally hardwiring channels to devices is not recommended.
'0' means the channel is FTA (free to air, unencrypted). Values greater than 0xFF define the CA ID of that channel, which means it is encrypted. There can be more than one CA ID for a given channel, as in "98C,9C4,98D".
That is my understanding of man 5 vdr
Hm, how do you read it's field 11 from man 5 vdr? It totally confused me since the CHANNELS section mentions from left to right documentation of fields:
Name, Frequency, Parameters, Source, Strate, VPID, APID, TPID, Conditional access, SID, NID, TID and RID
which would make field 11 the NID and field 9 the conditional access field.
You are right, it is field 9.
My channels.conf has 13 fields. An example line would be
SWR RP HD;ARD:330000:C0M256:C:6900:5131=27:0;5132=deu@106,5133=mis@106:5134;5135=deu:0:10304:1:1051:0
So if it's field 9, then
cut -d":" -f1,9 /etc/vdr/channels.conf | grep -E ':0$'
should display only free channels, but it also displays
Eurosport360HD 5,Eurosp360 5;SKY:378000:C0M256:C:6900:0:0:0:0:310:133:4:0
(complete line) for example.
If this is an encrypted channel, then the provider doesn't broadcast the CA ID according to the DVB standard.
If it's field 11, then only free channels are listed but some free channels are missing, like
PHOENIX HD;ARD:474000:C0M256:C:6900:581=27:0;582=deu@106,583=mul@106:584:0:10331:61441:10009:0
Is something wrong with my file? Kodi can show PHOENIX HD and can't decrypt Eurosport360HD 5
I'm not sure if it's ok to paste my complete channels.conf for clarification to the list (if that helps). It has 463 lines.
Just post two lines, one for an FTA channel and one for an encrypted channel.
Klaus
Vom: Mon, 6 Apr 2020 14:31:33 +0200
'1' means that this channel is "hardwired" to device 1, whether it's encrypted or not. Generally hardwiring channels to devices is not recommended.
'0' means the channel is FTA (free to air, unencrypted). Values greater than 0xFF define the CA ID of that channel, which means it is encrypted. There can be more than one CA ID for a given channel, as in "98C,9C4,98D".
Ah, so when I decode the hex number, any channel with CAID < 255 should be unencrypted and viewable? (I'm not getting what "device" means in this case)
Eurosport360HD 5,Eurosp360 5;SKY:378000:C0M256:C:6900:0:0:0:0:310:133:4:0
(complete line) for example.
If this is an encrypted channel, then the provider doesn't broadcast the CA ID according to the DVB standard.
Ah, that makes sense. (Well, it doesn't but it seems to be the case here). I suppose there is no easy way to cycle through channels from a script and actually try if they can be decoded?
Just post two lines, one for an FTA channel and one for an encrypted channel.
I think the problems are channels that don't follow the standard correctly as you said. Still:
FTA channel that can be displayed:
SWR RP HD;ARD:330000:C0M256:C:6900:5131=27:0;5132=deu@106,5133=mis@106:5134;5135=deu:0:10304:1:1051:0
channel marked as FTA but can't be displayed:
NHK WORLD-JAPAN (eng);Digital Free:546000:C0M256:C:6900:2931=2:2932=eng@3:0:0:53120:61441:10004:0
channel with CA ID (can't be displayed):
Euro Star (tur);Türkisch:546000:C0M256:C:6900:671=2:672=tur@3:0:1722,1834,9C7,1861,9FD,1854:53210:61441:10004:0
Regards, Daniel
On 06.04.20 14:49, Daniel Hiepler wrote:
Vom: Mon, 6 Apr 2020 14:31:33 +0200
'1' means that this channel is "hardwired" to device 1, whether it's encrypted or not. Generally hardwiring channels to devices is not recommended.
'0' means the channel is FTA (free to air, unencrypted). Values greater than 0xFF define the CA ID of that channel, which means it is encrypted. There can be more than one CA ID for a given channel, as in "98C,9C4,98D".
Ah, so when I decode the hex number, any channel with CAID < 255 should be unencrypted and viewable?
For simplicity, let's just assume that FTA channels have a CA ID of '0', while encrypted channels have something else. Any value between '1' and '255' (including) would have to be set manually, which I assume you never did.
(I'm not getting what "device" means in this case)
The 'device' is the receiver (the thing you connect the antenna cable to).
... FTA channel that can be displayed:
SWR RP HD;ARD:330000:C0M256:C:6900:5131=27:0;5132=deu@106,5133=mis@106:5134;5135=deu:0:10304:1:1051:0
This one has H.264 video (5131=27).
channel marked as FTA but can't be displayed:
NHK WORLD-JAPAN (eng);Digital Free:546000:C0M256:C:6900:2931=2:2932=eng@3:0:0:53120:61441:10004:0
This is MPEG video (2931=2).
channel with CA ID (can't be displayed):
Euro Star (tur);Türkisch:546000:C0M256:C:6900:671=2:672=tur@3:0:1722,1834,9C7,1861,9FD,1854:53210:61441:10004:0
Also MPEG video (671=2), but encrypted. You will need a CAM with a proper smartcard to decrypt this one.
Things to test:
- Can your output device play MPEG video? Some devices (like the Raspberry Pi, for instance) require a separate license for that.
- Do you receive any data from "NHK WORLD-JAPAN"? Check the log entries for "buffer stats" when switching to that channel, remaining on it for a while, and then switching to a different channel.
- If you record "NHK WORLD-JAPAN", does it produce a non-empty file?
Klaus
Vom: Mon, 6 Apr 2020 15:07:31 +0200
Thanks for explaining.
channel marked as FTA but can't be displayed:
NHK WORLD-JAPAN (eng);Digital Free:546000:C0M256:C:6900:2931=2:2932=eng@3:0:0:53120:61441:10004:0
This is MPEG video (2931=2).
Strange, it can't be played. VDR doesn't output anything with loglevel 3 when I switch to this channel.
Kodi log says:
2020-04-06 17:38:26.865 T:139778643008064 NOTICE: VideoPlayer::OpenFile: 2020-04-06 17:38:26.865 T:139778453800704 NOTICE: Creating InputStream 2020-04-06 17:38:26.865 T:139778453800704 ERROR: Error on dvdnav_open 2020-04-06 17:38:26.865 T:139778453800704 ERROR: CVideoPlayer::OpenInputStream - error opening [] 2020-04-06 17:38:26.865 T:139778453800704 NOTICE: CVideoPlayer::OnExit() 2020-04-06 17:38:26.878 T:139777123219200 ERROR: SignalQuality: Add-on 'VDR-Network-Streaming-Interface (VNSI) Server:127.0.0.1:34890' returned an error: server error 2020-04-06 17:38:27.119 T:139778643008064 NOTICE: CVideoPlayer::CloseFile() 2020-04-06 17:38:27.119 T:139778643008064 NOTICE: VideoPlayer: waiting for threads to exit 2020-04-06 17:38:27.119 T:139778643008064 NOTICE: VideoPlayer: finished waiting
could this be an issue with VNSI?
Things to test:
- Can your output device play MPEG video? Some devices (like the Raspberry Pi, for instance) require a separate
license for that.
It should be. I can playing MPEG container videos with kodi. I'm running kodi on gentoo with system ffmpeg libraries.
- Do you receive any data from "NHK WORLD-JAPAN"?
The EPG works.
Check the log entries for "buffer stats" when switching to that channel, remaining on it for a while, and then switching to a different channel.
- If you record "NHK WORLD-JAPAN", does it produce a non-empty file?
I can't tune that channel so no recording. And no log output.
I will try with another frontend/svdrpsend later.
Regards, Daniel
On 06.04.20 17:49, Daniel wrote:
...
channel marked as FTA but can't be displayed:
NHK WORLD-JAPAN (eng);Digital Free:546000:C0M256:C:6900:2931=2:2932=eng@3:0:0:53120:61441:10004:0
This is MPEG video (2931=2).
Strange, it can't be played. VDR doesn't output anything with loglevel 3 when I switch to this channel.
Kodi log says:
2020-04-06 17:38:26.865 T:139778643008064 NOTICE: VideoPlayer::OpenFile: 2020-04-06 17:38:26.865 T:139778453800704 NOTICE: Creating InputStream 2020-04-06 17:38:26.865 T:139778453800704 ERROR: Error on dvdnav_open 2020-04-06 17:38:26.865 T:139778453800704 ERROR: CVideoPlayer::OpenInputStream - error opening [] 2020-04-06 17:38:26.865 T:139778453800704 NOTICE: CVideoPlayer::OnExit() 2020-04-06 17:38:26.878 T:139777123219200 ERROR: SignalQuality: Add-on 'VDR-Network-Streaming-Interface (VNSI) Server:127.0.0.1:34890' returned an error: server error 2020-04-06 17:38:27.119 T:139778643008064 NOTICE: CVideoPlayer::CloseFile() 2020-04-06 17:38:27.119 T:139778643008064 NOTICE: VideoPlayer: waiting for threads to exit 2020-04-06 17:38:27.119 T:139778643008064 NOTICE: VideoPlayer: finished waiting
could this be an issue with VNSI?
VNSI is not an integral part of VDR. Have you tried watching the channel directly in VDR?
Things to test:
- Can your output device play MPEG video? Some devices (like the Raspberry Pi, for instance) require a separate
license for that.
It should be. I can playing MPEG container videos with kodi. I'm running kodi on gentoo with system ffmpeg libraries.
Please make these tests with plain vanilla VDR.
Klaus
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
On 06.04.20 18:23, Daniel wrote:
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.
That sounds rather odd.
I suppose the other unencrypted channels could work, too when I select the correct audio language.
There's no such thing as "correct audio language". It should work with any language.
As mentioned in my previous reply: please test with plain vanilla VDR, no VNSI or any other streaming stuff. Once things work there, you can add other output methods if you need to.
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.
You can use the SVDRP command NEXT to see if VDR is currently recording, or when the next recording will start.
Klaus
Vom: Tue, 7 Apr 2020 00:00:06 +0200
On 06.04.20 18:23, Daniel wrote:
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.
That sounds rather odd.
It makes sense to me. I configured german as only language and never noticed that CNN still works (only one audio stream, non-german). But channels with multiple audio streams (and no german one) didn't work.
I suppose the other unencrypted channels could work, too when I select the correct audio language.
There's no such thing as "correct audio language". It should work with any language.
It _seems_ like a vdr-plugin-vnsiserver issue. Still it's just a wild guess. Since this setting apparently fixed it, i didn't dig deeper.
As mentioned in my previous reply: please test with plain vanilla VDR, no VNSI or any other streaming stuff. Once things work there, you can add other output methods if you need to.
I tried to get the softhddevice-plugin to work for trying VDR without kodi but failed. (I didn't try too hard, tho).
You can use the SVDRP command NEXT to see if VDR is currently recording, or when the next recording will start.
Is there a way to test if VDR is currently tuned to a channel? Yesterday I learned that my thinking was wrong. I watched TV (no recording) and VDR was restarted at midnight while watching ;)
I tried "svdrpsend chan" but it always returns the first entry in channels.conf, no matter if kodi plays TV or not (or what channel it's tuned to).
I think there's a way for kodi but it'd be nice if my scripteroo could stay VDR-only.
Regards, Daniel
On 07.04.20 06:11, Daniel wrote:
Vom: Tue, 7 Apr 2020 00:00:06 +0200
On 06.04.20 18:23, Daniel wrote:
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.
That sounds rather odd.
It makes sense to me. I configured german as only language and never noticed that CNN still works (only one audio stream, non-german). But channels with multiple audio streams (and no german one) didn't work.
That must be a problem in the VNSI plugin or whatever. It works fine in plain VDR (just tested it). If none of the preferred languages is available, it selects the first one.
I suppose the other unencrypted channels could work, too when I select the correct audio language.
There's no such thing as "correct audio language". It should work with any language.
It _seems_ like a vdr-plugin-vnsiserver issue. Still it's just a wild guess. Since this setting apparently fixed it, i didn't dig deeper.
Well, if it works for you, that's fine.
... Is there a way to test if VDR is currently tuned to a channel? Yesterday I learned that my thinking was wrong. I watched TV (no recording) and VDR was restarted at midnight while watching ;)
VDR is *always* tuned to a (live) channel ;-).
I tried "svdrpsend chan" but it always returns the first entry in channels.conf, no matter if kodi plays TV or not (or what channel it's tuned to).
The CHAN command tells you which channel VDR itself is currently showing live. If you are watching with some streaming plugin, you need to ask that plugin.
Klaus
On 07.04.20 11:23, Klaus Schmidinger wrote:
The CHAN command tells you which channel VDR itself is currently showing live. If you are watching with some streaming plugin, you need to ask that plugin.
VNSI has no SVDRP interface and even if it had: One idea of having a VNSI server is that you can have a central server which provides TV to multiple Kodi instances. So actually there is not the one single channel which is tuned for VNSI but there could be many.
So it would be better if you ask Kodi itself. There is a web based API to do that.
Manuel
On 06.04.20 18:23, Daniel wrote:
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?
No need. Just use svdrpsend delc #channelnumber for a channel that you want deleted. That way, VDR keeps on running, and modifying the channnel.conf for you.
If I were you, I would run the svdrpsend command once for a channel, re-check in a script for new crypted channels, and re-run svdrpsend for the next one. Not efficient, but it will make sure that you never delete something that you don't want deleted.