MythTV  0.26-pre
mythutil.cpp
Go to the documentation of this file.
00001 // Qt includes
00002 #include <QDateTime>
00003 #include <QString>
00004 
00005 // libmyth* includes
00006 #include "mythlogging.h"
00007 
00008 // Local includes
00009 #include "mythutil.h"
00010 
00011 bool GetProgramInfo(const MythUtilCommandLineParser &cmdline,
00012                     ProgramInfo &pginfo)
00013 {
00014     if (!cmdline.toBool("chanid"))
00015     {
00016         LOG(VB_GENERAL, LOG_ERR, "No chanid specified");
00017         return false;
00018     }
00019 
00020     if (!cmdline.toBool("starttime"))
00021     {
00022         LOG(VB_GENERAL, LOG_ERR, "No start time specified");
00023         return false;
00024     }
00025 
00026     uint chanid = cmdline.toUInt("chanid");
00027     QDateTime starttime = cmdline.toDateTime("starttime");
00028     QString startstring = starttime.toString("yyyyMMddhhmmss");
00029 
00030     const ProgramInfo tmpInfo(chanid, starttime);
00031 
00032     if (!tmpInfo.GetChanID())
00033     {
00034         LOG(VB_GENERAL, LOG_ERR,
00035             QString("No program data exists for channel %1 at %2")
00036                 .arg(chanid).arg(startstring));
00037         return false;
00038     }
00039 
00040     pginfo = tmpInfo;
00041 
00042     return true;
00043 }
00044 
00045 /* vim: set expandtab tabstop=4 shiftwidth=4: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends