summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert McNamara <rmcnamara@mythtv.org>2011-01-28 20:47:38 (GMT)
committer Robert McNamara <rmcnamara@mythtv.org>2011-01-28 20:47:38 (GMT)
commita0fcdbbc8ae485c7cd72bc414aa569b65dfe40ca (patch)
treebb00803f956b228fd9a2fdd8f3c3ab6ec4bd7651
parentc2304c0379d82f15e6c9f027ba78a2a1541fae5f (diff)
Update the seektables when a filename changes on scan in MythVideo.
Patch from Johnny Stenback. Fixes #9415.
-rw-r--r--mythtv/libs/libmythmetadata/videometadata.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/mythtv/libs/libmythmetadata/videometadata.cpp b/mythtv/libs/libmythmetadata/videometadata.cpp
index b9c2bc6..d26e76c 100644
--- a/mythtv/libs/libmythmetadata/videometadata.cpp
+++ b/mythtv/libs/libmythmetadata/videometadata.cpp
@@ -910,7 +910,7 @@ int VideoMetadata::UpdateHashedDBRecord(const QString &hash,
{
MSqlQuery query(MSqlQuery::InitCon());
- query.prepare("SELECT intid FROM videometadata WHERE "
+ query.prepare("SELECT intid,filename FROM videometadata WHERE "
"hash = :HASH");
query.bindValue(":HASH", hash);
@@ -924,6 +924,7 @@ int VideoMetadata::UpdateHashedDBRecord(const QString &hash,
return -1;
int intid = query.value(0).toInt();
+ QString oldfilename = query.value(1).toString();
query.prepare("UPDATE videometadata SET filename = :FILENAME, "
"host = :HOST WHERE intid = :INTID");
@@ -933,7 +934,18 @@ int VideoMetadata::UpdateHashedDBRecord(const QString &hash,
if (!query.exec() || !query.isActive())
{
- MythDB::DBError("Video hashed metadata update", query);
+ MythDB::DBError("Video hashed metadata update (videometadata)", query);
+ return -1;
+ }
+
+ query.prepare("UPDATE filemarkup SET filename = :FILENAME "
+ "WHERE filename = :OLDFILENAME");
+ query.bindValue(":FILENAME", file_name);
+ query.bindValue(":OLDFILENAME", oldfilename);
+
+ if (!query.exec() || !query.isActive())
+ {
+ MythDB::DBError("Video hashed metadata update (filemarkup)", query);
return -1;
}