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 21:58:38 (GMT)
commitbb5e10714603ea5e599e38d1ec109046105ed2b1 (patch)
tree80c1b6516c698c1f37258377baafee523099c7ea
parent6dbb6e98882f111368a4dc18bb10aa4adf015d47 (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 6c4a69a..581ae2c 100644
--- a/mythtv/libs/libmythmetadata/videometadata.cpp
+++ b/mythtv/libs/libmythmetadata/videometadata.cpp
@@ -909,7 +909,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);
@@ -923,6 +923,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");
@@ -932,7 +933,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;
}