Permalink
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...
1 parent e6222cf commit 1debfc665fdda71e328f8c649f2c25a87912426a @wagnerrp wagnerrp committed May 3, 2012
@@ -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,13 +80,29 @@ 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;
utilMap["event"] = &SendEvent;
utilMap["resched"] = &Reschedule;
utilMap["scanvideos"] = &ScanVideos;
utilMap["systemevent"] = &SendSystemEvent;
+ utilMap["parsevideo"] = &ParseVideoFilename;
}
/* vim: set expandtab tabstop=4 shiftwidth=4: */
@@ -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", "",
@@ -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

0 comments on commit 1debfc6

Please sign in to comment.