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

Go to the source code of this file.

Macros

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

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 QString DateTimeToListInt (const QDateTime &x)
 
static QDateTime DateTimeFromListItem (const QString &str)
 
static QDate DateFromListItem (const QString &str)
 
template<typename T >
QString propsValueToString (const QString &name, QMap< T, QString > propNames, T props)
 
template<typename T >
uint propsValueFromString (const QString &name, const QMap< T, QString > &propNames, const QString &props)
 
static ProgramInfoType discover_program_info_type (uint chanid, const QString &pathname, bool use_remote)
 
static void delete_markup_datum (MarkTypes type, uint chanid, const QDateTime &recstartts)
 
static void delete_markup_datum (MarkTypes type, const QString &videoPath)
 
static void insert_markup_datum (MarkTypes type, uint mark, uint offset, const QString &videoPath)
 
static void insert_markup_datum (MarkTypes type, uint mark, uint data, uint chanid, const QDateTime &recstartts)
 
static uint load_markup_datum (MarkTypes type, uint chanid, const QDateTime &recstartts)
 
static uint load_markup_datum (MarkTypes type, const QString &videoPath)
 
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 ignoreLiveTV, bool ignoreDeleted)
 
bool GetNextRecordingList (QDateTime &nextRecordingStart, bool *hasConflicts, std::vector< ProgramInfo > *list)
 

Variables

int force_init = pginfo_init_statics()
 
static constexpr uint kInvalidDateTime { UINT_MAX }
 
static constexpr int64_t kLastUpdateOffset { 61LL * 60 }
 
static const std::array< const QString, ProgramInfo::kNumCatTypeskCatName { "", "movie", "series", "sports", "tvshow" }
 
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 33 of file programinfo.cpp.

◆ DEFINE_FLAGS_NAMES

#define DEFINE_FLAGS_NAMES

Definition at line 48 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 1335 of file programinfo.cpp.

Function Documentation

◆ init_tr()

static int init_tr ( void  )
static

Definition at line 5387 of file programinfo.cpp.

Referenced by ProgramInfo::i18n().

◆ pginfo_init_statics()

int pginfo_init_statics ( )

Definition at line 39 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 89 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 1026 of file programinfo.cpp.

Referenced by ProgramInfo::operator==().

◆ DateTimeToListInt()

static QString DateTimeToListInt ( const QDateTime &  x)
inlinestatic

Definition at line 1258 of file programinfo.cpp.

Referenced by ProgramInfo::ToStringList().

◆ DateTimeFromListItem()

static QDateTime DateTimeFromListItem ( const QString &  str)
inlinestatic

Definition at line 1343 of file programinfo.cpp.

Referenced by ProgramInfo::FromStringList().

◆ DateFromListItem()

static QDate DateFromListItem ( const QString &  str)
inlinestatic

Definition at line 1350 of file programinfo.cpp.

Referenced by ProgramInfo::FromStringList().

◆ propsValueToString()

template<typename T >
QString propsValueToString ( const QString &  name,
QMap< T, QString >  propNames,
props 
)

◆ propsValueFromString()

template<typename T >
uint propsValueFromString ( const QString &  name,
const QMap< T, QString > &  propNames,
const QString &  props 
)

◆ discover_program_info_type()

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

◆ delete_markup_datum() [1/2]

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

◆ delete_markup_datum() [2/2]

static void delete_markup_datum ( MarkTypes  type,
const QString &  videoPath 
)
static

Definition at line 4346 of file programinfo.cpp.

◆ insert_markup_datum() [1/2]

static void insert_markup_datum ( MarkTypes  type,
uint  mark,
uint  offset,
const QString &  videoPath 
)
static

◆ insert_markup_datum() [2/2]

static void insert_markup_datum ( MarkTypes  type,
uint  mark,
uint  data,
uint  chanid,
const QDateTime &  recstartts 
)
static

Definition at line 4379 of file programinfo.cpp.

◆ load_markup_datum() [1/2]

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

◆ load_markup_datum() [2/2]

static uint load_markup_datum ( MarkTypes  type,
const QString &  videoPath 
)
static

Definition at line 4504 of file programinfo.cpp.

◆ FromProgramQuery()

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

Definition at line 5643 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 5760 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 5809 of file programinfo.cpp.

◆ LoadProgramFromProgram()

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

◆ 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 5933 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,
bool  ignoreLiveTV,
bool  ignoreDeleted 
)

◆ GetNextRecordingList()

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

Definition at line 6344 of file programinfo.cpp.

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

Variable Documentation

◆ force_init

int force_init = pginfo_init_statics()

Definition at line 42 of file programinfo.cpp.

◆ kInvalidDateTime

constexpr uint kInvalidDateTime { UINT_MAX }
staticconstexpr

Definition at line 45 of file programinfo.cpp.

Referenced by DateTimeFromListItem(), and DateTimeToListInt().

◆ kLastUpdateOffset

constexpr int64_t kLastUpdateOffset { 61LL * 60 }
staticconstexpr

◆ kCatName

const std::array<const QString,ProgramInfo::kNumCatTypes> kCatName { "", "movie", "series", "sports", "tvshow" }
static

Definition at line 126 of file programinfo.cpp.

Referenced by myth_category_type_to_string(), and string_to_myth_category_type().

◆ 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 4073 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 4079 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 4085 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 4092 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 4099 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 4105 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 4111 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 4118 of file programinfo.cpp.

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