# Commands

## Command Line

Commands can be given on the command line when Zapping starts. This was intended to change video device properties, the program terminates after executing the command.

`zapping -c "command"`

A separate, lightweight tool is planned for this purpose, and to send commands to a running Zapping process. Up to version 0.6.x these commands are available:

set_channel (name | number)

- Switch to the channel. By default the command tries to find the channel by its name (second column in the channel editor). When no such channel exists or the parameter is a number it selects the nth channel from the list, counted from zero up.

Starting with version 0.7 these commands are superseded by the new Python command set, see below.

## Keyboard Customization

Commands can be assigned to keyboard keys in the preferences. Starting with version 0.7 we use the new Python command set, see below.

The old command set listed here is automatically converted for compatibility with older versions of Zapping. The commands are generally equivalent to their new Python counterparts. Parameters in [square brackets] are optional.

- channel_up

- channel_down

- set_channel nth

- lookup_channel name

- mute [toggle]

- volume_incr [n]

- ttx_open_new [page [subpage]]

- ttx_page_incr [n]

- ttx_subpage_incr [n]

- ttx_home

- ttx_hold [toggle]

- ttx_reveal [toggle]

- screenshot [format]

- quickshot [format]

## LIRC/ALIRC Plugin

These commands are mostly superseded by the new Python command set, see below. They are still supported for compatibility with older versions of Zapping.

QUIT

- Terminate the program.

CHANUP

- Switch to the next channel in the list.

CHANDOWN

- Switch to the previous channel in the list.

SETCHANNEL n

- The function of this command is affected by the preferences setting for entering channel numbers on the numeric keypad. By the default it switches to the nth channel in the list, the count starts at zero. Alternatively the number is interpreted as the RF channel number of the requested channel.

  Single digits combine to numbers when the command is executed repeatedly within a short period. For example "SETCHANNEL 1", "SETCHANNEL 3" jumps to channel 13.

ZOOM

- Switch between fullscreen and windowed mode.

MUTE

- When audio is on, mute it, when muted switch it back on.

VOL_UP

- Increase the audio volume.

VOL_UP

- Decrease the audio volume.

## Python commands

Parameters in [square brackets] are optional. Parameters in 'single quotes' are strings, otherwise they are numbers. A toggle parameter can be zero to switch the property off, non-zero to switch it on, or it can be omitted to invert the current setting.

### General

zapping.quit()

- Terminate the program.

zapping.switch_mode('mode')

- Switch the current display mode. You can switch display mode and capture mode at once, for example: zapping.switch_mode('fullscreen capture').

  'window'

- display video or Teletext in a window

'fullscreen'

- display video or Teletext fullscreen

'background'

- like fullscreen, but puts the display in the background (if supported by the window manager)

'capture'

- display video in capture mode (starting with version 0.7.2 this will not switch to window mode)

'overlay'

- display video in overlay mode

'preview'

- display video in overlay mode (starting with version 0.7.2 this will not switch to window mode)

'teletext'

- display Teletext (starting with version 0.7.2 this will not switch to window mode)

zapping.toggle_mode('mode')

- Switch to this mode. When this is already the current mode, switch to the previous mode. You can switch display and capture mode at once, for example: zapping.switch_mode('fullscreen capture').

zapping.restore_mode('mode')

- Synonym for zapping.toggle_mode(), deprecated.

zapping.channel_up()

- Switch to the next channel in the list.

zapping.channel_down()

- Switch to the previous channel in the list.

zapping.set_channel(nth)

- Switch to the nth channel in the list, the count starts at zero.

zapping.lookup_channel('name')

- Switch to the channel with this name (second column in the channel editor).

zapping.resize_screen(width, height)

- Resize the video window.

zapping.picture_size_cycle([n])

- Switch to the next entry in the list of favourite picture sizes (as displayed in the context menu), +1 forward, -1 back.

zapping.hide_controls(toggle)

- Whether to hide the main menu and toolbar.

zapping.keep_on_top(toggle)

- Whether to keep the main window on top of all other windows (if this is supported by the window manager).

### Dialogs

zapping.control_box()

- Start the picture controls dialog.

zapping.program_info()

- Start the program info dialog.

zapping.channel_editor()

- Start the channel editing dialog.

zapping.properties(['group' [, 'item']])

- Start the properties dialog, optionally the given group and item.

zapping.plugin_properties()

- Start the plugin properties dialog.

zapping.about()

- Start the about dialog.

zapping.help()

- Open the Zapping documentation.

### Teletext

zapping.ttx_open_new([page [, subpage]])

- Open a Teletext window. When a page number is given, go to this page.

zapping.ttx_page_incr([n])

- Advance the Teletext page number by n. This can be a positive or negative value, by default 1.

zapping.ttx_subpage_incr([n])

- Advance the Teletext subpage number by n. This can be a positive or negative value, by default 1.

zapping.ttx_home()

- Go to the Teletext home page, usually page 100.

zapping.ttx_history_prev()

- Go to the previously visited page in the browse history.

zapping.ttx_history_next()

- Go to the next visited page in the browse history.

zapping.ttx_hold(toggle)

- Toggle the hold state of the displayed page. When off, Zapzilla will rotate through all subpages of the page, if it has any.

zapping.ttx_reveal(toggle)

- Whether to reveal concealed characters on the displayed Teletext page.

### Caption / Subtitles

zapping.closed_caption(toggle)

- Whether to display closed caption superimposed onto the picture.

zapping.osd_render_markup('Hello <i>World</i>!')

- Display text superimposed onto the picture, with Pango markup.

zapping.osd_render('Hello World!')

- Display text superimposed onto the picture.

### Audio

zapping.mute(toggle)

- Change the audio mute control.

zapping.volume_incr([n])

- This provisional command changed the audio recording volume, it is no longer supported.

  As a replacement use zapping.control_incr('volume'[, n]) to change the soundcard mixer or video device volume as configured in the preferences dialog. Note that changing the volume does not unmute.

### Controls

zapping.control_incr('name'[, n])

- Advance the control value by n units, usually +1 or -1, default is +1. The following names are presently recognized:

  'brightness'

- picture brightness

'contrast'

- picture contrast

'saturation'

- picture color saturation

'hue'

- picture color hue

'volume'

- audio volume

'bass'

- audio bass

'treble'

- audio treble

### Plugins

zapping.screenshot(['format'])

- Start the screenshot dialog and if given switch to the format. Currently valid formats are: 'jpeg' and 'ppm'.

zapping.quickshot(['format'])

- Take a screenshot without starting the dialog. The last select file name will be used, with an incrementing number appended. When no format is given the last selected format will be used.

zapping.record(['format'])

- Start the record dialog and if given switch to the format. Note this is the name the user gives a particular configuration, not the name of the file format.

zapping.quickrec(['format'])

- Start recording without confirmation. The last select file name will be used, with an incrementing number appended. When no format is given the last selected format will be used.

zapping.stoprec()

- Stop recording.