Пример #1
0
mainbase::mainbase() :
m_INeedRoot(false),
m_DropRoot(false),
m_Foreground(false),
m_Name(NAME),
m_LogFileLocation("log/"),
m_PidFileLocation("/var/run/" + m_Name + "/"),
m_IniFile("conf/" + m_Name + ".ini"),
m_PidFile(m_PidFileLocation + m_Name + ".pid"),
m_LogFile(m_LogFileLocation + m_Name + ".log")
{
    SetupSignal();
    addVersion(gNAME + " " + gVERSION);
    addHelpItem("Runs the " + m_Name + " (default as " + m_Name + ", " + m_PidFile + ", " + m_LogFile + " " + m_IniFile + ")");
    addHelpItem("USAGE " + m_Name + " [OPTIONS]");
    addHelpItem("Available options:");
    addHelpItem("\t-h, --help List options");
    addHelpItem("\t-v, --version Output version and exit");
    addHelpItem("\t-f, --foreground Don't fork into the background");
    addHelpItem("\t-dr, --droproot [username] [group] run as");
    addHelpItem("\t-c, --config Set config file (default: " + m_IniFile + ")");
    addHelpItem("\t-d, --debug Set debug level [1-10] (default: 5)");
    addHelpItem("\t-p, --pid Set Pid file location (default: " + m_PidFileLocation + ")");
    addHelpItem("\t-l, --log Set log file location (default: " + m_LogFileLocation + ")");
    addHelpItem("\t-n, --name Set name for pid/log files (default: " + m_Name + ")");
    addHelpItem("\t--INeedRootPowerz Requered when running as root (not needed when droproot is specified)");
}
Пример #2
0
void MythLogServerCommandLineParser::LoadArguments(void)
{
    addHelp();
    addVersion();
    addDaemon();
    addLogging();
}
Пример #3
0
void MythJobQueueCommandLineParser::LoadArguments(void)
{
    addHelp();
    addSettingsOverride();
    addVersion();
    addLogging();
    addPIDFile();
    addDaemon();
}
Пример #4
0
void MythScreenWizardCommandLineParser::LoadArguments(void)
{
    addHelp();
    addSettingsOverride();
    addVersion();
    addLogging();
    addMouse();
    addDisplay();
}
Пример #5
0
void MythCCExtractorCommandLineParser::LoadArguments(void)
{
    addHelp();
    addSettingsOverride();
    addVersion();
    addLogging("none", LOG_ERR);
    add(QStringList( QStringList() << "-i" << "--infile" ), "inputfile", "",
            "input file", "");
}
Пример #6
0
void layerOn(boolean strict, char *database, char *dir, struct hash *uniqHash,
             struct hash *htmlHash,  boolean mustExist, struct hgFindSpec **hfsList)
/* Read search specs from trackDb.ra from directory,
 * and layer them on top of whatever is in hfsList. */
{
    char raFile[512];
    if (raName[0] != '/')
        safef(raFile, sizeof(raFile), "%s/%s", dir, raName);
    else
        safef(raFile, sizeof(raFile), "%s", raName);
    if (fileExists(raFile))
    {
        addVersion(strict, database, dir, raFile, uniqHash, htmlHash, hfsList);
    }
    else
    {
        if (mustExist)
            errAbort("%s doesn't exist!", raFile);
    }
}
Пример #7
0
void MythFrontendCommandLineParser::LoadArguments(void)
{
    addHelp();
    addVersion();
    addWindowed();
    addMouse();
    addSettingsOverride();
    addGeometry();
    addDisplay();
    addUPnP();
    addLogging();

    add(QStringList( QStringList() << "-r" << "--reset" ), "reset", false,
        "Resets appearance settings and language.", "");
    add(QStringList( QStringList() << "-p" << "--prompt" ), "prompt", false,
        "Always prompt for backend selection.", "");
    add(QStringList( QStringList() << "-d" << "--disable-autodiscovery" ),
        "noautodiscovery", false,
        "Prevent frontend from using UPnP autodiscovery.", "");

    add("--jumppoint", "jumppoint", "",
        "Start the frontend at specified jump point.", "")
            ->SetGroup("Startup Behavior");
    add("--runplugin", "runplugin", "",
        "Start the frontend within specified plugin.", "")
            ->SetGroup("Startup Behavior")
            ->SetBlocks("jumppoint");

    add(QStringList( QStringList() << "-G" << "--get-setting" ),
        "getsetting", "", "", "")
            ->SetRemoved("Use the Services API instead.", "0.25");
    add(QStringList( QStringList() << "-u" << "--upgrade-schema" ),
        "upgradeschema", "", "", "")
            ->SetRemoved("The frontend is no longer allowed to update\n"
               "          the primary database schema. Use mythtv-setup\n"
               "          or restart your primary backend to have it\n"
               "          perform the task automatically.", "0.25");
}
Пример #8
0
void MythTranscodeCommandLineParser::LoadArguments(void)
{
    addHelp();
    addVersion();
    addJob();
    addRecording();
    addSettingsOverride();
    addLogging();

    add(QStringList( QStringList() << "-p" << "--profile" ), "profile", "",
            "Transcoding profile.", "")
        ->SetGroup("Encoding");
    add(QStringList( QStringList() << "--allkeys" << "-k" ), "allkeys", false,
            "Specifies the outputfile should be entirely keyframes.", "")
        ->SetGroup("Encoding");
    add("--passthrough", "passthru", false, 
            "Pass through raw, unprocessed audio.", "")
        ->SetGroup("Encoding");
    add(QStringList( QStringList() << "-ro" << "--recorderOptions" ), "recopt",
            "", "Comma separated list of recordingprofile overrides.", "")
        ->SetGroup("Encoding");
    add("--audiotrack", "audiotrack", 0, "Select specific audio track.", "")
        ->SetGroup("Encoding");
    add("--allaudiotracks", "allaudio", 0,
        "Keep all audio tracks including those marked with 0 channels.", "")
        ->SetGroup("Encoding");
    add(QStringList( QStringList() << "-m" << "--mpeg2" ), "mpeg2", false,
            "Specifies that a lossless transcode should be used.", "")
        ->SetGroup("Encoding");
    add(QStringList( QStringList() << "-e" << "--ostream" ), "ostream", "",
            "Output stream type: dvd, ts", "")
        ->SetGroup("Encoding");
    add("--avf", "avf", false, "Generate libavformat output file.", "")
        ->SetGroup("Encoding");
    add("--hls", "hls", false, "Generate HTTP Live Stream output.", "")
        ->SetGroup("Encoding");

    add(QStringList( QStringList() << "-f" << "--fifodir" ), "fifodir", "",
            "Directory in which to write fifos to.", "")
        ->SetGroup("Frame Server");
    add("--fifoinfo", "fifoinfo", false,
            "Run in fifodir mode, but stop after displaying the "
            "fifo data format.", "")
        ->SetGroup("Frame Server");
    add("--fifosync", "fifosync", false, "Enforce fifo sync.", "")
        ->SetGroup("Frame Server");
    add("--cleancut", "cleancut", false,
            "Improve quality of cutting by performing it partially by dropping data. "
            "Works only in fifodir mode.", "")
        ->SetGroup("Frame Server")
        ->SetRequires("fifodir");

    add(QStringList( QStringList() << "-l" << "--honorcutlist" ), "usecutlist",
            "", "Specifies whether to use the cutlist. "
            "(Takes an optional cutlist as argument when used with -i)",
            "Specifies whether transcode should honor the cutlist and "
            "remove the marked off commercials. Optionally takes a "
            "a cutlist as an argument when used with --infile.")
        ->SetGroup("Cutlist");
    add("--inversecut", "inversecut", false,
            "Inverses the cutlist, leaving only the marked off sections.", "")
        ->SetGroup("Cutlist")
        ->SetRequires("usecutlist");

    add("--showprogress", "showprogress", false,
            "Display status info in stdout", "")
        ->SetGroup("Logging");

    add(QStringList( QStringList() << "-i" << "--infile" ), "inputfile", "",
            "Input video for transcoding.", "");
    add(QStringList( QStringList() << "-o" << "--outfile" ), "outputfile", "",
            "Optional output file for transcoding.", "");
    add(QStringList( QStringList() << "-b" << "--buildindex" ), "reindex", false,
            "Build new keyframe index.", "");
    add("--video", "video", false,
            "Specifies video is not a recording.", "")
        ->SetRequires("inputfile");
    add("--queue", "queue", "",
            "Add a new transcoding job of the specified recording and "
            "profile to the jobqueue. Accepts an optional string to define "
            "the hostname.", "");

//    add("--container", "container", "", "Output file container format", "")
//        ->SetChildOf("avf");
//    add("--acodec", "acodec", "", "Output file audio codec", "")
//        ->SetChildOf("avf");
//    add("--vcodec", "vcodec", "", "Output file video codec", "")
//        ->SetChildOf("avf");
    add("--width", "width", 0, "Output Video Width", "")
        ->SetChildOf("avf")
        ->SetChildOf("hls");
    add("--height", "height", 0, "Output Video Height", "")
        ->SetChildOf("avf")
        ->SetChildOf("hls");
    add("--bitrate", "bitrate", 800, "Output Video Bitrate (Kbits)", "")
        ->SetChildOf("avf")
        ->SetChildOf("hls");
    add("--audiobitrate", "audiobitrate", 64, "Output Audio Bitrate (Kbits)", "")
        ->SetChildOf("avf")
        ->SetChildOf("hls");
    add("--maxsegments", "maxsegments", 0, "Max HTTP Live Stream segments", "")
        ->SetChildOf("hls");
    add("--noaudioonly", "noaudioonly", 0, "Disable Audio-Only HLS Stream", "")
        ->SetChildOf("hls");
    add("--hlsstreamid", "hlsstreamid", -1, "Stream ID to process", "")
        ->SetChildOf("hls");
}
Пример #9
0
void MythFillDatabaseCommandLineParser::LoadArguments(void)
{
    addHelp();
    addVersion();
    addLogging();
    allowPassthrough();

    add("--manual", "manual", false, "Run interactive configuration",
            "Manual mode will interactively ask you questions about "
            "each channel as it is processed, to configure for "
            "future use.");

    add("--preset", "preset", false,
            "Use channel preset values instead of numbers",
            "For use with assigning preset numbers for each "
            "channel. Useful for non-US countries where people "
            "are used to assigning a sequenced number for each "
            "channel:\n1->TVE1(S41), 2->La 2(SE18), 3->TV(21)...");
    add("--file", "file", false,
            "Bypass grabbers and define sourceid and file",
            "Directly define the sourceid and XMLTV file to "
            "import.")
        ->SetRequires("sourceid");

    add("--sourceid", "sourceid", 0, "Operate on single source",
            "Limit mythfilldatabase to only operate on the "
            "specified channel source.");

    add("--offset", "offset", 0, "Day offset of input xml file",
            "Specify how many days offset from today is the "
            "information in the given XML file.");

    add("--xmlfile", "xmlfile", "", "XML file to import manually",
            "Specify an XML guide data file to import directly "
            "rather than pull data through the specified grabber.")
        ->SetRequiredChildOf("file");


    add("--update", "update", false, "Run non-destructive updates",
            "Run non-destructive updates on the database for "
            "users in xmltv zones that do not provide channel "
            "data. Stops the addition of new channels and the "
            "changing of channel icons.")
        ->SetBlocks("manual")
        ->SetDeprecated("Use --only-update-guide instead.")
        ->SetGroup("Guide Data Handling");
    add("--only-update-guide", "onlyguide", false, "Only update guide data",
            "Only update the guide data, do not alter channels or icons.")
        ->SetBlocks("manual")
        ->SetGroup("Guide Data Handling");


    add("--do-channel-updates", "dochannelupdates", false,
            "update channels",
            "Ask mythfilldatabase to "
            "overwrite channel names, frequencies, etc. with "
            "values available from the data source. This will "
            "override custom channel names, which is why it "
            "is disabled by default.")
        ->SetGroup("Channel List Handling");
    add("--do-not-filter-new-channels", "nofilterchannels", false,
            "don't filter ATSC channels for addition",
            "Normally, MythTV tries to avoid adding ATSC "
            "channels to NTSC channel lineups. This option "
            "restores the behavior of adding every channel in "
            "the downloaded channel lineup to MythTV's lineup, "
            "in case MythTV's smarts fail you.")
        ->SetGroup("Channel List Handling");
    // need documentation for this one
    add("--cardtype", "cardtype", "", "", "No information.");

    add("--refresh", "refresh", QVariant::StringList,
            "Provide a day or range of days to refresh. Can be "
            "used repeatedly.",
            "Provide days to refresh during the grabber run.  Multiple \n"
            "days or ranges can be supplied by multiple instances of the \n"
            "option. Supported days are:\n"
            "    [not]today\n"
            "    [not]tomorrow\n"
            "    [not]second\n"
            "    #[-#]\n"
            "    all\n"
            "Note that if all is specified any others will be ingored.\n\n"
            "example:\n"
            "   --refresh today --refresh 4-8 --refresh nottomorrow")
        ->SetGroup("Filtering");

    add("--max-days", "maxdays", 0, "force number of days to update",
            "Force the maximum number of days, counting today, "
            "for the guide data grabber to check for future "
            "listings.")
        ->SetGroup("Filtering");
    add("--refresh-today", "refreshtoday", false, "",
            "This option is only valid for selected grabbers.\n"
            "Force a refresh for today's guide data.\nThis can be used "
            "in combination with other --refresh-<n> options.")
        ->SetDeprecated("use --refresh instead")
        ->SetGroup("Filtering");
    add("--dont-refresh-tomorrow", "dontrefreshtomorrow", false, "",
            "This option is only valid for selected grabbers.\n"
            "Prevent mythfilldatabase from pulling information for "
            "tomorrow's listings. Data for tomorrow is always pulled "
            "unless specifically specified otherwise.")
        ->SetDeprecated("use --refresh instead")
        ->SetGroup("Filtering");
    add("--refresh-second", "refreshsecond", false, "",
            "This option is only valid for selected grabbers.\n"
            "Force a refresh for guide data two days from now. This can "
            "be used in combination with other --refresh-<n> options.")
        ->SetDeprecated("use --refresh instead")
        ->SetGroup("Filtering");
    add("--refresh-day", "refreshday", QVariant::StringList, "",
            "This option is only valid for selected grabbers.\n"
            "Force a refresh for guide data on a specific day. This can "
            "be used in combination with other --refresh-<n> options.")
        ->SetDeprecated("use --refresh instead")
        ->SetGroup("Filtering");
    add("--dont-refresh-tba", "dontrefreshtba", false,
            "don't refresh \"To be announced\" programs",
            "This option is only valid for selected grabbers.\n"
            "Prevent mythfilldatabase from automatically refreshing any "
            "programs marked as \"To be announced\".")
        ->SetGroup("Filtering");

    add("--refresh-all", "refreshall", false, "",
            "This option is only valid for selected grabbers.\n"
            "This option forces a refresh of all guide data, but does so "
            "with fourteen downloads of one day each.")
        ->SetDeprecated("use --refresh instead")
        ->SetBlocks("dontrefreshtomorrow")
        ->SetBlocks("refreshsecond")
        ->SetBlocks("refreshday")
        ->SetBlocks("maxdays")
        ->SetGroup("Filtering");

    add("--no-allatonce", "noallatonce", false,
            "Do not use allatonce even if the grabber prefers it.",
            "This option prevents mythfilldatabase from utlizing "
            "the advertised grabber preference of 'allatonce'. "
            "This may be necessary for grabbers that return a large "
            "amount of data")
        ->SetGroup("Filtering");

    add("--only-update-channels", "onlychannels", false,
            "only update channel lineup",
            "Download as little listings data as possible to update the "
            "channel lineup.")
        ->SetGroup("Channel List Handling");
    add("--no-mark-repeats", "markrepeats", true, "do not mark repeats", "");

    add("--graboptions", "graboptions", "", "", "")
        ->SetRemoved("mythfilldatabase now passes any text after an\n"
           "          independent '--' directly to the external grabber.\n"
           "          e.g. mythfilldatabase -- --daily", "0.25");
    add("--mark-repeats", "oldmarkrepeats", "", "", "")
        ->SetRemoved("This is now the default behavior. Use\n"
           "          --no-mark-repeats to disable.", "0.25");
}
Пример #10
0
void MythUtilCommandLineParser::LoadArguments(void)
{
    CommandLineArg::AllowOneOf( QList<CommandLineArg*>()
        // fileutils.cpp
        << add("--copyfile", "copyfile", false,
                "Copy a MythTV Storage Group file", "")
                ->SetGroup("File")
                ->SetRequiredChild(QStringList("infile") << "outfile")

        // mpegutils.cpp
        << add("--pidcounter", "pidcounter", false,
                "Count pids in a MythTV Storage Group file", "")
                ->SetGroup("MPEG-TS")
                ->SetRequiredChild("infile")
        << add("--pidfilter", "pidfilter", false,
                "Filter pids in a MythTV Storage Group file", "")
                ->SetGroup("MPEG-TS")
                ->SetRequiredChild(QStringList("infile") << "outfile")
        << add("--pidprinter", "pidprinter", false,
                "Print PSIP pids in a MythTV Storage Group file", "")
                ->SetGroup("MPEG-TS")
                ->SetRequiredChild("infile")
                ->SetChild("outfile")

        // markuputils.cpp
        << add("--gencutlist", "gencutlist", false,
                "Copy the commercial skip list to the cutlist.", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")
        << add("--getcutlist", "getcutlist", false,
                "Display the current cutlist.", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")
        << add("--setcutlist", "setcutlist", "",
                "Set a new cutlist in the form:\n"
                "#-#[,#-#]... (ie, 1-100,1520-3012,4091-5094)", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")
        << add("--clearcutlist", "clearcutlist", false,
                "Clear the cutlist.", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")
        << add("--getskiplist", "getskiplist", false,
                "Display the current commercial skip list.", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")
        << add("--setskiplist", "setskiplist", "",
                "Set a new commercial skip list in the form:\n"
                "#-#[,#-#]... (ie, 1-100,1520-3012,4091-5094)", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")
        << add("--clearskiplist", "clearskiplist", false,
                "Clear the commercial skip list.", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")

        // backendutils.cpp
        << add("--resched", "resched", false,
                "Trigger a run of the recording scheduler on the existing "
                "master backend.",
                "This command will connect to the master backend and trigger "
                "a run of the recording scheduler. The call will return "
                "immediately, however the scheduler run may take several "
                "seconds to a minute or longer to complete.")
                ->SetGroup("Backend")
        << add("--scanvideos", "scanvideos", false,
                "Trigger a rescan of media content in MythVideo.",
                "This command will connect to the master backend and trigger "
                "a run of the Video scanner. The call will return "
                "immediately, however the scanner may take several seconds "
                "to tens of minutes, depending on how much new or moved "
                "content it has to hash, and how quickly the scanner can "
                "access those files to do so. If enabled, this will also "
                "trigger the bulk metadata scanner upon completion.")
                ->SetGroup("Backend")
        << add("--event", "event", "", "Send a backend event test message.", "")
                ->SetGroup("Backend")
        << add("--systemevent", "systemevent", "",
                "Send a backend SYSTEM_EVENT test message.", "")
                ->SetGroup("Backend")
        << add("--clearcache", "clearcache", false,
                "Trigger a cache clear on all connected MythTV systems.",
                "This command will connect to the master backend and trigger "
                "a cache clear event, which will subsequently be pushed to "
                "all other connected programs. This event will clear the "
                "local database settings cache used by each program, causing "
                "options to be re-read from the database upon next use.")
                ->SetGroup("Backend")

        // jobutils.cpp
        << add("--queuejob", "queuejob", "",
                "Insert a new job into the JobQueue.",
                "Schedule the specified job type (transcode, commflag, "
                "metadata, userjob1, userjob2, userjob3, userjob4) to run "
                "for the recording with the given chanid and starttime.")
                ->SetGroup("JobQueue")
                ->SetRequires("chanid")
                ->SetRequires("starttime")

        // messageutils.cpp
        << add("--message", "message", false,
                "Display a message on a frontend", "")
                ->SetGroup("Messaging")
        << add("--print-template", "printtemplate", false,
                "Print the template to be sent to the frontend", "")
                ->SetGroup("Messaging")
        );

    // mpegutils.cpp
    add("--pids", "pids", "", "Pids to process", "")
        ->SetRequiredChildOf("pidfilter")
        ->SetRequiredChildOf("pidprinter");
    add("--ptspids", "ptspids", "", "Pids to extract PTS from", "")
        ->SetGroup("MPEG-TS");
    add("--packetsize", "packetsize", 188, "TS Packet Size", "")
        ->SetChildOf("pidcounter")
        ->SetChildOf("pidfilter");
    add("--noautopts", "noautopts", false, "Disables PTS discovery", "")
        ->SetChildOf("pidprinter");
    add("--xml", "xml", false, "Enables XML output of PSIP", "")
        ->SetChildOf("pidprinter");

    // messageutils.cpp
    add("--udpport", "udpport", 6948, "(optional) UDP Port to send to", "")
        ->SetChildOf("message");
    add("--bcastaddr", "bcastaddr", "127.0.0.1", "(optional) IP address to send to", "")
        ->SetChildOf("message");

    // Generic Options used by more than one utility
    addRecording();
    addInFile(true);
    addSettingsOverride();
    addHelp();
    addVersion();
    addLogging();
    allowExtras();
}
Пример #11
0
void MythShutdownCommandLineParser::LoadArguments(void)
{
    add("-l", "oldlock", false, "disable shutdown", "")
        ->SetRemoved("Please use the full argument '--lock' instead.");

    addHelp();
    addVersion();
    addLogging("none", LOG_ERR);

    CommandLineArg::AllowOneOf( QList<CommandLineArg*>()
         << add(QStringList( QStringList() << "-w" << "--setwakeup" ),
                "setwakeup", "",
                "Set the wakeup time (yyyy-MM-ddThh:mm:ss) "
                "default is in local time", "")
         << add(QStringList( QStringList() << "-t" << "--setscheduledwakeup" ),
                "setschedwakeup", false,
                "Set wakeup time to the next scheduled recording", "")
         << add(QStringList( QStringList() << "-q" << "--shutdown" ),
                "shutdown", false,
                "Apply wakeup time to nvram and shutdown.", "")
         << add(QStringList( QStringList() << "-x" << "--safeshutdown" ),
                "safeshutdown", false,
                "Check if shutdown is possible, and shutdown", "")
         << add(QStringList( QStringList() << "-p" << "--startup" ),
                "startup", false,
                "Check startup status",
                "Check startup status\n"
                "   returns 0 - automatic startup\n"
                "           1 - manual startup")
         << add(QStringList( QStringList() << "-c" << "--check" ),
                "check", 1,
                "Check whether shutdown is possible",
                "Check whether shutdown is possible depending on input\n"
                "   input 0 - dont check recording status\n"
                "         1 - do check recording status\n\n"
                " returns 0 - ok to shut down\n"
                "         1 - not ok, idle check reset")
         << add("--lock" , "lock", false, "disable shutdown", "")
         << add(QStringList( QStringList() << "-u" << "--unlock" ),
                "unlock", false,
                "enable shutdown", "")
         << add(QStringList( QStringList() << "-s" << "--status" ),
                "status", 1,
                "check current status",
                "check current status depending on input\n"
                "   input 0 - dont check recording status\n"
                "         1 - do check recording status\n\n"
                " returns 0 - Idle\n"
                "         1 - Transcoding\n"
                "         2 - Commercial Detection\n"
                "         4 - Grabbing EPG data\n"
                "         8 - Recording (only valid if input=1)\n"
                "        16 - Locked\n"
                "        32 - Jobs running or pending\n"
                "        64 - In daily wakeup/shutdown period\n"
                "       128 - Less than 15 minutes to next wakeup period\n"
                "       255 - Setup is running") );

    // The localtime command line parameter exists solely to make scripts
    // using this executable self documenting.

    CommandLineArg::AllowOneOf( QList<CommandLineArg*>()
         << add("--utc",
                "utc", false,
                "Specify that the wakeup time is in utc", "")
         << add("--localtime",
                "localtime", false,
                "Specify that the wakeup time is in local time", "") );
}