Opened 13 years ago

Closed 13 years ago

#1739 closed patch (fixed)

mythfilldatabase - Only save DD lineups when new channels are detected

Reported by: sphery <mtdean@…> Owned by: danielk
Priority: minor Milestone: 0.20
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

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

Attachments (1)

mythtv-mythfilldatabase-update_lineups_only_when_necessary.patch (3.3 KB) - added by sphery <mtdean@…> 13 years ago.

Download all attachments as: .zip

Change History (3)

Changed 13 years ago by sphery <mtdean@…>

comment:1 Changed 13 years ago by danielk

Milestone: 0.20
Status: newassigned
Version: head

comment:2 Changed 13 years ago by danielk

Resolution: fixed
Status: assignedclosed

(In [9924]) Fixes #1739. Avoids automatic update DataDirect? lineup when there are no new channels for us to remove from the listings.

Patch from mtdean at thirdcontact dt com which lowers the strain on DataDirect? servers by avoiding a save of the listings when there are no listings changes to save.

Note: See TracTickets for help on using tickets.