diff --git a/mythtv/programs/mythfilldatabase/channeldata.cpp b/mythtv/programs/mythfilldatabase/channeldata.cpp index 26bfca84ed8..d031a979292 100644 --- a/mythtv/programs/mythfilldatabase/channeldata.cpp +++ b/mythtv/programs/mythfilldatabase/channeldata.cpp @@ -323,17 +323,25 @@ void ChannelData::handleChannels(int id, ChannelInfoList *chanlist) cout << "### " << endl; } } - else if ((dbChan.icon != localfile) || - (dbChan.xmltvid != (*i).xmltvid)) + else if (!m_guideDataOnly && + ((dbChan.icon != localfile) || + (dbChan.xmltvid != (*i).xmltvid))) { LOG(VB_XMLTV, LOG_NOTICE, QString("Updating channel %1 (%2)") .arg(dbChan.name).arg(dbChan.chanid)); - if (!m_nonUSUpdating && !localfile.isEmpty()) + + if (localfile.isEmpty()) + localfile = dbChan.icon; + + if (dbChan.xmltvid != (*i).xmltvid) { MSqlQuery subquery(MSqlQuery::InitCon()); - subquery.prepare("UPDATE channel SET icon = :ICON WHERE " + + subquery.prepare("UPDATE channel SET icon = :ICON " + ", xmltvid:= :XMLTVID WHERE " "chanid = :CHANID;"); subquery.bindValue(":ICON", localfile); + subquery.bindValue(":XMLTVID", (*i).xmltvid); subquery.bindValue(":CHANID", dbChan.chanid); if (!subquery.exec()) @@ -341,20 +349,16 @@ void ChannelData::handleChannels(int id, ChannelInfoList *chanlist) } else { - if (localfile.isEmpty()) - localfile = dbChan.icon; MSqlQuery subquery(MSqlQuery::InitCon()); - - subquery.prepare("UPDATE channel SET icon = :ICON " - ", xmltvid:= :XMLTVID WHERE " + subquery.prepare("UPDATE channel SET icon = :ICON WHERE " "chanid = :CHANID;"); subquery.bindValue(":ICON", localfile); - subquery.bindValue(":XMLTVID", (*i).xmltvid); subquery.bindValue(":CHANID", dbChan.chanid); if (!subquery.exec()) MythDB::DBError("Channel icon change", subquery); } + } } else if (insert_chan(id)) // Only insert channels for non-scannable sources @@ -418,10 +422,10 @@ void ChannelData::handleChannels(int id, ChannelInfoList *chanlist) cout << "### " << endl; } } - else if (!m_nonUSUpdating && ((minor == 0) || (freq > 0))) + else if (!m_guideDataOnly && ((minor == 0) || (freq > 0))) { // We only do this if we are not asked to skip it with the - // --updating flag. + // --update-guide-only (formerly --update) flag. int mplexid = 0, chanid = 0; if (minor > 0) { diff --git a/mythtv/programs/mythfilldatabase/channeldata.h b/mythtv/programs/mythfilldatabase/channeldata.h index d48ec6806bb..978ec8c77b0 100644 --- a/mythtv/programs/mythfilldatabase/channeldata.h +++ b/mythtv/programs/mythfilldatabase/channeldata.h @@ -11,7 +11,7 @@ class ChannelData { public: ChannelData() : - m_interactive(false), m_nonUSUpdating(false), + m_interactive(false), m_guideDataOnly(false), m_channelPreset(false), m_channelUpdates(false), m_removeNewChannels(false), m_filterNewChannels(true) {} @@ -27,7 +27,7 @@ class ChannelData public: bool m_interactive; - bool m_nonUSUpdating; + bool m_guideDataOnly; bool m_channelPreset; bool m_channelUpdates; bool m_removeNewChannels; diff --git a/mythtv/programs/mythfilldatabase/commandlineparser.cpp b/mythtv/programs/mythfilldatabase/commandlineparser.cpp index 19374e3a59a..1bf68417a89 100644 --- a/mythtv/programs/mythfilldatabase/commandlineparser.cpp +++ b/mythtv/programs/mythfilldatabase/commandlineparser.cpp @@ -18,12 +18,6 @@ void MythFillDatabaseCommandLineParser::LoadArguments(void) "Manual mode will interactively ask you questions about " "each channel as it is processed, to configure for " "future use."); - add("--update", "update", false, "Run non-destructive updates", - "Run non-destructive updates on the database for " - "users in xmltv zones that do not provide channel " - "data. Stops the addition of new channels and the " - "changing of channel icons.") - ->SetBlocks("manual"); add("--preset", "preset", false, "Use channel preset values instead of numbers", @@ -63,6 +57,21 @@ void MythFillDatabaseCommandLineParser::LoadArguments(void) ->SetRequiredChildOf("ddfile") ->SetRequiredChildOf("file"); + + add("--update", "update", false, "Run non-destructive updates", + "Run non-destructive updates on the database for " + "users in xmltv zones that do not provide channel " + "data. Stops the addition of new channels and the " + "changing of channel icons.") + ->SetBlocks("manual") + ->SetDeprecated("Use --only-update-guide instead.") + ->SetGroup("Guide Data Handling"); + add("--only-update-guide", "onlyguide", false, "Only update guide data", + "Only update the guide data, do not alter channels or icons.") + ->SetBlocks("manual") + ->SetGroup("Guide Data Handling"); + + add("--do-channel-updates", "dochannelupdates", false, "update channels using datadirect", "When using DataDirect, ask mythfilldatabase to " diff --git a/mythtv/programs/mythfilldatabase/main.cpp b/mythtv/programs/mythfilldatabase/main.cpp index 1a6f15115a7..718960e43d3 100644 --- a/mythtv/programs/mythfilldatabase/main.cpp +++ b/mythtv/programs/mythfilldatabase/main.cpp @@ -112,15 +112,11 @@ int main(int argc, char *argv[]) fill_data.chan_data.m_interactive = true; } - if (cmdline.toBool("update")) + if (cmdline.toBool("onlyguide") && cmdline.toBool("update")) { - if (cmdline.toBool("manual")) - { - cerr << "--update and --manual cannot be used simultaneously" - << endl; - return GENERIC_EXIT_INVALID_CMDLINE; - } - fill_data.chan_data.m_nonUSUpdating = true; + LOG(VB_GENERAL, LOG_NOTICE, + "Only updating guide data, channel and icon updates will be ignored"); + fill_data.chan_data.m_guideDataOnly = true; } if (cmdline.toBool("preset"))