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))
48 if (start < firstGap.
GetEnd())
60 if (
back.GetStart() < end)
67 int start_gap = (first.isValid()) ? start.secsTo(first) : 0;
72 int end_gap = (latest.isValid()) ? latest.secsTo(end) : 0;
81 LOG(VB_RECORD, LOG_INFO,
82 QString(
"RecordingQuality() start(%1) end(%2) score(%3)")
89 int continuity_error_count,
int packet_count)
101 else if (er >= 0.0001)
117 QString(R
"(<RecordingQuality overall_score="%1" key="%2")")
122 str += QString(R
"( continuity_error_count="%1" packet_count="%2")")
131 auto add_gap = [](
const QString& s,
const auto & gap) {
133 QString(
"<Gap start=\"%1\" end=\"%2\" duration=\"%3\" />\n")
136 .arg(gap.GetStart().secsTo(gap.GetEnd()));
141 return str +
"</RecordingQuality>";
149 RecordingGaps::iterator it = gaps.begin();
150 RecordingGaps::iterator next = it; ++next;
151 while (next != gaps.end())
153 if ((*it).GetEnd() >= (*next).GetStart())
155 (*it) =
RecordingGap((*it).GetStart(), (*next).GetEnd());
156 next = gaps.erase(next);
168 RecordingGaps::const_iterator it = gaps.begin();
169 if (it == gaps.end())
174 double program_length = start.secsTo(
get_end(ri));
175 if (program_length < 1.0)
179 for (; it != gaps.end(); ++it)
181 double gap_start = start.secsTo((*it).GetStart());
182 double gap_end = start.secsTo((*it).GetEnd());
183 double gap_length = gap_end - gap_start;
184 double rel_start = gap_start / program_length;
185 double rel_end = gap_end / program_length;
186 double rel_center = (rel_start + rel_end) * 0.5;
187 double rel_length = rel_end - rel_start;
197 if (rel_center >= 0.9 || rel_end >= 0.95)
200 if (rel_center < 0.1)
206 if (gap_length > 120)
216 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
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