pipelka / vdr-plugin-xvdr

DISCONTINUED - XVDR Plugin for VDR
GNU General Public License v2.0
43 stars 22 forks source link

Reorder VDR channels.conf #87

Closed AndreyPavlenko closed 11 years ago

AndreyPavlenko commented 11 years ago

This is a new feature that allows to reorder VDR channels list, before sending it to XBMC, with an external script or program. The feature is only enabled if the configuration parameter ReorderCmd is set, otherwise it should not impact on the currently implemented functionality.

I've tested it with this https://github.com/AndreyPavlenko/chorder script and below configuration:

ReorderCmd = /opt/chorder/chorder -X /opt/chorder/examples/channels.conf.exclude -F /opt/chorder/examples/channels.conf.fields -t /opt/chorder/examples/channels.conf.template

pipelka commented 11 years ago

I love geeky features ;-)

Yeah. This looks quite promising and opens a universe of opportunities. Before merging I want to test this for any possible side-effects (didn't see anything harmful, but who knows).

Maybe more detailed configuration instructions (maybe with a link to your repo) should go into the configuration / readme file.

Give my a couple of days to test and play around with it.

Thanks, Alex

AndreyPavlenko commented 11 years ago

Thanks Alexander. I'll also proceed testing this and let you know if find something.

AndreyPavlenko commented 11 years ago

Just discovered for myself... :) This feature allows having duplicate channels in different groups, which is not possible with VDR.

n37 commented 11 years ago

I wonder if this could be done on the client side so that different clients connecting to the same server could be served different channel lists.

pipelka commented 11 years ago

How about adding the IP address of the client to an environment variable (e.g IP). The server-script could check $IP.

AndreyPavlenko commented 11 years ago

I thought about adding IP as script argument, but this solution, with env variable, seems much better.

n37 commented 11 years ago

How about a new config file similar to allowed_hosts.conf, e.g. channel_reorder.conf, which contains the ip-script associations? Something like:

127.0.0.1 group_channels1.sh 192.168.0.0/16 group_channels2.sh 192.168.1.15 group_channels3.sh ...

Or even add the script name to allowed_hosts.conf and if there is no script name - no reordering.

AndreyPavlenko commented 11 years ago

I believe it's not difficult to implement in a shell script with single case statement. A separate config file would be redundant.

pipelka commented 11 years ago

Hehe,.. Andrey was faster. Yes. Thats exactly also my opinion.

n37 commented 11 years ago

For me having different scripts for different clients seem more practical. If you want to disable reordering for some client you could either delete the association in the config file or delete the script itself (unless it is used by some other client). If you want to edit the reordering mechanism for a particular client, you just have to edit his script, instead of editing one single big script, which could potentially disrupt the viewing of other clients if you somehow mess things up.

AndreyPavlenko commented 11 years ago

You may have multiple scrits, but, instead of a separate config, one more script with a single case statement. Something like this:

reorder.sh:

!/bin/sh

case "$IP" in 127.0.0.1) exec reorder1.sh ;; .... esac

n37 commented 11 years ago

This is no different from having a config file plus multiple scripts, only in this case the "config" file is a bit more complicated. Adding the script name as an optional field to allowed_hosts.conf does not even create a redundant config file. ;)

pipelka commented 11 years ago

We could add a "multiip" script mimicking the functionality n37 needs.

The config would be:

ReorderCmd = /path/to/scripts/multiip.sh /path/to/config/multiip.conf

With multiip.conf:

IP1 script1.sh
IP2 script2.sh
..
n37 commented 11 years ago

Is there any development on this? Is it possible to use IP as an environment variable of the reorder script? The config options would be nice but the functionality is more important.

niko2 commented 10 years ago

Hi, I cannot use it with xbmc. I thought my version was too old, but running "strings" on .so file confirmed me that channelfilter is compiled.... I found /var/lib/vdr/plugins/xvdr/channelcache.data so I removed it to be sure.

I deactived/reactivated/restart xbmc, nothing changes, I still have channels.conf in xbmc

perhaps it is not activated in vdr < 1.7.34 ?

I am running vdr 1.7.28, xvdr 0.9.8 and openelec 3.2.0

AndreyPavlenko commented 10 years ago

Have you tried to Reset PVR database in XBMC? If you've properly configured xvdr, you should find message 'Reordering xxx channels with command' in system log.

niko2 commented 10 years ago

Yes I tried to. Nothing is logged concerning filtering (info, warn of error) Concerning xvdr configuration, I had to use a wrapper on chorder because ReorderCmd does not accept arguments (even with double quotes).Then I use : ReorderCmd = /usr/local/bin/mychorder $ cat /usr/local/bin/mychorder

!/bin/bash

/usr/local/bin/chorder -X /etc/chorder/channels.conf.exclude -t /etc/chorder/channels.conf.template

I have finally tried the main (I think) problem, but I don't have the solution : I tried to run mychorder with the same user as vdr daemon

sudo -u vdr /usr/local/bin/mychorder /usr/local/bin/chorder: 154: cannot open /dev/stdin: Permission denied /usr/local/bin/chorder: 254: cannot create /dev/stdout: Permission denied

I am running Debian squeeze (openmediavault) adding tty group to vdr user does not work in fact, no pts is assigned until user is connected through ssh. Then all users use /dev/pts/0 (or something symbolicilly linked to), wich is owned by root Even googling, I didn't find any solution to read from stdin and write to stdout

my very last solution was to chmod 660 /dev/pts/0, 1 and 2 (which works, but...)

niko2 commented 10 years ago

right solution is to change TTYMODE in /etc/default/devpts and reboot :)

niko2 commented 10 years ago

no more result, even if vdr has rights to access /dev/stdin and /dev/stdout (thanks to sudo)