[mythtv-commits] Ticket #10734: Dynamic Variable Evaluation for Power Search (Extension)

MythTV noreply at mythtv.org
Thu May 17 19:13:50 UTC 2012


#10734: Dynamic Variable Evaluation for Power Search (Extension)
-----------------------+----------------------------------
 Reporter:  mmm1976@…  |           Type:  Patch - Feature
   Status:  new        |       Priority:  minor
Milestone:  unknown    |      Component:  MythTV - General
  Version:  0.25       |       Severity:  medium
 Keywords:             |  Ticket locked:  0
-----------------------+----------------------------------
 Hi all,

 I'm proposing an extension for the "custom edit" (power search).

 ---------------
 '''Why I did this:'''
 First, I started scheduling with "record daily in this timeslot" because I
 just wanted to record daily in that timeslot. I figured out that the start
 of my show was shifter +/-5min and it was never recorded. There was a
 patch for "use some slack on recording starttime" to fix this problem 4
 years ago. But it was never integrated and it was closed about 3 months
 ago.

 I was told, that for something like I wanted there would be "custom edit"
 or "power search". I find it quite painfull to enter SQL-commands via
 remote control, so I got the idea that there should be something like
 dynamic variable
 evaluation for power searching. Something like that:
 {{{
 program.title = '{TITLE}' AND TIME_TO_SEC(TIME(program.starttime)) >=
 {STARTSEC}-600 AND TIME_TO_SEC(TIME(program.endtime)) <= {ENDSEC}+600
 }}}
 This could be stored as sample-clause for the custom-edit dialog and could
 be dynamically evaluated and filled with date from the program guide.

 ---------------------------------
 '''How is it used with stored rules?'''
 Go to program-guide -> select a show -> menu -> recording options ->
 custom edit. Delete the default "program.title = '...'" from the edit box.
 Select your stored custom example e.g. "timeslack timeslot" (above). Press
 SELECT (OK). Press "test" or "record". Finished.

 It's fast and easy :-)

 ------------------------------------------------
 '''How does it work and how do I create such rules?'''
 Go to program-guide -> select a show -> menu -> recording options ->
 custom edit.
 Now you can enter the example above and test, record or store the rule.

 If you select "test" or "record" the recording rule is evaluated before it
 is tested or it is recorded. If you select "store" you can store your
 unevaluated rule in the database as custom example rule.

 Now the tricky part to explain:
 The default is that stored rules with variables are evaluated by default.
 You can select an example rule and see something like this in the small
 box on the right.
 {{{
 program.title like 'Simpsons' AND TIME_TO_SEC(TIME(program.starttime)) >=
 10000-600 AND TIME_TO_SEC(TIME(program.endtime)) <= 12000+600
 }}}
 When pressing "E" ("EDIT") you can toggle between enabled and disabled
 evaluation. So, if you want to edit a stored rule with variables, you
 could disable evaluation, select the rule you want to edit and press OK
 (select) in order to
 copy the unevaluated rule to the edit box. Then you could edit it and
 store it again.

 For instance: Select "timeslack timeslot"-Rule, press "E" until the
 unevaluated rule is displayed, press SELECT (OK). Then it is copied to the
 edit box where you can edit it. When pressing "TEST" or "RECORD" it is
 evaluated before the
 rule is tested or recorded (but it doesn't change the edit box).

 There are a couple of variables:
 {{{
 TITLE : m_pginfo->GetTitle()
 SUBTITLE : m_pginfo->GetSubtitle()
 DESCR : m_pginfo->GetDescription()
 SERIESID :m_pginfo->GetSeriesID()
 PROGID : GetProgramID()
 SEASON : m_pginfo->GetSeason()
 EPISODE :m_pginfo->GetEpisode();
 CATEGORY : m_pginfo->GetCategory();
 CHANID : m_pginfo->GetChanID();
 CHANNUM : m_pginfo->GetChanNum();
 SCHEDID : m_pginfo->GetChannelSchedulingID();
 CHANNAME : m_pginfo->GetChannelName();
 DAYNAME : m_pginfo->GetScheduledStartTime().toString("dddd"); (SQL dayname
 format)
 STARTDATE : m_pginfo->GetScheduledStartTime().toString("yyyy-mm-dd
 hh:mm:ss"); (SQL datetime format)
 ENDDATE : m_pginfo->GetScheduledEndTime().toString("yyyy-mm-dd hh:mm:ss");
 (SQL datetime format)
 STARTTIME :m_pginfo->GetScheduledStartTime().toString("hh:mm");
 ENDTIME : m_pginfo->GetScheduledEndTime().toString("hh:mm");
 STARTSEC : (program.starttime seconds since midnight)
 ENDSEC : (program.endtime seconds since midnight)
 }}}
 -------------------------------
 '''How does it affect other users?'''
 Not at all. If they didn't know it exists, they wouldn't notice anything
 at all about changed behaviour :-)
 Though, I changed the pre-existing samples for use with the variables
 mentioned above (where applicable), but as I said, nothing visibly changed
 :-)

 Feedback welcomed.

-- 
Ticket URL: <http://code.mythtv.org/trac/ticket/10734>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center


More information about the mythtv-commits mailing list