From 1f7848422fff5153132fa77967643d1848d3280e Mon Sep 17 00:00:00 2001 From: Gary Buhrmaster Date: Tue, 7 Mar 2017 00:38:33 +0000 Subject: [PATCH] Validate the programme starttime/channel early If a programme does not have a starttime the (later) attempted insertion of the program into the database will result in a database constraint error. If the program does not have a channel there will be a match error later. Verify both early (perhaps with better log messages). --- mythtv/programs/mythfilldatabase/xmltvparser.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mythtv/programs/mythfilldatabase/xmltvparser.cpp b/mythtv/programs/mythfilldatabase/xmltvparser.cpp index c967e004475..f3249ce4430 100644 --- a/mythtv/programs/mythfilldatabase/xmltvparser.cpp +++ b/mythtv/programs/mythfilldatabase/xmltvparser.cpp @@ -695,7 +695,21 @@ bool XMLTVParser::parseFile( { ProgInfo *pginfo = parseProgram(e); - if (pginfo->startts == pginfo->endts) + if (!(pginfo->starttime.isValid())) + { + LOG(VB_GENERAL, LOG_WARNING, QString("Invalid programme (%1), " + "invalid start time, " + "skipping") + .arg(pginfo->title)); + } + else if (pginfo->channel.isEmpty()) + { + LOG(VB_GENERAL, LOG_WARNING, QString("Invalid programme (%1), " + "missing channel, " + "skipping") + .arg(pginfo->title)); + } + else if (pginfo->startts == pginfo->endts) { LOG(VB_GENERAL, LOG_WARNING, QString("Invalid programme (%1), " "identical start and end "