[mythtv] Re:Next Scheduler Patch

Bruce Markey bjm at lvcm.com
Mon Mar 1 22:31:09 EST 2004


Mark Chou wrote:
> David,
> 
> I think you're mistaking concern for interest.  As a myth user, I follow
> the dev list and irc channel religiously, and unless I missed something,
> there was never a comprehensive explanation how the (new) scheduling
> algorithm would work.  Bruce (Markley) did make an attempt to address
> specific questions, but to the best of my knowledge no one ever
> explained the "usage model," despite pleas and suggestions from others
> such as a flow chart.  The message that came across (whether intended or
> not) was "It's going to be done our way, take it or leave it."

I can understand that impression on an emotional level but I
think the general responses to comments were more along the
lines of 'I know what you are asking for and you'll see that
your problem will be solved even if it isn't the exact
implementation that you've suggested'. I do think that all the
common concerns were addressed and now is the time to see how
they've been solved.

I agree with David that after a lot of work and consideration
of requests, ZERO people gave feedback on the patch :-(. Dozens
can type 'it has to be done my way' but nobody can type 'make;
make install'? ;-)

> Keep in mind that most people here probably use mythtv (more or less) in
> a production capacity, and unless one understands how a critical process
> like multiple tuner conflict resolution works beforehand, there will
> definitely be a reluctance to try something that's not clearly understood.

It should be pretty much self-evident; the show with a higher
priority value will be favored over the lower value. However,
in some more complex situations there are some nifty solutions.
That was the point of David's bullet items and the test notes
that I sent. These were intended to let you know what to look
for and what to expect.

> For example, in the "degenerate case" where no programming priority (or
> equal priority) is specified, how does multiple tuner conflict
> resolution work?   Does it work like myth .14, or more like myth .12?

More like .15 ;-). Even before rankings were added at all there
always was a GetBest tie breaker. Both David and I addressed
tie breaking in out messages. This is not the "degenerate case"
but the norm. 

In the new scheduler, all titles are sorted by the total priority
value. For things that have the same total priority, they are
sorted by the record type from most specific to least specific
so that Single recordings will win over Channel or All record
by default. Once the list of title is sorted, the episodes for
the highest are placed then the next highest and so on. As a
result, your highest show in a timeslot will go on Alice, the
next highest on Betty and if there is a third, it would be
marked "C"onflict on the conflicts page. If it isn't as you'd
like you have several options. You can press "i" on any of the
items to change the priority on the advanced options page so that
the sort order will change. You can press Enter on either of the
two items set to record and click "Don't record it" or you could
press Enter on the item marked "C" and click "Record it anyway".
 
> As a myth user who uses/gets cvs updates at least once every two weeks,
> quite frankly the change in schedule conflict resolution between myth
> .12 and myth .13 was jarring, to say the least.  This (unexplained)
> change just deepens the mystery, without allowing the user to evaluate
> the potential trade offs a priori.

I have no idea what you found "jarring, to say the least" and
not a clue what you are referring to when you say "(unexplained)
change just deepens the mystery". What change and what "mystery"?

As for evaluating trade offs, this is where myth really shines.
In earlier version everything was equal and resolved blindly
by GetBest and allow you to add a blind and forgotten entry into
a conflictresolution table. The conflict page would then lie
and pretend that it didn't know what it would do at record time
(when in fact it did =) and prompt you to entry a choice into
the deep mystery of a *conflictresolution table.

Now the conflict page puts everything right in front of you
and lets you slice, dice and make Julian fries. It shows you
what card a show is assigned to, other alternatives at the
same time, a letter indicating why something won't record, a
short status explanation below the box, a full text explanation
and override buttons when you press enter, and "i" takes you
to the options options page to let you tweak things however
you'd like. I think it's becoming less mysterious all the time.
When I go to a commercial DVR I find it much more difficult
to understand what my choices are and how to tweaks them.

> While I get the feeling while you and Bruce have given conflict
> resolution much thought and work,  quite frankly the rest of the mythtv
> user community have no idea what you guys have in mind.  Please help us
> catch up.  The "conflict resolution usage model" probably will have to
> be included in the myth docs anyway, because if experienced myth
> veterans don't understand the implications, then newbies definitely
> won't be able to understand it.

Robert is working on a User's Guide and I fully intend to
contribute whatever is needed for the scheduler. To that end,
I kept notes while testing to track the features that needed
to be tested and to retain info that could be useful in writing
the documentation. This is not the final doc by any means but
I posted it so that people like yourself could see the examples,
try things, ask questions, etc.  I can verify that I posted it
but I can't verify that you read it ;-). If you haven't, please
take a few minutes to read this thoroughly. See if the examples
make sense to you and try things out for yourself.

--  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
  definition.

  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
priority.

Test Cases

    Put back

Verified.

"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

Verified.

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

Verified.

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

Verified.

"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

Verified.

"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
zero.

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

Verified.

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

Verified.

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
preference".

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

Verified.

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.


More information about the mythtv-dev mailing list