[mythtv] [Patch] Improved patch to setup main.cpp

Dan Schwarz mythtv-dev@snowman.net
Mon, 18 Nov 2002 17:27:44 -0500


This patch is inclusive of the patch sent earlier today, and obsoletes 
that patch. Now it checks if you are running tv_grab_de, tv_grab_uk, or 
tv_grab_sn, and it prompts you to run mythfilldatabase --manual if and 
only if that is the case.  Users running tv_grab_na are simply prompted 
to run mythfilldatabase without the manual flag.

I skimmed over that text first time I read it and ended up doing a lot 
of needless manual data entry.  To compensate for a careless user, make 
the code more careful :-)

At this point the code knows which options to use with mythfilldatabase, 
so should it just run it with the proper options as a final step? (as we 
do with tv_grab_xx earlier in setup) I didn't implement that feature, 
but it's easily done.

-Dan

--- cvs/MC/setup/main.cpp    2002-10-31 14:28:25.000000000 -0500
+++ /usr/local/src/mythtv/MC/setup/main.cpp    2002-11-18 
16:43:16.000000000 -0500
@@ -302,6 +302,13 @@
             QStringList inputlist = probeCard(videodev);
             QStringList::Iterator it;
 
+        if (inputlist.isEmpty())
+        {
+          cout << "\nSetup could not detect any capture card 
inputs.\nThis will prevent mythTV from running properly.\n\n";
+          if ("y" == getResponse("Exit setup and correct this 
problem?", "y"))
+        exit(1);
+        }
+
             for (it = inputlist.begin(); it != inputlist.end(); ++it)
             {
                 selectSource(idnum, videodev, *it, sourcelist);
@@ -359,12 +366,16 @@
     cout << "Now, please run 'mythfilldatabase' to populate the 
database\n";
     cout << "with channel information.\n";
     cout << endl;
-    cout << "If you are are using the following xmltv grabbers:\n";
-    cout << "  tv_grab_uk, tv_grab_de, tv_grab_sn\n\n";
-    cout << "You _MUST_ run 'mythfilldatabase --manual the first time, "
-         << "instead\n";
-    cout << "of just 'mythfilldatabase'.  These grabbers do not provide\n";
-    cout << "channel numbers, so you have to set them manually.\n";
 
+    QString xmltv_grabber = context->GetSetting("XMLTVGrab");
+    if (xmltv_grabber == "tv_grab_uk" ||
+    xmltv_grabber == "tv_grab_de" ||
+    xmltv_grabber == "tv_grab_sn")
+       {
+     cout << "You _MUST_ run 'mythfilldatabase --manual the first time, "
+          << "instead\n";
+     cout << "of just 'mythfilldatabase'. Your grabber does not provide\n";
+     cout << "channel numbers, so you have to set them manually.\n";
+       }
     return 0;
 }