Ticket #12290: commercial-flagging-not-queued-workaround.patch0

File commercial-flagging-not-queued-workaround.patch0, 2.5 KB (added by Bill Meek <keemllib@…>, 5 years ago)

Workaround - tested on: v0.28-pre-2261-g53254f3

Line 
1diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp
2index 14f4b0a..511e828 100644
3--- a/mythtv/libs/libmyth/programinfo.cpp
4+++ b/mythtv/libs/libmyth/programinfo.cpp
5@@ -5804,11 +5804,11 @@ void ProgramInfo::SaveFilesize(uint64_t fsize)
6     updater->insert(chanid, recstartts, kPIUpdateFileSize, fsize);
7 }
8 
9-uint64_t ProgramInfo::GetFilesize(void) const
10-{
11-    LOG(VB_GENERAL, LOG_DEBUG, "FIXME: ProgramInfo::GetFilesize() called instead of RecordingInfo::GetFilesize()");
12-    return filesize;
13-}
14+//uint64_t ProgramInfo::GetFilesize(void) const
15+//{
16+//    LOG(VB_GENERAL, LOG_DEBUG, "FIXME: ProgramInfo::GetFilesize() called instead of RecordingInfo::GetFilesize()");
17+//    return filesize;
18+//}
19 
20 
21 /// \brief Gets recording file size direct from the database.
22@@ -5816,23 +5816,31 @@ uint64_t ProgramInfo::GetFilesize(void) const
23 /// In theory this should be redundant, the ProgramInfo updater should sync
24 /// all instances on frontends and backends without the need
25 /// for any one to go checking the database.
26-// uint64_t ProgramInfo::QueryFilesize(void) const
27-// {
28-//     LOG(VB_GENERAL, LOG_DEBUG, "FIXME: ProgramInfo::QueryFilesize() called instead of RecordingInfo::GetFilesize()");
29-//
30-//     MSqlQuery query(MSqlQuery::InitCon());
31-//
32-//     query.prepare(
33-//         "SELECT filesize "
34-//         "FROM recorded "
35-//         "WHERE chanid    = :CHANID AND "
36-//         "      starttime = :STARTTIME");
37-//     query.bindValue(":CHANID", chanid);
38-//     query.bindValue(":STARTTIME", recstartts);
39-//     if (query.exec() && query.next())
40-//         return query.value(0).toULongLong();
41-//
42-//     return filesize;
43-// }
44+uint64_t ProgramInfo::GetFilesize(void) const
45+{
46+
47+    uint64_t db_filesize = 0;
48+
49+    MSqlQuery query(MSqlQuery::InitCon());
50+
51+// When failing, recordedfile.filesize = filesize = 0
52+    query.prepare(
53+        "SELECT filesize "
54+        "FROM recorded "
55+        "WHERE chanid    = :CHANID AND "
56+        "      starttime = :STARTTIME");
57+    query.bindValue(":CHANID",    chanid);
58+    query.bindValue(":STARTTIME", recstartts);
59+    if (query.exec() && query.next())
60+    {
61+        db_filesize = query.value(0).toULongLong();
62+        LOG(VB_GENERAL, filesize == 0 ? LOG_ERR : LOG_DEBUG,
63+            QString("GetFilesize(), db_filesize=%1, filesize=%2.")
64+                .arg(db_filesize).arg(filesize));
65+        return db_filesize;
66+    }
67+
68+    return filesize;
69+}
70 
71 /* vim: set expandtab tabstop=4 shiftwidth=4: */