Ivtv-channel

From IVTV

Jump to: navigation, search

ivtv-channel is an utility to change channels with a remote control. It is designed to work along with LIRC. It is very useful for watching ivtv in standalone applications such as VLC or MPlayer.

Contents

Requirements

  • Python >= 2.4
  • Ivtv utilities >= 0.4

As far as I know it's compatible all the way back to 0.4, either way, it detects the major API change in 0.8 and works automatically across all recent versions.

Download

The latest version of the script can be downloaded here. Only tagged (final) released versions should be used, but the trunk development version is also available in that repository.

An RSS feed of releases can be found here.

Usage

  • Copy the script to somewhere where your irexec daemon can use it (read+execute permissions for the user calling irexec).
  • Edit your ~/.lircrc to make use of the script. Make sure to fine tune it to your remote (see below)
  • Finally execute irexec & and it should work.
# The following is an example into how to integrate this script with LIRC.
# Execute irexec & to make it work.
#--------------------------------------------------
# File: ~/.lircrc (This works with the '''Hauppage 350 grey remote''')
#--------------------------------------------------
 begin
     button = Ch+
     prog = irexec
     config = python /path/to/ivtv-channel.py up
 end
 begin
 	button = Ch-
 	prog = irexec
	config = python /path/to/ivtv-channel.py down
 end
 begin
 	button = OK
 	prog = irexec
        config = python /path/to/ivtv-channel.py enter
 end
 begin
 	button = Prev.Ch
 	prog = irexec
	config = python /path/to/ivtv-channel.py last
 end
 begin
 	button = 0
	prog = irexec
	config = python /path/to/ivtv-channel.py 0 &
 end
 begin
 	button = 1
	prog = irexec
	config = python /path/to/ivtv-channel.py 1 &
 end
 begin
 	button = 2
	prog = irexec
	config = python /path/to/ivtv-channel.py 2 &
 end
 begin
	button = 3
	prog = irexec
	config = python /path/to/ivtv-channel.py 3 &
 end
 begin
 	button = 4
	prog = irexec
	config = python /path/to/ivtv-channel.py 4 &
 end
 begin
 	button = 5
	prog = irexec
	config = python /path/to/ivtv-channel.py 5 &
 end
 begin
 	button = 6
        prog = irexec
        config = python /path/to/ivtv-channel.py 6 &
 end
 begin
 	button = 7
	prog = irexec
	config = python /path/to/ivtv-channel.py 7 &
 end
 begin
 	button = 8
	prog = ireec
	config = python /path/to/ivtv-channel.py 8 &
 end
 begin
 	button = 9
	prog = irexec
	config = python /path/to/ivtv-channel.py 9 &
 end
#-------------------------------------------------- 

Standalone usage

ivtv-channel (up|down|last|enter|channel number)

Troubleshooting

Please report all bugs and feature requests to the email address in the script and make sure to include the following:

  • Your .lircrc file (if it differs from my recommendation, if not, please double check it before reporting a bug)
  • The distribution you are running, python version, ivtv version and version of this script (see version option)
  • Details about what card/remote controler you are running, and the version of lirc and its source (i.e, official, or from your distribution)
  • A full output of the problem with ivtv-channel verbosity variable set to True (see script).

Developer information

This script does support changing to channels > 10 by using pickle and datetime to serialize timestamps into a /tmp file and comparing them. When two processes of this script are run asynchronously (see the & in the .lircrc example) they manage to check through a series of tests and timeouts if another button was pressed, or the alloted time has passed. Anyhow, all you need to know is that it works, and if you want, you can change the waiting periods by editing the code, though I do not recommend it, as 3 seconds between each button press works fine.

The code for getting the last button works by using pickle and a list of the last two channels tuned. The verbosity of the script can be changed through a variable at the beginning of the code. I thought about using PyLirc, but I wanted to reduce dependencies to a minimum.

TODO

The following is a list of things to be done in the script, if you want to submit patches, please do so. I am willing to commit them quickly.

  1. Implement first and last channel support, so it doesn't try to change to invalid channels.
  2. Implement VBI/CC support.
  3. Implement an option to get the currently tuned channel
  4. Comment and cleanup the code
Personal tools
development