MythTV  master
Macros | Functions | Variables
programinfo.cpp File Reference
#include <algorithm>
#include <QRegExp>
#include <QMap>
#include <QUrl>
#include <QFile>
#include <QFileInfo>
#include <QDir>
#include "programinfoupdater.h"
#include "mythcorecontext.h"
#include "mythscheduler.h"
#include "mythmiscutil.h"
#include "storagegroup.h"
#include "mythlogging.h"
#include "programinfo.h"
#include "remotefile.h"
#include "remoteutil.h"
#include "mythdb.h"
#include "compat.h"
#include "mythcdrom.h"
#include "mythsorthelper.h"
#include <unistd.h>
#include <cassert>
Include dependency graph for programinfo.cpp:

Go to the source code of this file.

Macros

#define LOC   QString("ProgramInfo(%1): ").arg(GetBasename())
 
#define INT_TO_LIST(x)   do { list << QString::number(x); } while (false)
 
#define DATETIME_TO_LIST(x)
 
#define LONGLONG_TO_LIST(x)   do { list << QString::number(x); } while (false)
 
#define STR_TO_LIST(x)   do { list << (x); } while (false)
 
#define DATE_TO_LIST(x)   do { list << (x).toString(Qt::ISODate); } while (false)
 
#define FLOAT_TO_LIST(x)   do { list << QString("%1").arg(x); } while (false)
 
#define NEXT_STR()
 
#define INT_FROM_LIST(x)   do { NEXT_STR(); (x) = ts.toLongLong(); } while (false)
 
#define ENUM_FROM_LIST(x, y)   do { NEXT_STR(); (x) = ((y)ts.toInt()); } while (false)
 
#define DATETIME_FROM_LIST(x)
 
#define DATE_FROM_LIST(x)
 
#define STR_FROM_LIST(x)   do { NEXT_STR(); (x) = ts; } while (false)
 
#define FLOAT_FROM_LIST(x)   do { NEXT_STR(); (x) = ts.toFloat(); } while (false)
 

Functions

static int init_tr (void)
 
int pginfo_init_statics ()
 
static void set_flag (uint32_t &flags, int flag_to_set, bool is_set)
 
static QString determineURLType (const QString &url)
 
QString myth_category_type_to_string (ProgramInfo::CategoryType category_type)
 
ProgramInfo::CategoryType string_to_myth_category_type (const QString &category_type)
 
bool qstringEqualOrDefault (const QString &a, const QString &b)
 
static ProgramInfoType discover_program_info_type (uint chanid, const QString &pathname, bool use_remote)
 
static uint load_markup_datum (MarkTypes type, uint chanid, const QDateTime &recstartts)
 
static bool FromProgramQuery (const QString &sql, const MSqlBindings &bindings, MSqlQuery &query, const uint &start, const uint &limit, uint &count)
 
bool LoadFromProgram (ProgramList &destination, const QString &where, const QString &groupBy, const QString &orderBy, const MSqlBindings &bindings, const ProgramList &schedList)
 
bool LoadFromProgram (ProgramList &destination, const QString &sql, const MSqlBindings &bindings, const ProgramList &schedList)
 
bool LoadFromProgram (ProgramList &destination, const QString &sql, const MSqlBindings &bindings, const ProgramList &schedList, const uint &start, const uint &limit, uint &count)
 
ProgramInfoLoadProgramFromProgram (const uint chanid, const QDateTime &starttime)
 
bool LoadFromOldRecorded (ProgramList &destination, const QString &sql, const MSqlBindings &bindings)
 
bool LoadFromOldRecorded (ProgramList &destination, const QString &sql, const MSqlBindings &bindings, const uint &start, const uint &limit, uint &count)
 
bool LoadFromRecorded (ProgramList &destination, bool possiblyInProgressRecordingsOnly, const QMap< QString, uint32_t > &inUseMap, const QMap< QString, bool > &isJobRunning, const QMap< QString, ProgramInfo * > &recMap, int sort, const QString &sortBy)
 
bool GetNextRecordingList (QDateTime &nextRecordingStart, bool *hasConflicts, vector< ProgramInfo > *list)
 
MPUBLIC QString format_season_and_episode (int seasEp, int digits)
 

Variables

int force_init = pginfo_init_statics()
 
static const uint kInvalidDateTime = UINT_MAX
 
static const char * from_filemarkup_offset_asc
 
static const char * from_filemarkup_offset_desc
 
static const char * from_recordedseek_offset_asc
 
static const char * from_recordedseek_offset_desc
 
static const char * from_filemarkup_mark_asc
 
static const char * from_filemarkup_mark_desc
 
static const char * from_recordedseek_mark_asc
 
static const char * from_recordedseek_mark_desc
 

Macro Definition Documentation

◆ LOC

#define LOC   QString("ProgramInfo(%1): ").arg(GetBasename())

Definition at line 38 of file programinfo.cpp.

◆ INT_TO_LIST

#define INT_TO_LIST (   x)    do { list << QString::number(x); } while (false)

Definition at line 1254 of file programinfo.cpp.

◆ DATETIME_TO_LIST

#define DATETIME_TO_LIST (   x)
Value:
do { \
if ((x).isValid()) { \
INT_TO_LIST((x).toSecsSinceEpoch()); \
} else { \
INT_TO_LIST(kInvalidDateTime); \
} \
} while (false)
static const uint kInvalidDateTime
Definition: programinfo.cpp:50

Definition at line 1259 of file programinfo.cpp.

◆ LONGLONG_TO_LIST

#define LONGLONG_TO_LIST (   x)    do { list << QString::number(x); } while (false)

Definition at line 1268 of file programinfo.cpp.

◆ STR_TO_LIST

#define STR_TO_LIST (   x)    do { list << (x); } while (false)

Definition at line 1270 of file programinfo.cpp.

◆ DATE_TO_LIST

#define DATE_TO_LIST (   x)    do { list << (x).toString(Qt::ISODate); } while (false)

Definition at line 1271 of file programinfo.cpp.

◆ FLOAT_TO_LIST

#define FLOAT_TO_LIST (   x)    do { list << QString("%1").arg(x); } while (false)

Definition at line 1273 of file programinfo.cpp.

◆ NEXT_STR

#define NEXT_STR ( )
Value:
do { if (it == listend) \
{ \
LOG(VB_GENERAL, LOG_ERR, listerror); \
clear(); \
return false; \
} \
ts = *it++; } while (false)

Definition at line 1345 of file programinfo.cpp.

◆ INT_FROM_LIST

#define INT_FROM_LIST (   x)    do { NEXT_STR(); (x) = ts.toLongLong(); } while (false)

Definition at line 1353 of file programinfo.cpp.

◆ ENUM_FROM_LIST

#define ENUM_FROM_LIST (   x,
 
)    do { NEXT_STR(); (x) = ((y)ts.toInt()); } while (false)

Definition at line 1354 of file programinfo.cpp.

◆ DATETIME_FROM_LIST

#define DATETIME_FROM_LIST (   x)
Value:
do { NEXT_STR(); \
if (ts.isEmpty() or (ts.toUInt() == kInvalidDateTime)) { \
(x) = QDateTime(); \
} else { \
(x) = MythDate::fromSecsSinceEpoch(ts.toLongLong()); \
} \
} while (false)
#define NEXT_STR()
static const uint kInvalidDateTime
Definition: programinfo.cpp:50
MBASE_PUBLIC QDateTime fromSecsSinceEpoch(uint seconds)
This function takes the number of seconds since the start of the epoch and returns a QDateTime with t...
Definition: mythdate.cpp:88

Definition at line 1363 of file programinfo.cpp.

◆ DATE_FROM_LIST

#define DATE_FROM_LIST (   x)
Value:
do { NEXT_STR(); (x) = ((ts.isEmpty()) || (ts == "0000-00-00")) ? \
QDate() : QDate::fromString(ts, Qt::ISODate); \
} while (false)
#define NEXT_STR()
Default UTC.
Definition: mythdate.h:14
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:30

Definition at line 1372 of file programinfo.cpp.

◆ STR_FROM_LIST

#define STR_FROM_LIST (   x)    do { NEXT_STR(); (x) = ts; } while (false)

Definition at line 1377 of file programinfo.cpp.

◆ FLOAT_FROM_LIST

#define FLOAT_FROM_LIST (   x)    do { NEXT_STR(); (x) = ts.toFloat(); } while (false)

Definition at line 1379 of file programinfo.cpp.

Function Documentation

◆ init_tr()

static int init_tr ( void  )
static

Definition at line 5098 of file programinfo.cpp.

Referenced by ProgramInfo::i18n().

◆ pginfo_init_statics()

int pginfo_init_statics ( void  )

Definition at line 44 of file programinfo.cpp.

◆ set_flag()

static void set_flag ( uint32_t &  flags,
int  flag_to_set,
bool  is_set 
)
static

◆ determineURLType()

static QString determineURLType ( const QString &  url)
static

Definition at line 90 of file programinfo.cpp.

Referenced by discover_program_info_type(), and ProgramInfo::ProgramInfo().

◆ myth_category_type_to_string()

QString myth_category_type_to_string ( ProgramInfo::CategoryType  category_type)

◆ string_to_myth_category_type()

ProgramInfo::CategoryType string_to_myth_category_type ( const QString &  category_type)

◆ qstringEqualOrDefault()

bool qstringEqualOrDefault ( const QString &  a,
const QString &  b 
)

Compare two QStrings when they can either be initialized to "Default" or to the empty string.

Definition at line 1024 of file programinfo.cpp.

Referenced by ProgramInfo::operator==().

◆ discover_program_info_type()

static ProgramInfoType discover_program_info_type ( uint  chanid,
const QString &  pathname,
bool  use_remote 
)
static

◆ load_markup_datum()

static uint load_markup_datum ( MarkTypes  type,
uint  chanid,
const QDateTime &  recstartts 
)
static

◆ FromProgramQuery()

static bool FromProgramQuery ( const QString &  sql,
const MSqlBindings bindings,
MSqlQuery query,
const uint start,
const uint limit,
uint count 
)
static

Definition at line 5350 of file programinfo.cpp.

Referenced by LoadFromProgram().

◆ LoadFromProgram() [1/3]

bool LoadFromProgram ( ProgramList destination,
const QString &  where,
const QString &  groupBy,
const QString &  orderBy,
const MSqlBindings bindings,
const ProgramList schedList 
)

◆ LoadFromProgram() [2/3]

bool LoadFromProgram ( ProgramList destination,
const QString &  sql,
const MSqlBindings bindings,
const ProgramList schedList 
)

Definition at line 5467 of file programinfo.cpp.

◆ LoadFromProgram() [3/3]

bool LoadFromProgram ( ProgramList destination,
const QString &  sql,
const MSqlBindings bindings,
const ProgramList schedList,
const uint start,
const uint limit,
uint count 
)

Definition at line 5516 of file programinfo.cpp.

◆ LoadProgramFromProgram()

ProgramInfo* LoadProgramFromProgram ( const uint  chanid,
const QDateTime &  starttime 
)

Definition at line 5593 of file programinfo.cpp.

Referenced by Dvr::AddDontRecordSchedule(), and Guide::GetProgramDetails().

◆ LoadFromOldRecorded() [1/2]

bool LoadFromOldRecorded ( ProgramList destination,
const QString &  sql,
const MSqlBindings bindings 
)

◆ LoadFromOldRecorded() [2/2]

bool LoadFromOldRecorded ( ProgramList destination,
const QString &  sql,
const MSqlBindings bindings,
const uint start,
const uint limit,
uint count 
)

Definition at line 5636 of file programinfo.cpp.

◆ LoadFromRecorded()

bool LoadFromRecorded ( ProgramList destination,
bool  possiblyInProgressRecordingsOnly,
const QMap< QString, uint32_t > &  inUseMap,
const QMap< QString, bool > &  isJobRunning,
const QMap< QString, ProgramInfo * > &  recMap,
int  sort,
const QString &  sortBy 
)

◆ GetNextRecordingList()

bool GetNextRecordingList ( QDateTime &  nextRecordingStart,
bool hasConflicts,
vector< ProgramInfo > *  list 
)

Definition at line 6027 of file programinfo.cpp.

Referenced by setScheduledWakeupTime(), and WelcomeDialog::updateScheduledList().

◆ format_season_and_episode()

MPUBLIC QString format_season_and_episode ( int  seasEp,
int  digits 
)

Variable Documentation

◆ force_init

int force_init = pginfo_init_statics()

Definition at line 47 of file programinfo.cpp.

◆ kInvalidDateTime

const uint kInvalidDateTime = UINT_MAX
static

Definition at line 50 of file programinfo.cpp.

◆ from_filemarkup_offset_asc

const char* from_filemarkup_offset_asc
static
Initial value:
=
"SELECT mark, offset FROM filemarkup"
" WHERE filename = :PATH"
" AND type = :TYPE"
" AND mark >= :QUERY_ARG"
" ORDER BY filename ASC, type ASC, mark ASC LIMIT 1;"

Definition at line 3904 of file programinfo.cpp.

Referenced by ProgramInfo::QueryKeyFrameDuration(), and ProgramInfo::QueryKeyFramePosition().

◆ from_filemarkup_offset_desc

const char* from_filemarkup_offset_desc
static
Initial value:
=
"SELECT mark, offset FROM filemarkup"
" WHERE filename = :PATH"
" AND type = :TYPE"
" AND mark <= :QUERY_ARG"
" ORDER BY filename DESC, type DESC, mark DESC LIMIT 1;"

Definition at line 3910 of file programinfo.cpp.

Referenced by ProgramInfo::QueryKeyFrameDuration(), and ProgramInfo::QueryKeyFramePosition().

◆ from_recordedseek_offset_asc

const char* from_recordedseek_offset_asc
static
Initial value:
=
"SELECT mark, offset FROM recordedseek"
" WHERE chanid = :CHANID"
" AND starttime = :STARTTIME"
" AND type = :TYPE"
" AND mark >= :QUERY_ARG"
" ORDER BY chanid ASC, starttime ASC, type ASC, mark ASC LIMIT 1;"

Definition at line 3916 of file programinfo.cpp.

Referenced by ProgramInfo::QueryKeyFrameDuration(), and ProgramInfo::QueryKeyFramePosition().

◆ from_recordedseek_offset_desc

const char* from_recordedseek_offset_desc
static
Initial value:
=
"SELECT mark, offset FROM recordedseek"
" WHERE chanid = :CHANID"
" AND starttime = :STARTTIME"
" AND type = :TYPE"
" AND mark <= :QUERY_ARG"
" ORDER BY chanid DESC, starttime DESC, type DESC, mark DESC LIMIT 1;"

Definition at line 3923 of file programinfo.cpp.

Referenced by ProgramInfo::QueryKeyFrameDuration(), and ProgramInfo::QueryKeyFramePosition().

◆ from_filemarkup_mark_asc

const char* from_filemarkup_mark_asc
static
Initial value:
=
"SELECT offset,mark FROM filemarkup"
" WHERE filename = :PATH"
" AND type = :TYPE"
" AND offset >= :QUERY_ARG"
" ORDER BY filename ASC, type ASC, mark ASC LIMIT 1;"

Definition at line 3930 of file programinfo.cpp.

Referenced by ProgramInfo::QueryDurationKeyFrame(), and ProgramInfo::QueryPositionKeyFrame().

◆ from_filemarkup_mark_desc

const char* from_filemarkup_mark_desc
static
Initial value:
=
"SELECT offset,mark FROM filemarkup"
" WHERE filename = :PATH"
" AND type = :TYPE"
" AND offset <= :QUERY_ARG"
" ORDER BY filename DESC, type DESC, mark DESC LIMIT 1;"

Definition at line 3936 of file programinfo.cpp.

Referenced by ProgramInfo::QueryDurationKeyFrame(), and ProgramInfo::QueryPositionKeyFrame().

◆ from_recordedseek_mark_asc

const char* from_recordedseek_mark_asc
static
Initial value:
=
"SELECT offset,mark FROM recordedseek"
" WHERE chanid = :CHANID"
" AND starttime = :STARTTIME"
" AND type = :TYPE"
" AND offset >= :QUERY_ARG"
" ORDER BY chanid ASC, starttime ASC, type ASC, mark ASC LIMIT 1;"

Definition at line 3942 of file programinfo.cpp.

Referenced by ProgramInfo::QueryDurationKeyFrame(), and ProgramInfo::QueryPositionKeyFrame().

◆ from_recordedseek_mark_desc

const char* from_recordedseek_mark_desc
static
Initial value:
=
"SELECT offset,mark FROM recordedseek"
" WHERE chanid = :CHANID"
" AND starttime = :STARTTIME"
" AND type = :TYPE"
" AND offset <= :QUERY_ARG"
" ORDER BY chanid DESC, starttime DESC, type DESC, mark DESC LIMIT 1;"

Definition at line 3949 of file programinfo.cpp.

Referenced by ProgramInfo::QueryDurationKeyFrame(), and ProgramInfo::QueryPositionKeyFrame().