[mythtv-users] Multiple inputs/tuners

Bruce Markey bjm at lvcm.com
Tue May 4 15:59:45 EDT 2004

Stephen Longhurst wrote:
> I have 2 analogue tuners and a digital tuner.  Analogue one tunes
> directly into the cable TV signal from the wall.  Analogue two is
> connected to the output of my cable box and can get the few channels
> that are encrypted that analogue one can't tune into.  Then there is the
> digital card that gets all the UK Freeview channels.  I've defined the
> 3 video sources, and have an EPG with lots of duplicate channels since
> there is quite a bit of overlap.

This is all handled quite nicely in 0.15 (current CVS).

> Can I somehow configure this so that the duplicate channels are not
> shown on the EPG? 

EPG? That's just the cosmetic issue ;-) but yes, matching stations
on the same channel for more than one source only need to appear
once per station with the current system.

The bigger issues are that the scheduler needs to know that the
same station is available from more than one source and that it
can record the same show from any instance, only record one of
the showings (don't record it twice at the same time ;-) and allow
you to define which source you would prefer if available or fail-
over to another source if the preferred source is busy.

This is all working. Check out the info on channel matching, input
preference an channel priority in the attached docs.

>   I'm using the latest CVS (well, as of this weekend).

Then you should be good to go. Just make sure you have the same
string for "callsign" for each of the channels that have the same
broadcast station.

--  bjm
-------------- next part --------------
There are some special cases that should be tested in the scheduler:

  Put back - if a short show loses to a longer show that loses to 
  a later show, the short show should record in the hole left by the
  move of the longer show.
  Card priority sort - with three or more cards, the second ranked
  show in a time slot should get card 2 and the third should get 3.
  Maximum shows - a one time showing episode should not lose by
  conflict if one or more of the conflicts could record the same
  episode in a timeslot where there are no conflicts.
  Can move - If a higher ranked show occupies a card with two
  source inputs and a lower ranked show can only be recorded on the
  second source, the higher show should check to see if it can
  move to another available input for it's source.

This new scheduler adds new cases that need verification:

  Channel matching - if a station is available on more than one channel
  or from more than one sourceid with identical listings, showings
  on any of these channels should be interchangable. Further if the
  channel priorities are not the same, the channel with a higher
  priority should be preferred but not required if unavailable.
  Earliest showing - if a show has multiple showings, the first showing
  should always be recorded unless it loses in conflict resolution.
  "Earliest showing" and "Maximum shows" oppose each other by

  Prefer best card - if one or more cards in the card list produce
  higher quality recordings than other cards, the user may prefer
  moving an earlier showing of an episode from a lower card to a
  timeslot where it will be recorded on a higher quality card.

Also to be verified:

  Tie breaking - if shows with the same priority value are in conflict,
  the tie should be broken in a way that is likely to be the best
  default choice.

Test Environment

The test system has two tuners. The first and second cards have coax
cable from sourceid 1. The first card also has digital cable from
sourceid 2 on it's s-video input. The sources share some stations and
there are some stations on just sourceid 1 and some exclusive to
sourceid 2. The local NBC affiliate is broadcast on channel 3 but is
also transmitted digitially on channel 123:

mysql> select chanid,channum,sourceid,callsign,xmltvid from channel
where callsign = 'KVBC';
| chanid | channum | sourceid | callsign | xmltvid             |
|   1003 | 3       |        1 | KVBC     | C3kvbc.zap2it.com   |
|   2003 | 3       |        2 | KVBC     | C3kvbc.zap2it.com   |
|   2123 | 123     |        2 | KVBC     | C123kvbc.zap2it.com |
3 rows in set (0.00 sec)

Output for the examples is generated by "PrintList()" shown when
running "mythbackend -v schedule". The most significant information
is the "N" column for NoRecord status and the "Pri" column for

Test Cases

    Put back


"Innovation" has the highest priority so it is placed on card 1 ahead
of "U.S. Marshals" on card 2. "Nova" has a priority lower than
"U.S. Marshals" but there is an open timeslot on card 1 for 8-9pm so
Nova is placed ahead of "U.S. Marshals":

Title - Subtitle                Chan ChID Day Start  End   S C I  O N Pri
Nova - "Spies That Fly"           10 1010  24 20:00-21:00  1 1 1  0 1   0
U.S. Marshals                      7 1007  24 20:00-22:40  1 2 2  0 2   1
Innovation - "SpyCatchers"        10 1010  24 21:00-22:00  1 1 1  0 1   2

    Card priority sort


For this test only, a system with three cards is used (1, 2 and 5).
Three sports shows all start at the same time. The shows with
priorities 2, 1, and 0 are assigned to cards 1, 2, and 5 respectively:

Title - Subtitle                Chan ChID Day Start  End   S C I  O N Pri
Table Tennis - "Killerspin Open"  31 1031  19 15:00-15:30  1 1 1  0 1   2
SportsCenter                      30 1030  19 15:00-16:30  1 2 2  0 2   1
PGA Golf - "Nissan Open, First    34 1034  19 15:00-18:00  1 5 5  0 5   0

If the "SportsCenter" priority is lowered, it is correctly swapped
with "PGA Golf":

Table Tennis - "Killerspin Open"  31 1031  19 15:00-15:30  1 1 1  0 1   2
SportsCenter                      30 1030  19 15:00-16:30  1 5 5  0 5  -1
PGA Golf - "Nissan Open, First    34 1034  19 15:00-18:00  1 2 2  0 2   0

If "SportsCenter" is raised to the highest priority, the others are
moved down to the lower cards in the correct order:

Table Tennis - "Killerspin Open"  31 1031  19 15:00-15:30  1 2 2  0 2   2
SportsCenter                      30 1030  19 15:00-16:30  1 1 1  0 1   3
PGA Golf - "Nissan Open, First    34 1034  19 15:00-18:00  1 5 5  0 5   0

    Maximum shows


With "Reschedule Higher Priorities" turned on, a higher priority show
can be postponed to a later showing in order to allow recording a
lower priority title with a single showing of the episode.  In this
example, Nova at 8pm is marked for a "L"aterShowing and is recorded
at 1am to allow SportsCenter to record at 8pm:

Title - Subtitle                Chan ChID Day Start  End   S C I  O N Pri
American Idol                      5 1005  24 20:00-21:00  1 2 2  0 2   1
Nova - "Spies That Fly"           10 1010  24 20:00-21:00  1 0 0  0 L   2
SportsCenter                      30 1030  24 20:00-21:00  1 1 1  0 1   0
Nova - "Spies That Fly"           10 1010  25 01:00-02:00  1 1 1  0 1   2

Also see "Earliest showing".

    Can move


"Curb Your Enthusiasm" is only available on source 2, card 1 but
"Nova" is available on either card for source 1. If "Curb" has a
higher priority, both will record:

Title - Subtitle                Chan ChID Day Start  End   S C I  O N Pri
Curb Your Enthusiasm - "The Sur  210 2210  24 20:00-20:30  2 1 3  0 1   2
Nova - "Spies That Fly"           10 1010  24 20:00-21:00  1 2 2  0 2   1

If "Curb" has a lower priority with "Reschedule Higher Priorities"
turned off, "Nova" wins card 1 and "Curb" cannot be recorded so it is
marked as a "C"onflict:

Curb Your Enthusiasm - "The Sur  210 2210  24 20:00-20:30  2 0 0  0 C   0
Nova - "Spies That Fly"           10 1010  24 20:00-21:00  1 1 1  0 1   1

With the "Reschedule Higher Priorities" option turned on, "Curb" gets
its only possible input on card 1 even though Nova has higher priority.

Curb Your Enthusiasm - "The Sur  210 2210  24 20:00-20:30  2 1 3  0 1   0
Nova - "Spies That Fly"           10 1010  24 20:00-21:00  1 2 2  0 2   1

    Channel matching


"Whoopi" is broadcast on KVBC which is available on chanid 1003, 2003
and 2123. These should be treated as being identical because their
callsigns match. "2123" has its channel priority boosted to "1" and
therefore should be preferred over the others.

"Whoopi" on 2123 has a priority of 1 so it wins for KVBC and is
higher than "Nova". Source 2 on card 1 is used for "Whoopi":

Title - Subtitle                Chan ChID Day Start  End   S C I  O N Pri
Whoopi - "The Last Dance"        123 2123  24 20:00-20:30  2 1 3  0 1   1
Nova - "Spies That Fly"           10 1010  24 20:00-21:00  1 2 2  0 2   0

With its priority raised to 2, "Nova" wins card 1. With the only
source 2 input unavailable, "Whoopi" is moved to chanid 1003 on
card 2. 1003 has no channel priority so the total priority is now

Whoopi - "The Last Dance"          3 1003  24 20:00-20:30  1 2 2  0 2   0
Nova - "Spies That Fly"           10 1010  24 20:00-21:00  1 1 1  0 1   2

    Earliest showing


With "Reschedule Higher Priorities" turned off, a higher priority show
that could be postponed to a later showing will record even if a lower
priority title will not be recorded as a result.  In this example,
Nova at 8pm is marked to record and SportsCenter marked as a conflict:

Title - Subtitle                Chan ChID Day Start  End   S C I  O N Pri
American Idol                      5 1005  24 20:00-21:00  1 2 2  0 2   1
Nova - "Spies That Fly"           10 1010  24 20:00-21:00  1 1 1  0 1   2
SportsCenter                      30 1030  24 20:00-21:00  1 0 0  0 C   0
Nova - "Spies That Fly"           10 1010  25 01:00-02:00  1 0 0  0 E   2

    Prefer best card


If all Input Connections have been set in the "setup" to have an
"Input preference" of 0, Nova will record in the first available
timeslot on card 2:

Title - Subtitle                Chan ChID Day Start  End   S C I  O N Pri
American Idol                      5 1005  24 20:00-21:00  1 1 1  0 1   1
Nova - "Spies That Fly"           10 1010  24 20:00-21:00  1 2 2  0 2   0
Nova - "Spies That Fly"           10 1010  25 01:00-02:00  1 0 0  0 E   0

With the card 1, input 1 "Input preference" set at a value of 1, Nova
will record in a later timeslot when it can be recorded on the
preferred card 1:

American Idol                      5 1005  24 20:00-21:00  1 1 1  0 1   2
Nova - "Spies That Fly"           10 1010  24 20:00-21:00  1 0 0  0 L   1
Nova - "Spies That Fly"           10 1010  25 01:00-02:00  1 1 1  0 1   1

Note that the total priority value for each item associated with card
1, input 1 has been raised as a result of increasing the "Input

If "Nova" has the highest priority so that it wins the preferred input
at 8pm, it will record in that timeslot:

American Idol                      5 1005  24 20:00-21:00  1 2 2  0 2   1
Nova - "Spies That Fly"           10 1010  24 20:00-21:00  1 1 1  0 1   3
Nova - "Spies That Fly"           10 1010  25 01:00-02:00  1 0 0  0 E   3

    Tie breaking


If two shows have the same priority, the show with the more specific
record rule type is preferred. A Channel record or All record may
have other showings of the same episode where a Single record or
Weekslot may not.

Here "Nova" is Weekslot and "Idol" is Channel so "Idol" is not recorded:

Title - Subtitle                Chan ChID Day Start  End   S C I  O N Pri
Curb Your Enthusiasm - "The Sur  210 2210  24 20:00-20:30  2 1 3  0 1   1
American Idol                      5 1005  24 20:00-21:00  1 0 0  0 C   0
Nova - "Spies That Fly"           10 1010  24 20:00-21:00  1 2 2  0 2   0

With "Nova" as Weekslot and "Idol" as Single, "Idol" wins card 2:

Curb Your Enthusiasm - "The Sur  210 2210  24 20:00-20:30  2 1 3  0 1   1
American Idol                      5 1005  24 20:00-21:00  1 2 2  0 2   0
Nova - "Spies That Fly"           10 1010  24 20:00-21:00  1 0 0  0 C   0

If the pirority and type match, there are further rules to assure
that the results will be deterministic.
-------------- next part --------------
	Scheduling Recordings

The MythTV master backend is responsible for managing the schedule for
all TV tuner cards on the master and any slave. It's job is to seacrh
the TV listing for the shows you have requested and assign recording
to the TV tuner cards. If none of the shows that you've chosen
overlap, it simply records all of the shows. However, if there are
shows where the beginning and end times overlap, the scheduler follows
rules that you've specified or makes logical decisions about what
would be best if you haven't express your preference. Further, the
"Fix Conflicts" page allows you make specific decisions about what you
really do and don't wan't to record.

Record Types

When you choose a show that you would like to record from the <link to
options page>Options Page<>, there are six different types of rules
to help the scheduler find which showings you would like to record.

Single -- record only this title at this specific time. This is the
best way to be sure that a certian showing is recorded. However, if
the TV listings change and the show is not broadcast at that time,
the show will not be recorded.

Find One -- this will record a title once from any of the times that
appear in the TV listings. This is useful for recording a movie or
special that has multipe showings because it allows the scheduler to
choose one that doesn't conflict. It is not a good choice for
recording a single episode of a series because it records the first
available showing of the title without regard to the duplicate

Week Slot -- this records a show whenever the title is listed on the
same channel, weekday and time. Note that if the TV station changes
the schedule for a special episode, it would not be recorded. However,
you can use a Single record for the special episode.

Time Slot -- this records a show whenever the title is listed for the
time and channel on any day of the week. Here again, a show will not
be recorded if the time was altered by the station.

Channel -- records a show anytime the title is listed on this channel.
This is perhaps the most common rule to use for most shows.

All -- record this title on any channel at any time. This can be
useful if a station has sister stations where shows are rebroadcast
allowing the scheduler to record rebroadcasts on the other station
when the original airing cannot be recorded.


Single and Find One will record without regard to duplicate matching.
however, the scheduler uses the <link ot dups>duplicate<> matching
information for all other types to determine which showings should and
should not record. Further, if an episode has multiple showings, the
scheduler may be able to use this information to find ways to record
episodes that might not otherwise be recorded.


As you add more shows that you would like to record, the scheduler
will eventually encounter conflicts. If there are two shows at the
same time and you have two or more TV tuner cards, both shows will
record. However, if there are more shows than cards, the scheduler
will have to decide what it thinks it should not record based on the
information you have given. If you see an unexpected situation you
are not "stuck" with the scheduler's choice. You can still tell the
scheduler exactly which shows you do want to record and/or don't
want to record in any situation.


By default, all shows are equal in importance to the scheduler.  There
are a set of rules to to make good choices when two or more shows are
in conflict. However, priority values let the scheduler know what you
want so that it can set the schedule based on your preference.

By default, all priority values are set to zero. You may choose to
leave everything at "0" and let the scheduler follow rules to guess
what you might prefer when there are conflicts. However, if you have
one or two favorite shows, you may want to increase the priority value
so the scheduler will know that you would prefer recording these over
other shows. You might use certain values to rate shows so that all
favorites are 2. good shows are 1 and extra 'filler' shows are all -1
for example. You could sort each title to have a unique value so the
scheduler can always know which show you'd prefer verses any other
show. The chioce and style are entirely up to you. However, the more
information you give to the scheduler, the more likely it will make
the choices you would like in the first place.

The scheduler choices are based on the total priority for a showing
by adding up all of the four priority factors. By default, all of
these factors are "0" but you may use any combination to express your
likes and needs.

Per record rule -- this is the "priority" field on the advanced options
page and this values is included for any showings that match the rule.
You may choose to only use these values and not use the other factors
for the sake of simplicity and clarity.

Per record type -- Setup->TV Settings->Recording Priorities->General
allows you to add to the priority based on the type. It may make sense
to increase the value for "Single" so that by default they have an
extra advantage over other shows. You may want to decrease the value
for Find One so that they will be less likely to interfere with
regular shows and will be more likely to record in a non-conflicting
time instead.

Per channel - Setup->TV Settings->Recording Priorities->Channel
Priorities can be useful if you believe that you prefer any of the
shows on certain channels. This would give all shows on a channel an
advantage by default.

Input preference -- in the MythTV "setup" program, the "Input
Connections" section allows you to add additional priority in the
"Input preference". This is simply another priority factor but has an
interesting effect. If a card input has a higher value than the other
cards, the scheduler will see that you would rather record showings of
episodes on this card rather than a showing on another card. If you
have cards of different quality, you may want to set input preference
to encorage the scheduler to record shows on your best card(s)
whenever possible.

For any single showing of any show you've chosenn to record, these
factors are added together to find the "total priority". This is the
priority that the scheduler uses to decide which shows are given the
first choice when filling in the schedule.

Scheduling decisions

Here are the actual decisions made by the scheduler as it fills in the

Currently recording beats not currently recording -- a recording in
progress can not be moved so it "wins" it's current timeslot.

Higher total priority beats lower total priority -- see above. This is
the core of the scheduling process. Episodes of the highest priority
show are placed on the first available card then the next highest
priority and so on.

Future start time beats passed start time -- if there is an episode in
progress and also a later showing of the same episode, it is better to
record the complete episode. If there isn't another showing, start
recording now to record the remaining portion. Note: this should only
happen if you add a new rule while the show is in progress.

More specific record type beats less specific record type -- If two
shows are on at the same time and have the same total priority but
different types they will be sorted by Single then Find One, Week
Slot, Time Slot, Channel and finally All. This only applies if the
priorities are the same.

If both start times have passed, later start time beats earlier
start time -- try to miss the least amount of time.

If neither start time has passed, earlier start time beats later
start time -- this rule help assure that the earliest showing of an
episode has the advantage.

Lower input id beats higher input id -- The scheduler fills in open
time slots on the first available card. The next cards is used when
there is another show already placed for the first card.

Older record rule beats newer record rule -- if after all of these other
checks two shows are still equal, the show whose record rule was added
first is preferred over a more recent addition.

Reschedule Higher Priorities

Setup->TV Settings->Recording Priorities->General has a checkbox for
"Reschedule Higher Priorities" which tells the scheduler to try to be
a little smarter in certain situations. If this is checked, the
scheduler will look for situations where a show cannot record because
all inputs for the channel are used for higher priority shows. It will
check to see if any of the other shows could be recorded at another
time so that the conflicting show can be recorded in it's place.

Generally, this is a good strategy but there are tradeoffs. If a
higher priority show is postponed, you will not get to watch it until
it is recorded in the later timeslot. There is also a risk that the TV
listings may change and the later showing may go away. In this rare
case the higher priority show may never record. On the other hand, if
you do not use this option you will miss recording some lower priority
shows unnecessarily unless you make these changes manually.

By using Reschedule Higher Priorities, the scheduler will do a better
job of recording as many of your shows as possible when left
unattended. It will also be easy to see that shows have been marked to
record at a later time. You can then decide for yourself when you
would prefer to record the first showing.

Fix Scheduling Conflicts

The TV->Schedule Recordings->Fix Scheduling Conflicts page is your
control center for the MythTV scheduler. Unlike other DVR systems,
this one page gives you all of the information and tools you need to
see all of your alternatives and make whatever adjustments you desire.

The upper half of the screen has a scrollable box listing items that
match your record rules sorted by time. The lower half shows the
details for the highlighted item. There are two 'views' available.
Press "1" to include all of the items that do not need to be recorded
and "2" to focus on just the things that will record and items that
may need your attention. The message in the upper right-hand corner
will remind you when there are conflicts that would prevent one or
more shows from being recorded.

The items in the list are colored white for things that will record,
gray for those that do not need to record and yellow when there is a
time conflict. Items at the top of the list may also be highlighted
when the recording is in progress.

Along with the channels, start times and titles, the right-hand column
has a status code. Numbers indicate which card number has been
assigned to record the show. Letters are used to indicate the reason
that something will not be recorded. Just below the box is a short
status message for the highlighted item that indicates the type of
record rule that was matched and a one or two word explaination of the
status code. If you press SELECT, you will see more information about
the status.

There are a few status codes that may require your attention. "C"
indicates that there are more overlapping shows to record than there
are TV tuners to record them. "L" indicates that the schelduer found
that may be better to record a later showing of this episode. These
states happen as a result of your choices and should normally refect
your preferences. However, you may notice situations where you would
like to modify the scheduler's initial choices.

The first thing you can do is to highlight an item and press INFO
once or twice to see the <link>Advanced Options page<>. From this page
you can change the record rule type, the duplicate matching rules, or
raise or lower the priority to resolve whatever problem you noticed.

Additionally, you can treat any individual showing as an execption
that you do want to record or don't want to record. To use these
"override" features, highlight the item and press SELECT. You will
see a message explaining the current status and at least an "OK"
button to exit without making changes.

For items scheduled to record, there will be a button for "Don't
record it" which will prevent recording this showing but will still
allow the same episode to record in the future. If there is episode
description information, you may also see a button for "Never record
this episode". This prevents recording this showing and tells MythTV
to remember that this is an episode that you've seen or don't need to
see if it is ever in the TV listings again.

For items that are not scheduled to record, the message will describe
the reason and in the case of "C" or "L" it will include a list of the
shows that are scheduled to record instead. For any item that could
potentially be recorded there will be a "Record it anyway" button.

If you return to an override page after an override has already been
set, you will also see a "Clear override" to undo your changes. This
option makes it very easy to try out some "what if" attempts when
deciding on your best strategy in a difficult situation.

More information about the mythtv-users mailing list