From 3ee23daf685e3649d56978aa977f933fbfab830d Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sun, 26 Jul 2009 16:22:06 -0700
Subject: MythVideo:0.21-fixes patched to use tmdb instead of imdb.

---
 abs/core-testing/mythtv/stable/mythvideo/PKGBUILD  |   9 +-
 .../mythvideo-6338-use_tmdb_in_fixes.patch         | 151 +++++++++++++++++++++
 2 files changed, 157 insertions(+), 3 deletions(-)
 create mode 100644 abs/core-testing/mythtv/stable/mythvideo/mythvideo-6338-use_tmdb_in_fixes.patch

diff --git a/abs/core-testing/mythtv/stable/mythvideo/PKGBUILD b/abs/core-testing/mythtv/stable/mythvideo/PKGBUILD
index f9895c6..a233549 100644
--- a/abs/core-testing/mythtv/stable/mythvideo/PKGBUILD
+++ b/abs/core-testing/mythtv/stable/mythvideo/PKGBUILD
@@ -4,15 +4,16 @@
 
 pkgname=mythvideo
 pkgver=0.21
-pkgrel=8
+pkgrel=9
 pkgdesc="Video playback and browsing plugin for MythTV"
 arch=('i686' 'x86_64')
 url="http://www.mythtv.org"
 license=('GPL')
 depends=("mythtv>=${pkgver}" 'mplayer' 'perlxml' 'perl-libwww' 'perl-uri' 'perl-xml-simple' 'ffmpeg')
 source=("ftp://ftp.knoppmyth.net/R6/sources/mythplugins-$pkgver-fixes.tar.bz2"\
-	mtd)
-md5sums=('1b3e2a97b7ecf7373e162fe20b6faabe' '476c12ba074794ad7f4ae092bdf949d6')
+	"ftp://ftp.knoppmyth.net/R6/sources/tmdb.tar.bz2" \
+	mtd mythvideo-6338-use_tmdb_in_fixes.patch)
+md5sums=('1b3e2a97b7ecf7373e162fe20b6faabe' '48cff8f7095586c85ec70989746736b4' '476c12ba074794ad7f4ae092bdf949d6' '4bd38d054dfc4b0b1724f398d38676f7')
 replaces=('mythdvd')
 groups=('mythtv-extras')
 install=mythvideo.install
@@ -20,6 +21,7 @@ install=mythvideo.install
 build() {
    cd $startdir/src/mythplugins
    svn update
+   patch -p1 < ../mythvideo-6338-use_tmdb_in_fixes.patch
    . /etc/profile.d/qt3.sh
    
    # use QT3 qmake
@@ -33,6 +35,7 @@ build() {
 
    make INSTALL_ROOT=$startdir/pkg install
    install -D -m755 ../mtd $startdir/pkg/etc/rc.d/mtd
+   cp -Rv $startdir/src/tmdb/* $startdir/pkg/usr/share/mythtv/mythvideo/scripts/
 }
 
 
diff --git a/abs/core-testing/mythtv/stable/mythvideo/mythvideo-6338-use_tmdb_in_fixes.patch b/abs/core-testing/mythtv/stable/mythvideo/mythvideo-6338-use_tmdb_in_fixes.patch
new file mode 100644
index 0000000..a5a182d
--- /dev/null
+++ b/abs/core-testing/mythtv/stable/mythvideo/mythvideo-6338-use_tmdb_in_fixes.patch
@@ -0,0 +1,151 @@
+Index: mythplugins/mythvideo/mythvideo/videomanager.cpp
+===================================================================
+--- mythplugins.orig/mythvideo/mythvideo/videomanager.cpp	2009-03-09 22:39:40.000000000 -0400
++++ mythplugins/mythvideo/mythvideo/videomanager.cpp	2009-03-09 23:04:55.000000000 -0400
+@@ -1535,6 +1535,56 @@
+             }
+         }
+ 
++        // Since there's no DB update to remove imdb.pl settings in -fixes,
++        // check for the old imdb.pl command and, if it's the old default,
++        // use tmdb.pl, instead (if available in the same location or the
++        // scripts dir)).  Checks to see if cmd ends with end (the end of the
++        // old default imdb.pl command line).  If so, it checks for tmdb, and
++        // if it exists in either the same location as specified in cmd or in
++        // the MythVideo scripts directory, replace end with "/tmdb.pl " + arg
++        QString UpdateCommandForTMDB(const QString cmd, const QString end,
++                                     const QString arg)
++        {
++            QString updated_cmd = cmd;
++            if (updated_cmd.endsWith(end))
++            {
++                QString script_path = updated_cmd;
++                script_path.truncate(updated_cmd.findRev(end,
++                                                         0 - end.length()));
++                QString tmdb_path(script_path + "/tmdb.pl");
++                if (QFile::exists(tmdb_path))
++                {
++                    VERBOSE(VB_GENERAL, QString("Overriding old default "
++                                                "grabber script command line. "
++                                                "Using tmdb.pl, instead."));
++                    updated_cmd = tmdb_path + " " + arg;
++                }
++                else
++                {
++                    // It's possible the user has a non-default imdb.pl
++                    // command-line--including path location--in the setting,
++                    // so check to see if we've already checked the mythvideo
++                    // scripts directory
++                    QString def_path = QDir::cleanDirPath(QString("%1/%2")
++                            .arg(gContext->GetShareDir())
++                            .arg("mythvideo/scripts"));
++                    if (script_path != def_path)
++                    {
++                        tmdb_path = def_path + "/tmdb.pl";
++                        if (QFile::exists(tmdb_path))
++                        {
++                            VERBOSE(VB_GENERAL, QString("Overriding old "
++                                    "default grabber script command line. "
++                                    "Using tmdb.pl, instead."));
++                            updated_cmd = tmdb_path + " " + arg;
++                        }
++                    }
++                }
++            }
++
++            return updated_cmd;
++        }
++
+         virtual void OnExecDone(bool normal_exit, const QStringList &out,
+                                 const QStringList &err) = 0;
+ 
+@@ -1624,9 +1674,16 @@
+ 
+             QString def_cmd = QDir::cleanDirPath(QString("%1/%2")
+                     .arg(gContext->GetShareDir())
+-                    .arg("mythvideo/scripts/imdb.pl -M tv=no;video=no"));
++                    .arg("mythvideo/scripts/tmdb.pl -M"));
+ 
+-            QString cmd = gContext->GetSetting("MovieListCommandLine", def_cmd);
++            // Since there's no DB update to remove imdb.pl settings in -fixes,
++            // check for the old imdb.pl command and, if it's the old default,
++            // use tmdb.pl, instead (if available in the same location or the
++            // scripts dir))
++            QString cmd = UpdateCommandForTMDB(
++                            gContext->GetSetting("MovieListCommandLine",
++                                                 def_cmd),
++                            "/imdb.pl -M tv=no;video=no", "-M");
+ 
+             QStringList args;
+             args += title;
+@@ -1682,9 +1739,15 @@
+ 
+             const QString def_cmd = QDir::cleanDirPath(QString("%1/%2")
+                     .arg(gContext->GetShareDir())
+-                    .arg("mythvideo/scripts/imdb.pl -D"));
+-            const QString cmd = gContext->GetSetting("MovieDataCommandLine",
+-                                                     def_cmd);
++                    .arg("mythvideo/scripts/tmdb.pl -D"));
++            // Since there's no DB update to remove imdb.pl settings in -fixes,
++            // check for the old imdb.pl command and, if it's the old default,
++            // use tmdb.pl, instead (if available in the same location or the
++            // scripts dir))
++            const QString cmd = UpdateCommandForTMDB(
++                                  gContext->GetSetting("MovieDataCommandLine",
++                                                       def_cmd),
++                                  "/imdb.pl -D", "-D");
+ 
+             StartRun(cmd, video_uid, "Video Data Query");
+         }
+@@ -1726,9 +1789,16 @@
+             const QString default_cmd =
+                     QDir::cleanDirPath(QString("%1/%2")
+                                        .arg(gContext->GetShareDir())
+-                                       .arg("mythvideo/scripts/imdb.pl -P"));
+-            const QString cmd = gContext->GetSetting("MoviePosterCommandLine",
+-                                                     default_cmd);
++                                       .arg("mythvideo/scripts/tmdb.pl -P"));
++            // Since there's no DB update to remove imdb.pl settings in -fixes,
++            // check for the old imdb.pl command and, if it's the old default,
++            // use tmdb.pl, instead (if available in the same location or the
++            // scripts dir))
++            const QString cmd = UpdateCommandForTMDB(
++                                  gContext->GetSetting("MoviePosterCommandLine",
++                                                       default_cmd),
++                                  "/imdb.pl -P", "-P");
++
+             StartRun(cmd, video_uid, "Poster Query");
+         }
+ 
+Index: mythplugins/mythvideo/mythvideo/globalsettings.cpp
+===================================================================
+--- mythplugins.orig/mythvideo/mythvideo/globalsettings.cpp	2009-03-09 22:39:40.000000000 -0400
++++ mythplugins/mythvideo/mythvideo/globalsettings.cpp	2009-03-09 22:42:47.000000000 -0400
+@@ -210,8 +210,7 @@
+ {
+     HostLineEdit *gc = new HostLineEdit("MovieListCommandLine");
+     gc->setLabel(QObject::tr("Command to search for movie listings"));
+-    gc->setValue(gContext->GetShareDir() + "mythvideo/scripts/imdb.pl " +
+-                 "-M tv=no;video=no");
++    gc->setValue(gContext->GetShareDir() + "mythvideo/scripts/tmdb.pl -M");
+     gc->setHelpText(QObject::tr("This command must be "
+                     "executable by the user running MythVideo."));
+     return gc;
+@@ -221,7 +220,7 @@
+ {
+     HostLineEdit *gc = new HostLineEdit("MoviePosterCommandLine");
+     gc->setLabel(QObject::tr("Command to search for movie posters"));
+-    gc->setValue(gContext->GetShareDir() + "mythvideo/scripts/imdb.pl -P");
++    gc->setValue(gContext->GetShareDir() + "mythvideo/scripts/tmdb.pl -P");
+     gc->setHelpText(QObject::tr("This command must be "
+                     "executable by the user running MythVideo."));
+     return gc;
+@@ -231,7 +230,7 @@
+ {
+     HostLineEdit *gc = new HostLineEdit("MovieDataCommandLine");
+     gc->setLabel(QObject::tr("Command to extract data for movies"));
+-    gc->setValue(gContext->GetShareDir() + "mythvideo/scripts/imdb.pl -D");
++    gc->setValue(gContext->GetShareDir() + "mythvideo/scripts/tmdb.pl -D");
+     gc->setHelpText(QObject::tr("This command must be "
+                     "executable by the user running MythVideo."));
+     return gc;
-- 
cgit v0.12

