[mythtv-commits] Ticket #1739: mythfilldatabase - Only save DD lineups when new channels are detected

MythTV mythtv at cvs.mythtv.org
Wed Apr 26 23:30:01 UTC 2006


#1739: mythfilldatabase - Only save DD lineups when new channels are detected
----------------------------------------------+-----------------------------
 Reporter:  sphery <mtdean at thirdcontact.com>  |       Owner:  danielk
     Type:  patch                             |      Status:  new    
 Priority:  minor                             |   Milestone:         
Component:  mythtv                            |     Version:         
 Severity:  medium                            |  
----------------------------------------------+-----------------------------
 The attached patch ensures that mythfilldatabase only saves a !DataDirect
 lineup when new channels were detected in the downloaded data.  Before the
 patch, if the user has a digital source (DVB/ATSC) or if the user
 specifies --remove-new-channels, mfdb will save the user's lineup
 regardless of whether it contains more channels than the MythTV
 videosource.  That means that every single run of mfdb updates the Zap2It
 user-preference database (so it will generally happen once per day per
 lineup for the user).  This patch should reduce the workload for the user-
 preference database by ensuring it's only updated when the lineup contains
 new channels (i.e. when its channel list differs from the MythTV
 videosource channel list).

 The patch changes the return value of
 DataDirectProcessor::UpdateChannelsSafe() to an int specifying the number
 of new channels.  A value of 0 indicates successful completion with no new
 channels.  A positive value indicates new channels were detected.  A
 negative value indicates failure.  Although you have a TODO in
 filldata.cpp mentioning the need to remove from MythTV's database channels
 that are no longer in the lineup, it seems this would be done somewhere
 besides UpdateChannelsSafe() because it requires very different logic
 (and, in fact, your TODO puts it in a slightly different place).  However,
 if you want a negative return value from UpdateChannelsSafe() to indicate
 channels were removed/should be removed from MythTV's database, we can use
 INT_MIN or something to indicate failure.

 The patch also adds some log output (made possible by the change to detect
 whether new channels were received).  For each new channel (when
 insert_channels is false), mfdb outputs:

 2006-04-26 18:48:03.275 Not adding channel Inter Plus (DISH) (INTERPL).

 where the message is "Not adding channel <channel name> (<callsign>)."
 (DISH actually has "(DISH)"--with parens--in that channel's name.)  And,
 after saving the lineup without the new channels, mfdb outputs:

 2006-04-26 18:48:22.031 Removed 1 channel(s) from lineup.

 The log output is very useful because it explained why my lineup was saved
 even though I hadn't yet added a channel to the lineup for testing (DD
 just added that channel today)--so it probably saved me a lot of grief
 trying to figure out why my code didn't work.  :)  Also, users can use the
 messages to "notice" when new channels are removed from their lineups (in
 case they want to re-add the channels).  This would be especially nice for
 ATSC users, for example, who simply need to scan for the new channels as
 opposed to analog users (who often need to subscribe to the new channel).

 Note, also, that because UpdateChannelsSafe() is matching on xmltvid, even
 in the situation I mentioned in #1520--where multiple channels have the
 same ID (an "alias" channel number) but the user only puts one in the
 MythTV database--log messages saying, "Not adding..." will not be output
 for those channels having the same xmltvid as one in the MythTV database.

 (Gotta work on making my descriptions less verbose than my patches...)

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/1739>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list