Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add --parse-video-filename option to test filename parser.

This adds a new option to MythUtil to hook directly into the filename
parsing routines used by the Video Library, to allow them to be tested
directly for irregularities rather than having to go through the
scanner.
  • Loading branch information...
commit 1debfc665fdda71e328f8c649f2c25a87912426a 1 parent e6222cf
@wagnerrp wagnerrp authored
View
20 mythtv/programs/mythutil/backendutils.cpp
@@ -1,9 +1,13 @@
+// C++ includes
+#include <iostream>
+
// libmyth* headers
#include "exitcodes.h"
#include "mythcorecontext.h"
#include "mythlogging.h"
#include "remoteutil.h"
#include "scheduledrecording.h"
+#include "videometadata.h"
// local headers
#include "backendutils.h"
@@ -76,6 +80,21 @@ static int ScanVideos(const MythUtilCommandLineParser &cmdline)
return GENERIC_EXIT_CONNECT_ERROR;
}
+static int ParseVideoFilename(const MythUtilCommandLineParser &cmdline)
+{
+ QString filename = cmdline.toString("parsevideo");
+ cout << "Title: " << VideoMetadata::FilenameToMeta(filename, 1)
+ .toLocal8Bit().constData() << endl
+ << "Season: " << VideoMetadata::FilenameToMeta(filename, 2)
+ .toLocal8Bit().constData() << endl
+ << "Episode: " << VideoMetadata::FilenameToMeta(filename, 3)
+ .toLocal8Bit().constData() << endl
+ << "Subtitle: " << VideoMetadata::FilenameToMeta(filename, 4)
+ .toLocal8Bit().constData() << endl;
+
+ return GENERIC_EXIT_OK;
+}
+
void registerBackendUtils(UtilMap &utilMap)
{
utilMap["clearcache"] = &ClearSettingsCache;
@@ -83,6 +102,7 @@ void registerBackendUtils(UtilMap &utilMap)
utilMap["resched"] = &Reschedule;
utilMap["scanvideos"] = &ScanVideos;
utilMap["systemevent"] = &SendSystemEvent;
+ utilMap["parsevideo"] = &ParseVideoFilename;
}
/* vim: set expandtab tabstop=4 shiftwidth=4: */
View
4 mythtv/programs/mythutil/commandlineparser.cpp
@@ -97,6 +97,10 @@ void MythUtilCommandLineParser::LoadArguments(void)
"local database settings cache used by each program, causing "
"options to be re-read from the database upon next use.")
->SetGroup("Backend")
+ << add("--parse-video-filename", "parsevideo", "", "",
+ "Diagnostic tool for testing filename formats against what "
+ "the Video Library name parser will detect them as.")
+ ->SetGroup("Backend")
// jobutils.cpp
<< add("--queuejob", "queuejob", "",
View
2  mythtv/programs/mythutil/mythutil.pro
@@ -2,7 +2,7 @@ include ( ../../settings.pro )
include ( ../../version.pro )
include ( ../programs-libs.pro )
-QT += network sql
+QT += network sql xml
TEMPLATE = app
CONFIG += thread
Please sign in to comment.
Something went wrong with that request. Please try again.