9 #include <QScopedPointer>
24 if (sizeKB>1024*1024*1024)
26 double sizeGB = sizeKB/(1024*1024*1024.0);
27 return QString(
"%1 TB").arg(sizeGB, 0,
'f', (sizeGB>10)?0:prec);
31 double sizeGB = sizeKB/(1024*1024.0);
32 return QString(
"%1 GB").arg(sizeGB, 0,
'f', (sizeGB>10)?0:prec);
36 double sizeMB = sizeKB/1024.0;
37 return QString(
"%1 MB").arg(sizeMB, 0,
'f', (sizeMB>10)?0:prec);
40 return QString(
"%1 KB").arg(sizeKB);
48 QString timedate = QString(
"%1 - %2")
60 int maxll = std::max(
title.length(), 20);
61 if (extra.length() > maxll)
62 extra = extra.left(maxll - 3) +
"...";
65 return QString(
"%1%2 - %3").arg(
title).arg(extra).arg(timedate);
70 std::cout <<
"Checking Recordings" << std::endl;
73 std::vector<ProgramInfo *> missingRecordings;
74 std::vector<ProgramInfo *> zeroByteRecordings;
75 std::vector<ProgramInfo *> noSeektableRecordings;
79 std::cout <<
"ERROR - failed to get recording list from backend" << std::endl;
85 std::cout <<
"Fix seektable is: " << fixSeektable << std::endl;
87 if (!recordingList->empty())
89 for (
auto i = recordingList->begin(); i != recordingList->end(); ++i)
93 if (
p->GetRecordingGroup() ==
"LiveTV" ||
94 p->GetRecordingGroup() ==
"Deleted")
96 i = recordingList->erase(i);
102 bool foundFile =
true;
104 QString url =
p->GetPlaybackURL();
106 if (url.startsWith(
'/'))
111 std::cout <<
"File not found" << std::endl;
112 missingRecordings.push_back(
p);
119 std::cout <<
"File was found but has zero length" << std::endl;
120 zeroByteRecordings.push_back(
p);
124 else if (url.startsWith(
"myth:"))
128 std::cout <<
"File not found" << std::endl;
129 missingRecordings.push_back(
p);
137 std::cout <<
"File was found but has zero length" << std::endl;
138 zeroByteRecordings.push_back(
p);
145 if (posMap.isEmpty())
147 if (posMap.isEmpty())
150 if (posMap.isEmpty())
152 std::cout <<
"No seektable found" << std::endl;
154 noSeektableRecordings.push_back(
p);
156 if (foundFile && fixSeektable)
159 QString(
"--rebuild --chanid %1 --starttime %2")
162 std::cout <<
"Running - " << qPrintable(command) << std::endl;
167 std::cout <<
"ERROR - mythcommflag exited with result: " << cmd.data()->GetExitCode() << std::endl;
172 std::cout <<
"-------------------------------------------------------------------" << std::endl;
176 if (!missingRecordings.empty())
178 std::cout << std::endl << std::endl;
179 std::cout <<
"MISSING RECORDINGS" << std::endl;
180 std::cout <<
"------------------" << std::endl;
181 for (
auto *
p : missingRecordings)
184 std::cout << qPrintable(
p->GetPlaybackURL()) << std::endl;
185 std::cout <<
"-------------------------------------------------------------------" << std::endl;
189 if (!zeroByteRecordings.empty())
191 std::cout << std::endl << std::endl;
192 std::cout <<
"ZERO BYTE RECORDINGS" << std::endl;
193 std::cout <<
"--------------------" << std::endl;
194 for (
auto *
p : zeroByteRecordings)
197 std::cout << qPrintable(
p->GetPlaybackURL()) << std::endl;
198 std::cout <<
"-------------------------------------------------------------------" << std::endl;
202 if (!noSeektableRecordings.empty())
204 std::cout << std::endl << std::endl;
205 std::cout <<
"NO SEEKTABLE RECORDINGS" << std::endl;
206 std::cout <<
"-----------------------" << std::endl;
207 for (
auto *
p : noSeektableRecordings)
210 std::cout << qPrintable(
p->GetPlaybackURL()) << std::endl;
211 std::cout <<
"File size is " << qPrintable(
formatSize(
p->GetFilesize(), 2)) << std::endl;
212 std::cout <<
"-------------------------------------------------------------------" << std::endl;
216 std::cout << std::endl << std::endl <<
"SUMMARY" << std::endl;
217 std::cout <<
"Recordings : " << recordingList->size() << std::endl;
218 std::cout <<
"Missing Recordings : " << missingRecordings.size() << std::endl;
219 std::cout <<
"Zero byte Recordings : " << zeroByteRecordings.size() << std::endl;
220 std::cout <<
"Missing Seektables : " << noSeektableRecordings.size() << std::endl;