Installing and using MythTV: Using MythTV.

Next Previous Contents

## 11. Using MythTV.

## 11.1 Keyboard commands

The `keys.txt` file describes what the various keyboard commands are. If you have loaded mythweb, you may change the default keys to your liking.

### mythfrontend

Arrow keys | used to move the highlight point around
ALT-F4 | exit out of the application
Space/Enter | take action on the item under the highlight point
P | play in both "Watch a Recording" and "Delete a Recording"
D | delete in both "Watch a Recording" and "Delete a Recording"
U | to view details for the currently selected show on the Watch or Delete screens, EPG, "Program Finder", "Fix Scheduling Conflicts" and search results screens
O | to list the upcoming episodes for the currently selected show on the EPG, "Program Finder", "Program Recording Priorities", "Fix Scheduling Conflicts" or search results screens
I | edit recording options from the EPG, "Program Finder", "Program Recording Priorities", or "Fix Scheduling Conflicts" screens. From the Playback and Delete screens, 'I' presents options for recorded shows such as Auto Expire or Stop Recording. Pressing 'I' while on the Recording Options screen will take you to the Advanced Recording Options screen.

### Watching TV or a recording

Up or down | keys change the channel
num pad | Type a number to enter a channel number or jump amount (HHMM format)
P | pause / play. You may also add an explicit keybinding for 'Play' through MythWeb, returning you to normal speed if you are in slow motion, rewind fast forward or pause mode.
C | change inputs on TV Tuner card
ESC | quits
I | puts the On-screen Display up again. During playback, 'I' toggles between position and show description info. If a jump amount is entered, jump to that position.
M | brings up the electronic program guide (Grid) -- see the EPG section
Page Up | jump back the configured number of minutes (default is 10)
Page Down | jump ahead the configured number of minutes (default is 10)
End or Z | skip to next commercial break marker
Home or Q | skip back to previous commercial break marker
T | toggle close caption support Pressing 0-9 (preferably 3 times) + T changes teletext page and turns on teletext.
F | rotate between the various Picture Adjustments (Colour, Hue, etc.) While Picture Adjustment is on-screen, use Left and Right arrows to adjust. These settings adjust the look of the video playback, and are independent of the G-key settings used at record-time.
[ or F10 | decrease volume
] or F11 | increase volume
| or F9 | toggle mute
/ | jump to the next "favorite" channel
? | mark/unmark the current channel as a "favorite"
U | increase the play speed
J | decrease the play speed
A | Adjust time stretch (speed up or slow down normal play of audio and video
W | cycle through zoom and fill modes: 4:3 aspect ratio, 16:9, 4:3 Zoom (like Pan and Scan), 16:9 Zoom, and 16:9 Stretch (eliminates black sidebars in TV signal)
F8 | toggle the sleep timer 30m->1hr->1hr30m->2hr->Off
CTRL-B | Jump to the beginning of the recording / ringbuffer
+ | Switch between audio streams
Left | (if a jump amount is entered) to jump back that amount
Right | (if a jump amount is entered) to jump ahead that amount
| Without the stickykeys option selected
Left | rewind the configured number of seconds (default is 5)
Right | fast forward the configured number of seconds (default is 30)
< | starts rewind mode as if stickykeys are selected
> | starts fast forward mode as if stickykeys are selected
| With Stickykeys option selected
Right | starts fast forward mode
Left | starts rewind mode
| In fast forward or rewind mode:
Left/Right | increases the ff/rew speed
0 | plays at normal speed, but leaves the time indicator on screen
1 or 2 | plays back more slowly than normal ff/rew speed (1 is slowest)
3 | plays back at normal ff/rew speed
4-9 | plays back faster than normal ff/rew speed (9 is fastest)
Space | exits fast forward or rewind mode
| While video is paused:
Left | rewind 1 frame
< | rewind 1 second
Right | advance 1 frame
> | advance 1 second

### Watching TV only

G | rotate between the various Picture Adjustments (Colour, Hue, etc.) for recording. These values affect the look of the resulting .nuv file, and are independent of the playback picture settings. While Picture Adjustment is on-screen, use Left and Right arrows to adjust.
H | Channel history. Each repeat steps back through the previous channels.
O | Turns on 'Browse' mode, allowing user to browse channels and program info while watching current show FullScreen.
Y | switch between multiple capture cards. NOTE: you will lose your LiveTV buffer on your current card. Useful for different-sourced cards (such as Dish Network on one, HDTV over-the-air on another card.)

### LiveTV Browse Mode

Left | browse program prior to current listed program
Right | browse program following current listed program
Up | browse program on channel above current listed channel/program
Down | browse program on channel below current listed channel/program
/ | browse program on next favorite channel
0-9 | enter a channel number to browse
Space/Enter | change channel to channel of current listed program
R/r | Toggle recording of current program (cycles through types)
ESC/O | Exit Browse mode

### Playback Recording Zoom Mode

Left | Move video to Left
Right | Move video to Right
Up | Move video Up
Down | Move video Down
PageUp | Zoom In
PageDown | Zoom Out
Space/Enter | Exit Zoom mode leaving picture at current size and position
ESC | Exit Zoom mode and return to original size

### If you have two or more tuner cards

V | toggle Picture-in-picture on or off
B | toggles the window focus (lets you change channels on the PiP window)
N | swaps the two channels by changing channels on both cards

### Watching a recording only

Space/Enter | set a bookmark at that point. Next time you start the recording, you will automatically jump forward to this point and clear the bookmark.
X | queues the current recording for transcoding
O | brings up menu to allow toggling settings such as Commercial Auto-Skip, Auto-Expire, etc.
D | exits the current recording and displays the Delete menu
E or M | enters/exits edit mode.
| In edit mode
Left/Right | move forward and backward
Up/Down | alter the amount of time you jump forward and backward. Increments are: nearest cutpoint, nearest video keyframe, 1 frame, 0.5 seconds, 1 second, 20 seconds, 1 minute, 5 minutes, and 10 minutes.
PageUp/PageDown | move forward and backward to the nearest cut point
< or > | move forward or backward by 10 times the normal jump amount
Space/Enter | allows you to set or delete a cut point
Z | loads the commercial skip list (if one exists) into the cutlist
C or Q | clear all cut points in the cutlist
I | Inverts the cutlist

### EPG

Arrows | are used to move the highlighted program point around
A, D, S, W | perform the same as left, right, down and up
PageUp/PageDown | move the channel list up or down a page
Home/End | move the highlight left or right by one day
Ctrl+Left or < | move the highlight left by one page
Ctrl+Right or > | move the highlight right by one page
9, 3, 7, 1 | (like a numeric keypad) perform the same as PageUp, PageDown, Home and End
I | bring up more information about a show, and allow you to schedule a recording. If you select "Record this showing" while watching Live TV you can "Instant Record" a program.
Space/Enter | allow you resolve conflicts or change overrides. If the program is not already scheduled to record, it will instead act like pressing 'I'.
M | when on a channel will change to that channel
ESC or C | exits without changing the channel
R | change the current item from Recording/Not-Recording. Successive keypresses cycle through the scheduled recording type list.
X | change the channel to the currently selected channel without leaving the EPG (Most useful in the alternate EPG)
? | mark/unmark the current channel as a "favorite"
/ or 4 | toggle the guide listing between all channels and filtered "favorites"

### Setting Program or Channel Recording Priorities

Right | increases priority value
Left | decreases priority value
1 | sorts by title
2 | sorts by priority
Home/End | toggle sort priority
I | edit recording options
ESC | commits changes and exits

### Viewing Scheduled Recordings/Resolving Conflicts

1 | show all recordings
2 | show only important recordings
Home/End | toggle show showing all/important
I | edit recording options
Space/Enter | resolve conflict or override

### Viewing Search Listings

Home | change to the previous view if applicable
End | change to the next view if applicable
M | select another view if applicable. In the title and description search popup, press M again to edit or delete the selected view.

### Recording Profiles Setup Screen

D | on a custom profile group displays a popup to delete the group

### Recording Groups

In the Watch Recordings screen, Recording Groups allow you to separate programs into user-defined categories, such as "Kids", "Alice", "Bob", etc. This can be used to reduce clutter, or to segregate content if you use the PIN function.

M | change the view or to set a group password
I | move a program from one Recording Group to another

### Watch Recordings Screen

1 or F1 | Meaning of the icons
/ | Tags a recording. Tagged recordings can be played either in order or shuffled and deleted as a group. You can also change the recording group for several recordings at once by tagging them and using the Menu (m) button, selecting "Playlist options", then "Change Recording Group".
? | Clear the tagged list.

### Remote Controls

If you are using MythTV with just a remote control then it is suggested that you map the remote control keys as described below. Your remote control may not have the same set of keys as those named below, the names are only a suggestion that roughly correspond to the function.

If you are adding new key bindings to the program then consideration of this suggested list will help users with remote controls.

This list assumes a minimal remote control that only has 20 keys, nearly all features can be used with this configuration. If you have more keys then you can access all of the features. With only 16 keys most features are usable.

REMOTE CONTROL | LIRC KEYSTROKE | FUNCTION
0 - 9 | 0 - 9 | channel selection, EPG navigation, ff/rew speed setting (with stickykeys)
Left Arrow | Left | scroll left, rewind
Right Arrow | Right | scroll right, fast forward
Up Arrow | Up | scroll up, channel change up
Down Arrow | Down | scroll down, channel change down
Select / OK / Play | Space | Select item, play (with stickykeys) set bookmark
Cancel | Escape | Cancel, quit playback
Menu | m | EPG (from watching TV) edit (from playback).
Pause | p | Pause
Other key 1 | i | Information
Other key 2 | c | Change tuner card input

## 11.2 Using themes with MythTV

MythTV is "themeable", meaning that the visual appearance of the program can be modified by the user without re-compiling or altering the program functionality. Download the MythThemes tarball from the website and untar it:

> `

>     $ tar -xjf myththemes-0.22.tar.bz2
>     $ cd ~/myththemes-0.22
>     $ qmake myththemes.pro
>     $ su -
>     # make install
>     # exit
>     $

> `

The theme will now be available in the mythfrontend Appearance section.

## 11.3 Adding support for an external tuner

MythTV supports changing the channel on an external tuner. If you have an external tuner, such as a DirecTV or digital cable set top box, you should add `/usr/local/bin/changechannel` to your Input Connections in the mythbackend configuration GUI.

However, there is not changechannel program per-se, because this is going to be dependent on what sort of external tuner you have. Look in the `contrib/channel_changers` directory for a number of programs and scripts which may be used to change channels. Once you find one which works, copy it to `/usr/local/bin/changechannel`.

Feel free to browse some of what sort of hardware is available at http://store.snapstream.com/accessories.html, or if you wish to assemble your own, rather than purchase, the following may be helpful: http://www.dtvcontrol.com/ for cable pinouts.

## 11.4 Using Shutdown/Wakeup

What does the MythTV Shutdown/Wakeup function do? The scheduler on the Master backend (MBE) keeps track of the idle status of the entire MythTV system, including the Slave backends (SBE). If it considers the system to be idle, and thus ready to shutdown, it sets the wakeuptime to the time of the next recording and then proceeds to shut down all Slave backends and then itself. Once it is time to begin recording, the Master backend and the Slave Backends are automatically woken up. This system allows MythTV to record like a normal VCR, thereby conserving power when not in active use.

In order to use the Shutdown/Wakeup function there must be some method of waking up the Master backend. There are any number of solutions, but we will discuss in detail two possibilities:

- Use another server that runs 24/7 and have it send a WakeOnLAN (WOL) packet to wake the Master backend. This assumes that you have the WOL tools installed, and that your Master backend motherboard supports WOL.
- Use your motherboard's BIOS wakeup capability. You'll need a motherboard that supports BIOS wakeup, and some tools. Two that work are: http://sourceforge.net/projects/nvram-wakeup and http://www.malloc.de/tools/wakeup_clock.html

### A deeper look into the operation

The scheduler keeps track of the idle status of the MythTV system. To determine whether or not the MythTV system is idle, the following conditions must be met for a period of time defined in the "Idle timeout (secs)" parameter.

- no client is connected to the server
- no recording (neither LiveTV nor a regular recording) is currently taking place
- no recording starts within a definable amount of time ("Max. wait for recording (min)")
- the "pre Shutdown check-command" returns 0

If we get to this idle state the Master backend will set the wakeuptime using the "Set wakeuptime command", which is the same for WOL and BIOS wakeup. The Master backend will then shut down the Slave backends and itself using the "Server halt command".

One caveat is that the scheduler tries to guess if the Master backend was started by a wakeup call or by the user. If it thinks it was woken up by a user, it blocks shutdown until a client connects to the Master backend, after which it will behave as described above. To disable this feature, unset "Block shutdown before client connected" in the mythfrontend Setup->Setup->General screen.

Once it is time to startup the system, the Master backend is woken up first and will wakeup the Slave backends using the "Wake command for slaves". At this time, there is no support for starting only the required Slave backend, so all Slave backends will startup.

### Setting up the MythTV side of this extension.

There are a number of options that are used to control the Shutdown / Wakeup feature.

Shutdown/Wakeup Options:

- "Idle timeout (secs)" is the time the server waits while idle until a shutdown occurs.
- "Max. wait for recording (min)" is the time the Master backend waits for a recording without shutting down. For example, this would be used to prevent a 10 minute system shutdown if a recording is set to start 15 minutes from now.
- "Startup before rec. (secs)" Sets how long before a programmed recording the MythTV system will be woken up. This should be roughly be the time your systems need to bootup, and if you have Slave backends, you'll need to ensure this value is long enough for all your machines to perform their bootup cycle.
- "Wakeup time format" is the format of the wakeup time that is given in the "Set wakeuptime command" as a parameter "$time". You need to set this according to your wakeup mechanism. If you need seconds since the epoch (1970-01-01) set the "Wakeup time format" to "time_t".
- "Set wakeuptime command" is the command executed to set the new wakeuptime.
- "Server Halt Command" is the command executed to shutdown the Master backend and the Slave backends.
- "pre Shutdown check-command" is used to give a "Go/NO-GO" decision from a non-MythTV source. This command is executed immediately before the shutdown would occur. The return value is use to make the following choices:
  - If it returns a "0" the shutdown will occur as scheduled.
  - If it returns a "1" the "idle timeout" will be reset and the system waits again for the timeout.
  - If it returns a "2" the entire shutdown sequence is reset. This means that a new client connect is needed before a shutdown occurs, unless you have the "Wait for client connect" setting disabled, in which case this is the same as returning "1". An example of a use for this return value is to prevent the shutdown if a user is currently logged in, or if a specific program (i.e. transcode, automatic updates, etc.) is currently running. If you don't need it, leave the field blank.

The "WakeOnLan settings": These settings have nothing to do with using BIOS or WOL wakeup, they are the same for both.

- "Master backend" This setting defines timings for the frontends to wakeup the Master backend using WOL. Useful if your frontend can emit a WOL packet so you don't need to physically go to the Master backend if you're trying to watch TV.
- "Reconnect wait time (secs)" is the time the frontend waits after executing the "Wake command" before attempting to retry the connection. This should be roughly the amount of time your Master backend needs for bootup. Set to "0" to disable. The frontends will retry to connect for "Count of reconnect tries" times before giving up.
- "Wake command for slaves" is the one command executed to wake your Slave backends. This should be a script that contains the calls to wakeup all Slave backend systems.

### Using WOL to wake your Master backend.

To use WOL to wake your Master backend you will need a WOL capable Master backend, a machine that runs 24/7 which can execute an at-job and nc (netcat) on the Master backend. I use some little bash scripts to make my DSL router wakeup my mythbox if required.

Replace $SERVER and $PORT with your own settings! On my Master backend I have a script that gets called as 'setwakeuptime command' which looks like the following:

> `

>     #! /bin/sh
>     echo $@ | nc $SERVER $PORT

> `

This simply cats the parameters (that is $time) to my 24/7 server. On my $SERVER I have (x)inetd listening on $PORT starting a little script which cares about setting the at-job. The following additions are necessary on the $SERVER:

If you use inetd:

In `/etc/inetd.conf` add:

> `

>     mythwake stream tcp nowait mythtv /usr/sbin/tcpd /usr/local/bin/mythwake

> `

If you use xinetd, save the following as mythwake in your `/etc/xinet.d/` directory:

> `

>     service mythwake
>       {
>             socket_type     = stream
>             wait            = no
>             user            = mythtv
>             protocol        = tcp
>             id              = mythwake
>             server          = /usr/local/bin/mythwake
>       }

> `

and add the following to `/etc/services`:

> `

>     mythwake        $PORT/tcp

> `

Finally, `/usr/local/bin/mythwake` looks like:

> `

>     #! /bin/bash
>     #this should be a command to wake your server
>     WAKECMD="#!/bin/sh\n /usr/local/bin/wakeMBE"
>     #first we need to delete all wake jobs in queue
>     for JOB in atq | cut -f 1 ; do
>         atrm $JOB;
>     done
>     #now we read the date from 'nc'
>     read date;
>     #now set the atjob
>     echo -e "$WAKECMD" | at $date ;

> `

SECURITY WARNING: Be sure to secure $SERVER:$PORT from untrusted networks, because this allows 3rd parties to run arbitrary code on your server!

### Using BIOS wakeup to wake your Master backend.

Since I don't use this, I cannot say much about this. If your motherboard supports any wakeup tool you have to call that tool as "Set wakeuptime command" with the "Wakeup time format" suitable for that tool.

### Wakeup the MySQL server using WOL

If your MySQL server and your Master backend are not on the same machine, you can have the Master backend wake your MySQL server using WOL. You will find the settings for this in the second page of the mythtv-setup program, or at the end of `mysql.txt`. The meanings are the same as discussed in "The WakeOnLan settings" above.

### Tips/Tricks:

If, for example, one of the Slave backends is also your desktop computer, you could simply use a little script as 'server halt command' which first calls `/sbin/shutdown -t TIMEOUT` where TIMEOUT is a value sufficient for you to react. You could then popup a window using *dialog, asking for permission to shutdown. If you cancel the shutdown, simply call `/sbin/shutdown -c`.

If you get "nvram-wakeup: /dev/rtc: Device or resource busy" your set-wakeuptime-script should stop the program that uses `/dev/rtc` before setting the wakeuptime.

## 11.5 Controlling the mythfrontend via telnet

To use this feature you must first enable it in Settings>General>General

The network control listens on port 6546, as demonstrated below:

> `

>     $ telnet basement 6546
>     Connected to basement.
>     Escape character is '^]'.
>     MythFrontend Network Control
>     Type 'help' for usage information
>     ---------------------------------
>     # help
>     Valid Commands:
>     ---------------
>     jump               - Jump to a specified location in Myth
>     key                - Send a keypress to the program
>     play               - Playback related commands
>     query              - Queries
>     exit               - Exit Network Control

>     Type 'help COMMANDNAME' for help on any specific command.

>     # help jump
>     Usage: jump JUMPPOINT

>     Where JUMPPOINT is one of the following:
>     channelpriorities    - Channel Recording Priorities
>     channelrecpriority   - Channel Recording Priorities
>     deletebox            - TV Recording Deletion
>     deleterecordings     - TV Recording Deletion
>     guidegrid            - Program Guide
>     livetv               - Live TV
>     livetvinguide        - Live TV In Guide
>     mainmenu             - Main Menu
>     ...snip...
>     # exit
>     $

> `

Please note that this feature only allows one connection at a time, so any new connections will automatically terminate prior ones.

Next Previous Contents