MythTV  master
mythutil.cpp
Go to the documentation of this file.
1 // Qt includes
2 #include <QDateTime>
3 #include <QString>
4 
5 // libmyth* includes
6 #include "mythlogging.h"
7 
8 // Local includes
9 #include "mythutil.h"
10 
12  ProgramInfo &pginfo)
13 {
14  if (cmdline.toBool("video"))
15  {
16  QString video = cmdline.toString("video");
17  pginfo = ProgramInfo(video);
18  return true;
19  }
20  if (!cmdline.toBool("chanid"))
21  {
22  LOG(VB_GENERAL, LOG_ERR, "No chanid specified");
23  return false;
24  }
25 
26  if (!cmdline.toBool("starttime"))
27  {
28  LOG(VB_GENERAL, LOG_ERR, "No start time specified");
29  return false;
30  }
31 
32  uint chanid = cmdline.toUInt("chanid");
33  QDateTime starttime = cmdline.toDateTime("starttime");
34  QString startstring = starttime.toString("yyyyMMddhhmmss");
35 
36  const ProgramInfo tmpInfo(chanid, starttime);
37 
38  if (!tmpInfo.GetChanID())
39  {
40  LOG(VB_GENERAL, LOG_ERR,
41  QString("No program data exists for channel %1 at %2")
42  .arg(chanid).arg(startstring));
43  return false;
44  }
45 
46  pginfo = tmpInfo;
47 
48  return true;
49 }
50 
51 /* vim: set expandtab tabstop=4 shiftwidth=4: */
arg
arg(title).arg(filename).arg(doDelete))
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythUtilCommandLineParser
Definition: mythutil/commandlineparser.h:8
GetProgramInfo
bool GetProgramInfo(const MythUtilCommandLineParser &cmdline, ProgramInfo &pginfo)
Definition: mythutil.cpp:11
video
QDomElement video
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:658
mythlogging.h
MythCommandLineParser::toUInt
uint toUInt(const QString &key) const
Returns stored QVariant as an unsigned integer, falling to default if not provided.
Definition: mythcommandlineparser.cpp:1994
mythutil.h
uint
unsigned int uint
Definition: compat.h:140
ProgramInfo::GetChanID
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
Definition: programinfo.h:367
cmdline
MythCommFlagCommandLineParser cmdline
Definition: mythtv/programs/mythcommflag/main.cpp:70
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
MythCommandLineParser::toString
QString toString(const QString &key) const
Returns stored QVariant as a QString, falling to default if not provided.
Definition: mythcommandlineparser.cpp:2094
MythCommandLineParser::toBool
bool toBool(const QString &key) const
Returns stored QVariant as a boolean.
Definition: mythcommandlineparser.cpp:1949
MythCommandLineParser::toDateTime
QDateTime toDateTime(const QString &key) const
Returns stored QVariant as a QDateTime, falling to default if not provided.
Definition: mythcommandlineparser.cpp:2186