summaryrefslogtreecommitdiffstats
path: root/abs/core/mythtv/stable/mythvideo/mythvideo-6338-use_tmdb_in_fixes.patch
blob: a5a182dc297ddef7c898ec9e05b16bea7e855f29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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;