static int SetMarkupList(const MythUtilCommandLineParser &cmdline, const QString &type, QString newList) { ProgramInfo pginfo; if (!GetProgramInfo(cmdline, pginfo)) return GENERIC_EXIT_NO_RECORDING_DATA; bool isCutlist = (type == "cutlist"); frm_dir_map_t markuplist; newList.replace(QRegExp(" "), ""); QStringList tokens = newList.split(",", QString::SkipEmptyParts); if (newList.isEmpty()) newList = "(EMPTY)"; for (int i = 0; i < tokens.size(); i++) { QStringList cutpair = tokens[i].split("-", QString::SkipEmptyParts); if (isCutlist) { markuplist[cutpair[0].toInt()] = MARK_CUT_START; markuplist[cutpair[1].toInt()] = MARK_CUT_END; } else { markuplist[cutpair[0].toInt()] = MARK_COMM_START; markuplist[cutpair[1].toInt()] = MARK_COMM_END; } } if (isCutlist) { pginfo.SaveCutList(markuplist); cout << QString("Cutlist set to: %1\n") .arg(newList).toLocal8Bit().constData(); LOG(VB_GENERAL, LOG_NOTICE, QString("Cutlist set to: %1").arg(newList)); } else { pginfo.SaveCommBreakList(markuplist); cout << QString("Commercial Skip List set to: %1\n") .arg(newList).toLocal8Bit().constData(); LOG(VB_GENERAL, LOG_NOTICE, QString("Commercial Skip List set to: %1").arg(newList)); } return GENERIC_EXIT_OK; }
static int CopySkipListToCutList(const MythUtilCommandLineParser &cmdline) { ProgramInfo pginfo; if (!GetProgramInfo(cmdline, pginfo)) return GENERIC_EXIT_NO_RECORDING_DATA; frm_dir_map_t cutlist; frm_dir_map_t::const_iterator it; pginfo.QueryCommBreakList(cutlist); for (it = cutlist.begin(); it != cutlist.end(); ++it) if (*it == MARK_COMM_START) cutlist[it.key()] = MARK_CUT_START; else cutlist[it.key()] = MARK_CUT_END; pginfo.SaveCutList(cutlist); cout << QString("Cutlist copied to Commercial Skip List\n") .toLocal8Bit().constData(); return GENERIC_EXIT_OK; }