18 : m_recordingGaps(
std::move(rg))
28 LOG(VB_RECORD, LOG_INFO,
34 const QDateTime &first,
const QDateTime &latest) :
35 m_recordingGaps(
std::move(rg))
50 if (start < firstGap.
GetEnd())
57 QDateTime end =
get_end(*ri).addSecs(-max_end);
62 if (
back.GetStart() < end)
69 int start_gap = (first.isValid()) ? start.secsTo(first) : 0;
70 if (start_gap > max_start)
74 int end_gap = (latest.isValid()) ? latest.secsTo(end) : 0;
75 if (end_gap > max_end)
83 LOG(VB_RECORD, LOG_INFO,
84 QString(
"RecordingQuality() start(%1) end(%2) score(%3)")
91 int continuity_error_count,
int packet_count)
101 else if (er >= 0.001)
103 else if (er >= 0.0001)
119 QString(R
"(<RecordingQuality overall_score="%1" key="%2")")
124 str += QString(R
"( continuity_error_count="%1" packet_count="%2")")
133 auto add_gap = [](
const QString& s,
const auto & gap) {
135 QString(
"<Gap start=\"%1\" end=\"%2\" duration=\"%3\" />\n")
138 .arg(gap.GetStart().secsTo(gap.GetEnd()));
143 return str +
"</RecordingQuality>";
151 RecordingGaps::iterator it = gaps.begin();
152 RecordingGaps::iterator next = it; ++next;
153 while (next != gaps.end())
155 if ((*it).GetEnd() >= (*next).GetStart())
157 (*it) =
RecordingGap((*it).GetStart(), (*next).GetEnd());
158 next = gaps.erase(next);
170 RecordingGaps::const_iterator it = gaps.begin();
171 if (it == gaps.end())
176 double program_length = start.secsTo(
get_end(ri));
177 if (program_length < 1.0)
181 for (; it != gaps.end(); ++it)
183 double gap_start = start.secsTo((*it).GetStart());
184 double gap_end = start.secsTo((*it).GetEnd());
185 double gap_length = gap_end - gap_start;
186 double rel_start = gap_start / program_length;
187 double rel_end = gap_end / program_length;
188 double rel_center = (rel_start + rel_end) * 0.5;
189 double rel_length = rel_end - rel_start;
199 if (rel_center >= 0.9 || rel_end >= 0.95)
202 if (rel_center < 0.1)
208 if (gap_length > 120)
218 return (score > 0.0) ? score : 0.0;
int GetNumSetting(const QString &key, int defaultval=0)
QDateTime GetScheduledEndTime(void) const
The scheduled end time of the program.
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
QString MakeUniqueKey(void) const
Creates a unique string that can be used to identify an existing recording.
QDateTime GetEnd(void) const
Holds information on a TV Program one might wish to record.
QDateTime GetDesiredEndTime(void) const
QDateTime GetDesiredStartTime(void) const
RecordingGaps m_recordingGaps
bool IsDamaged(void) const
void AddTSStatistics(int continuity_error_count, int packet_count)
QString toStringXML(void) const
RecordingQuality(const RecordingInfo *ri, RecordingGaps rg)
int m_continuityErrorCount
static std::vector< uint32_t > back
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
QString indentSpaces(unsigned int level, unsigned int size=4)
static QDateTime get_start(const RecordingInfo &)
static double score_gaps(const RecordingInfo &, const RecordingGaps &)
static void merge_overlapping(RecordingGaps &gaps)
static QDateTime get_end(const RecordingInfo &)
QList< RecordingGap > RecordingGaps