Skip to content
Browse files

Update the seektables when a filename changes on scan in MythVideo.

Patch from Johnny Stenback.  Fixes #9415.
  • Loading branch information...
1 parent 6dbb6e9 commit bb5e10714603ea5e599e38d1ec109046105ed2b1 Robert McNamara committed
Showing with 14 additions and 2 deletions.
  1. +14 −2 mythtv/libs/libmythmetadata/videometadata.cpp
View
16 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;
}

0 comments on commit bb5e107

Please sign in to comment.
Something went wrong with that request. Please try again.