SageTV Community  

Go Back   SageTV Community > SageTV Products > SageTV Linux
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Linux Discussion related to the SageTV Media Center for Linux. Questions, issues, problems, suggestions, etc. relating to the SageTV Linux should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-19-2010, 10:58 PM
jpwegas jpwegas is offline
Sage Expert
 
Join Date: May 2007
Posts: 502
GenericTunerPlugin 1.0 Released

The Generic Tuner Plugin is a new tuning plugin for SageTV.

It was created to move the complexities of tuning your myriad of recording devices from a poorly understood C library to the language of your choice.

The plugin acts as a passthru to a script or program called gentuner. gentuner can be written in whatever language you desire. It needs to accept several simple arguments on the command line and return results on stdout. gentuner is responsible for handing off the actual tuning work to the appropriate software (LIRC, 6200ch, panelctl, etc).

It can support multiple recording devices each with it's own independent tuning mechanism. For example, if you have four recording devices, two could be tuned using LIRC, one could use FireWire tuning, and one could send a command over the serial port to a robotic arm to poke a trained hamster to punch the keys on your favorite remote. Several example scripts are included in the distribution (sorry, hamster poking script not included).

Currently it has only been tested on Linux (since I don't own the server version for Windows or Mac), but may work on those platforms with modifications.

Wiki with configuration and install documentation: http://code.google.com/p/customsaget...ricTunerPlugin

Download: http://code.google.com/p/customsaget...Plugin-1.0.zip

GenericTunerPlugin is based on the ExternalCommandTunerPlugin and LIRCTuner, which are both derived from MultiDCTTunerDLL.

Thanks to Sean for letting me host everything on the customsagetv googlecode project page with his other excellent projects.

--John
Reply With Quote
  #2  
Old 03-20-2010, 06:50 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Nice going John. I know I'll be giving this a try when I hook my receiver again.

I think that if anyone is using my original external tuner plugin, then you can probably switch to this one, which offers more flexibility over the tuning and the # of tuners.
Reply With Quote
  #3  
Old 06-02-2010, 07:41 PM
MrD MrD is offline
Sage Aficionado
 
Join Date: Feb 2005
Location: Washington DC
Posts: 387
This is a great plugin! Thanks for pushing this out. Now that the USB port on my H21-200 box is dead, I'll be using this approach.

I wanted to make a few comments:

NB: I am using the Sage 7 beta -- perhaps the behavior is different on 6.x

The path to gentuner is hard coded to /opt/sagetv/server, obviously this can change per install (especially mine I was able to figure this out quickly and confirmed it by reading the source code. You may want to consider pulling the path / script from an environment variable set in the sage start script. Or maybe through the sage api but I am not sure what the api exposes.

The directions to update the sage properties file, do not completely work as stated. I used this technique but it did not work as expected. It took me a while to figure out that the REMOTES / KEYS APIs are called during the tuning setup; but by following the doc procedure to update the properties file, sage was passing in empty string for the pszPathName in LoadRemotes so that code was not working as expected. Then I went down the remove tuner process path and everything worked as expected.
__________________
[size=1]-MrD
=============
Linux Server 7.1.9 (1)HD300 (1) HD200 (1) HD100 (2) PC Clients
Intel Xeon L? 32Gb
CetonTV cable card /FIOS
Reply With Quote
  #4  
Old 06-03-2010, 08:52 AM
loonsailor loonsailor is offline
Sage Advanced User
 
Join Date: Jul 2009
Location: Berkeley, CA, USA
Posts: 176
Thanks for posting that, MrD. I've been holding off on updating to the v7 beta because I rely on this plugin for tuning my two STBs via firewire, and wasn't sure it would work. Sounds like I should go ahead and take the plunge.
Reply With Quote
  #5  
Old 06-04-2010, 11:53 AM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
I can confirm it works as well.

B
__________________
Running SageTV on unRAID via Docker
Tuning handled by HDHR3-6CC-3X2 using OpenDCT
Reply With Quote
  #6  
Old 06-07-2010, 07:57 PM
jpwegas jpwegas is offline
Sage Expert
 
Join Date: May 2007
Posts: 502
Quote:
Originally Posted by MrD View Post
This is a great plugin! Thanks for pushing this out. Now that the USB port on my H21-200 box is dead, I'll be using this approach.
Thanks!

Quote:
Originally Posted by MrD View Post
I wanted to make a few comments:

NB: I am using the Sage 7 beta -- perhaps the behavior is different on 6.x

The path to gentuner is hard coded to /opt/sagetv/server, obviously this can change per install (especially mine I was able to figure this out quickly and confirmed it by reading the source code. You may want to consider pulling the path / script from an environment variable set in the sage start script. Or maybe through the sage api but I am not sure what the api exposes.
The behavior is the same in Sage 6.

Not having the gentuner path hardcoded in the plugin (by either inferring the location from Sage itself or having it defined in the Sage.properties file) is on my list of things to improve.

Quote:
Originally Posted by MrD View Post
The directions to update the sage properties file, do not completely work as stated. I used this technique but it did not work as expected. It took me a while to figure out that the REMOTES / KEYS APIs are called during the tuning setup; but by following the doc procedure to update the properties file, sage was passing in empty string for the pszPathName in LoadRemotes so that code was not working as expected. Then I went down the remove tuner process path and everything worked as expected.
I think I ran into this too when I was testing but I didn't have time to figure out a good way to work around it.

Ideally Sage would allow you to select the tuning plugin after a tuner is set up but there isn't a way to do that. Instead, I was hoping to be able to just change the plugin defined in the properties file so that people didn't have to recreate the tuner, but for some reason that doesn't work as I expected.

I will do some more testing on this the next time I dig into the code. Meanwhile, I will update the instructions on the wiki.

Thanks for the feedback!

--John
Reply With Quote
  #7  
Old 06-11-2010, 02:56 PM
jleonard78 jleonard78 is offline
New Member
 
Join Date: Jun 2010
Location: Marietta, PA
Posts: 4
Thanks!!!

Awesome plugin. Not only did you build on the old LIRCTuner, but you pretty much made it able to work with any external program and customized easily.

However, I am having problems getting SageTV to "blast" my commands. I can get everything working from the script in my terminal, and verify the results through the TV (bypassing SageTV). SageTV responds to the remote as well, but channels never change. SageTV even goes through the motions of re-tuning, but I only ever see what's playing on Channel 2.

I am using Sage 7 Beta, Hauppauge PVR 1600 MCE. Since this is the newer USB one, I am using LIRC for my remote/blaster...(and the reason why your plugin was needed so badly by me). I am not using any other special plugins or extras for SageTV - a basic config.

I am using the Composite input on the card, but had the same problem when trying to use the Analog tuner.

I followed all your steps and used the default paths for the plugin.

Permissions on /opt/sagetv/server/gentuner are as follows:

-rwxr-xr-x (755)


Ownership of file is root:root

Obviously, my powers of deduction tell me that somehow, the script is never actually getting run.


My gentuner.log looks something like this:

2010-06-11 14:28 INFO: Generic Tuner, Version 1.1, Revision 287
2010-06-11 14:28 DEBUG: OpenDevice: 0


...followed by a whole bunch of entries like this...


2010-06-11 14:29 DEBUG: LoadRemotes: Remote: StubDevice
2010-06-11 14:29 DEBUG: LoadRemotes: Using command: /opt/sagetv/server/gentuner REMOTES


and eventually, a whole bunch of these...


2010-06-11 16:40 DEBUG: LoadRemotes: Found Remote: DCT2000
2010-06-11 16:40 DEBUG: CreateRemote: Remote: DCT2000
2010-06-11 16:40 DEBUG: LoadRemoteKeys: Using command: /opt/sagetv/server/gentuner KEYS DCT2000


At some point I get this...


2010-06-11 16:40 DEBUG: LoadRemotes: Found Remote: mceusb
2010-06-11 16:40 DEBUG: CreateRemote: Remote: mceusb
2010-06-11 16:40 DEBUG: LoadRemoteKeys: Using command: /opt/sagetv/server/gentuner KEYS mceusb


For one, I'm not sure what OpenDevice: 0 refers to. Does that mean it's trying to use lirc0? Because lirc1 is my blaster. Anyway, it seems to me that SageTV is not even using the right commands. It just keeps getting a key list but I never see any SEND commands.

Am I simply just missing something silly?
Reply With Quote
  #8  
Old 06-11-2010, 03:59 PM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
Two things:

Did you select the remote in the tuner settings? StubDevice is the default remote.

Can you post the gentuner script you're using? I am inserting mine here
Code:
#!/bin/bash
#
# gentuner.LIRC
# GenericTunerPlugin to LIRC Connector
#
# See gentuner.README for details on gentuner
#
# This script proxies commands from the Generic Tuner Plugin
# to LIRC. If the remote name defined in the lircd.conf file
# ends in "-N" (where N is 1, 2, 3 or 4), it will also 
# use SET_TRANSMITTERS to restrict which emitters LIRC uses.
# Your LIRC hardware must support this feature.
#

CMD=$1
REMOTE=$2
KEY=$3
CHANNEL=$3
DELAY=.8
LOCKFILE=/tmp/lirclock

REMOTE_OVERRIDE=directtv
LIRC_ENTERCMD=enter
TRANS_REMOTE=CommandIR
TRANS_REMOTE_CMD="settransmitters-"

case "$CMD" in
    REMOTES)
        /usr/bin/irsend LIST "" "" 2>&1 | cut -d" " -f2
        ;;
         
    KEYS)
        if [ ! $REMOTE ]; then
            echo "Usage: $0 KEYS REMOTE"
            echo "To see a list of remotes execute: $0 REMOTES"
        else
            /usr/bin/irsend LIST "$REMOTE" "" 2>&1 | cut -d" " -f3
        fi
        ;;
    
    SEND)
        while [ -f $LOCKFILE ]
        do
            #echo "Waiting for lock"
            sleep $DELAY
        done

        touch $LOCKFILE
		POST=${REMOTE:(-2)}
	    TRANSMITTER_NUM=${REMOTE:(-1)}
	    
	    if [ $REMOTE_OVERRIDE ]; then REMOTE=$REMOTE_OVERRIDE; fi
        if [[ ! $2 || ! $3 ]]; then
            echo "Usage: $0 SEND REMOTE KEY"
            echo "To see a list of remotes execute: $0 REMOTES"
            echo "To see a list of supported keys execute: $0 KEYS REMOTE"
        else
            if [[ ${POST/-[1-9]/OK} = "OK" ]]; then
                /usr/bin/irsend SET_TRANSMITTERS $TRANSMITTER_NUM
                sleep $DELAY
            else
                /usr/bin/irsend SET_TRANSMITTERS 1 2 3 4
                sleep $DELAY
            fi
            /usr/bin/irsend SEND_ONCE $REMOTE $KEY
            sleep $DELAY
        fi
        rm $LOCKFILE
        ;;
    
    TUNE)
        
        while [ -f $LOCKFILE ]
        do
            #echo "Waiting for lock"
            sleep $DELAY
        done

        touch $LOCKFILE
		POST=${REMOTE:(-2)}
	    TRANSMITTER_NUM=${REMOTE:(-1)}
	    
	    if [ $REMOTE_OVERRIDE ]; then REMOTE=$REMOTE_OVERRIDE; fi
        if [[ ! $2 || ! $3 ]]; then
            echo "Usage: $0 TUNE REMOTE KEY"
            echo "To see a list of remotes execute: $0 REMOTES"
            echo "To see a list of supported keys execute: $0 KEYS REMOTE"
        else
            if [[ ${POST/-[1-9]/OK} = "OK" ]]; then
                if [ $TRANS_REMOTE ]; then
                    /usr/bin/irsend send_once ${TRANS_REMOTE} ${TRANS_REMOTE_CMD}${TRANSMITTER_NUM}
                else
                    /usr/bin/irsend SET_TRANSMITTERS ${TRANSMITTER_NUM}
                    sleep $DELAY
                fi
            else
                /usr/bin/irsend SET_TRANSMITTERS 1 2 3 4
                sleep $DELAY
            fi
            sleep $DELAY
            /usr/bin/irsend send_once $REMOTE $LIRC_ENTERCMD
            sleep $DELAY
            for (( x = 0 ; x < ${#CHANNEL} ; x++ )); do
                irsend send_once $REMOTE "${CHANNEL:$x:1}"
                sleep $DELAY
            done 
            /usr/bin/irsend send_once $REMOTE $LIRC_ENTERCMD
        fi
        rm $LOCKFILE
        ;;
    
    CAN_TUNE)
        echo "OK"
        ;;
         
    *)
    echo $"Usage: $0 {REMOTES|KEYS|SEND|TUNE|CAN_TUNE}"
    exit 1
B
__________________
Running SageTV on unRAID via Docker
Tuning handled by HDHR3-6CC-3X2 using OpenDCT
Reply With Quote
  #9  
Old 06-11-2010, 08:52 PM
jpwegas jpwegas is offline
Sage Expert
 
Join Date: May 2007
Posts: 502
Quote:
Originally Posted by jleonard78 View Post
Awesome plugin. Not only did you build on the old LIRCTuner, but you pretty much made it able to work with any external program and customized easily.
Thanks!

Quote:
Originally Posted by jleonard78 View Post
However, I am having problems getting SageTV to "blast" my commands. I can get everything working from the script in my terminal, and verify the results through the TV (bypassing SageTV). SageTV responds to the remote as well, but channels never change. SageTV even goes through the motions of re-tuning, but I only ever see what's playing on Channel 2.

I am using Sage 7 Beta, Hauppauge PVR 1600 MCE. Since this is the newer USB one, I am using LIRC for my remote/blaster...(and the reason why your plugin was needed so badly by me). I am not using any other special plugins or extras for SageTV - a basic config.

I am using the Composite input on the card, but had the same problem when trying to use the Analog tuner.

I followed all your steps and used the default paths for the plugin.

Permissions on /opt/sagetv/server/gentuner are as follows:

-rwxr-xr-x (755)


Ownership of file is root:root

Obviously, my powers of deduction tell me that somehow, the script is never actually getting run.


My gentuner.log looks something like this:

2010-06-11 14:28 INFO: Generic Tuner, Version 1.1, Revision 287
2010-06-11 14:28 DEBUG: OpenDevice: 0


...followed by a whole bunch of entries like this...


2010-06-11 14:29 DEBUG: LoadRemotes: Remote: StubDevice
2010-06-11 14:29 DEBUG: LoadRemotes: Using command: /opt/sagetv/server/gentuner REMOTES


and eventually, a whole bunch of these...


2010-06-11 16:40 DEBUG: LoadRemotes: Found Remote: DCT2000
2010-06-11 16:40 DEBUG: CreateRemote: Remote: DCT2000
2010-06-11 16:40 DEBUG: LoadRemoteKeys: Using command: /opt/sagetv/server/gentuner KEYS DCT2000


At some point I get this...


2010-06-11 16:40 DEBUG: LoadRemotes: Found Remote: mceusb
2010-06-11 16:40 DEBUG: CreateRemote: Remote: mceusb
2010-06-11 16:40 DEBUG: LoadRemoteKeys: Using command: /opt/sagetv/server/gentuner KEYS mceusb


For one, I'm not sure what OpenDevice: 0 refers to. Does that mean it's trying to use lirc0? Because lirc1 is my blaster. Anyway, it seems to me that SageTV is not even using the right commands. It just keeps getting a key list but I never see any SEND commands.

Am I simply just missing something silly?
Don't worry about the OpenDevice entry. That's sort of a leftover from when the original code (pre-LIRCTuner actually) used com ports.

The "Found Remote" lines means that the gentuner script is being called and is returning values to the plugin for the REMOTES command.

Both of bcjenkins' comments are spot on - basically either:
  • You need to select which remote you want to use (DCT2000 or mceusb) in the Source Details screen. At the bottom of the Source Details screen you should see "Tuner Control: Generic Tuner REMOTE". If REMOTE is StubDevice, just click it and then click "Change Tuning Device" then select the correct remote.
  • The correct remote name is being sent but the gentuner script isn't recognizing it.
If you see any lines in the log that say something like "PlayCommand: Using command: /opt/sagetv/server/gentuner SEND StubDevice 0", check the first item above.

I suspect it's the first item since you mentioned you are using LIRC, and you shouldn't need to modify the sample gentuner.LIRC script at all.

If those two things look ok, please attach or PM me the whole gentuner.log file (or the last 200 lines or so).

--John
Reply With Quote
  #10  
Old 06-12-2010, 09:28 AM
jleonard78 jleonard78 is offline
New Member
 
Join Date: Jun 2010
Location: Marietta, PA
Posts: 4
Working now!

Thanks guys for your quick responses. Indeed, that's all I needed to do. I didn't even realize you could configure stuff from the Source summary screen. Sure enough, though, I was able to change StubDevice to DCT2000 and all is well!!!

Just in time, too - tomorrow would have been day 30 since my Linux version purchase, so I was anxious to get things working 100%...I didn't want to have to try switch to Winbloze.

Eventhough Sage doesn't officially support Linux well, it's good to see a reasonable core of 3rd party help.

I really like this plugin alot. If I had more time, I would definitely configure some other scripts for it. But knowing it's just a bash script will make it easy for me to control my emulators, games and other programs as well. I can handle bash scripting!
Reply With Quote
  #11  
Old 06-12-2010, 03:23 PM
jpwegas jpwegas is offline
Sage Expert
 
Join Date: May 2007
Posts: 502
Quote:
Originally Posted by jleonard78 View Post
Eventhough Sage doesn't officially support Linux well, it's good to see a reasonable core of 3rd party help.
I've always gotten good support from Sage on the Linux product. Even though it's technically an OEM product, they have always been responsive. And just like the other platforms, there's lots of people on the forums who offer help.

Quote:
Originally Posted by jleonard78 View Post
I really like this plugin alot. If I had more time, I would definitely configure some other scripts for it. But knowing it's just a bash script will make it easy for me to control my emulators, games and other programs as well. I can handle bash scripting!
Remember gentuner doesn't have to be a bash script - it could be written in any language you are comfortable with as long as it responds to the commands as described in the README file.

Glad it's working for you!

--John
Reply With Quote
  #12  
Old 07-27-2010, 12:20 AM
SuiDog's Avatar
SuiDog SuiDog is offline
Sage User
 
Join Date: Feb 2009
Posts: 57
Where would I get the updated panelctl that supports multiple STB's?
__________________
Server: i3 530 dual 2.93Ghz, 6GB mem, 2x 3TB 7200 rpm sata drives, Windows 7 ultimate 64-bit,Sagetv7.1.8 Beta
Clients: 3x Hauppauge MediaMVP, 1x HD200, 1X HD300.
TV provider: Comcast Digital, Up to 8 recordings at one time. Ceton 4 tuner cable card. 2x Dual Tuner HDHomeRun's (SageDCT 1.4 Ceton 1.0.6.1
Reply With Quote
  #13  
Old 07-27-2010, 10:20 PM
loonsailor loonsailor is offline
Sage Advanced User
 
Join Date: Jul 2009
Location: Berkeley, CA, USA
Posts: 176
panelctl

Though I submitted the new panelctl to libavc1394 many months ago, it's still not in the released version. It is in the main development trunk, however. So, you get it by getting a copy of the development source and building and installing it.

>svn co https://libavc1394.svn.sourceforge.n...oot/libavc1394 libavc1394
>cd libavc1394/trunk/libavc1394
>autoreconf -f -i
>./configure
>make
>sudo make install

Check and make sure that panelctl is version .2 or greater (>panelctl -V). ">panelctl --help" gives you a list of commands.

I e-mailed the head of the libavc1394 project today, and he told me that he'd do a new release soon, and move this into the current version. It's up to the distros, though, to decide when to make that new version be the default.
Reply With Quote
  #14  
Old 08-19-2010, 05:06 PM
loonsailor loonsailor is offline
Sage Advanced User
 
Join Date: Jul 2009
Location: Berkeley, CA, USA
Posts: 176
What steps to move to v7?

I use gentuner in Sage V6, and it works great. I'm going to go to the V7 beta soon. When I do, will the gentuner plugin be configured automatically, or do I need to do anything to make it work?

Thanks.
Reply With Quote
  #15  
Old 08-19-2010, 05:14 PM
loonsailor loonsailor is offline
Sage Advanced User
 
Join Date: Jul 2009
Location: Berkeley, CA, USA
Posts: 176
New panelctl is now in the default libavc1394 release

I just checked, and the updated panelctl, with flexible control of multible STBs by firewire, is now the default provided by the libavc1394 project. Unfortunately, it hasn't been picked up by any of the distro's yet, to my knowledge. You can get it from http://sourceforge.net/projects/libavc1394/. Just download the release (0.5.4 or higher) and install according to directions.

Hopefully, this will make it into ubuntu and other distros at some point.
Reply With Quote
  #16  
Old 08-19-2010, 05:49 PM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
Quote:
Originally Posted by loonsailor View Post
I use gentuner in Sage V6, and it works great. I'm going to go to the V7 beta soon. When I do, will the gentuner plugin be configured automatically, or do I need to do anything to make it work?

Thanks.
It works fine in 7.0.
__________________
Running SageTV on unRAID via Docker
Tuning handled by HDHR3-6CC-3X2 using OpenDCT
Reply With Quote
  #17  
Old 08-20-2010, 08:58 PM
loonsailor loonsailor is offline
Sage Advanced User
 
Join Date: Jul 2009
Location: Berkeley, CA, USA
Posts: 176
I upgraded to v7, and the plugin works perfectly straight out of the gates. However, I don't see it in the plugin manager. Should I?
Reply With Quote
  #18  
Old 08-21-2010, 06:04 AM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
No, just use it the same way as you did in 6. If jpwegas ever gets around to making it an official plugin, we might get that.

B
__________________
Running SageTV on unRAID via Docker
Tuning handled by HDHR3-6CC-3X2 using OpenDCT
Reply With Quote
  #19  
Old 08-22-2010, 07:10 PM
jpwegas jpwegas is offline
Sage Expert
 
Join Date: May 2007
Posts: 502
Quote:
Originally Posted by bcjenkins View Post
If jpwegas ever gets around to making it an official plugin, we might get that.
I'm not sure whether I'd be able to use the plugin manager - isn't that only for STV plugins?

--John
Reply With Quote
  #20  
Old 08-22-2010, 07:24 PM
jpwegas jpwegas is offline
Sage Expert
 
Join Date: May 2007
Posts: 502
Quote:
Originally Posted by jpwegas View Post
I'm not sure whether I'd be able to use the plugin manager - isn't that only for STV plugins?
Nevermind, just found the plugin developers guide - the plugin manager supports various types of plugins, including simple collections of files (i.e. channel logos).

But currently in the case of this plugin there may also be some manual user customization required as well. I'll have to think about how to implement that for a few of the common cases to avoid the customization.

--John
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SageTV V6.4 has been released! Opus4 Announcements 0 08-18-2008 04:27 PM
SageTV V6.2 has been released! Narflex Announcements 0 09-17-2007 05:09 PM
Now that Vista has been released mightyt General Discussion 32 02-16-2007 05:17 AM
Java 6.0 is released nielm General Discussion 54 02-05-2007 09:27 PM
SageTV V6.0.19 Released Narflex SageTV Software 0 12-28-2006 01:17 PM


All times are GMT -6. The time now is 12:30 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.