[mythtv] New Country

Jack Porter jack at porter.net.au
Mon Jul 11 03:07:25 EDT 2005


Hi Anil,

I successfully added support for South Korea, made an xmltv grabber and 
added simple Hangul (Korean script) program finder.

I'd recommend working from the latest code rather than any prebuilt 
binaries because you're definitely going to have to recompile and if you 
run into any bugs you won't get any help here if you're not running the 
latest code.

The very first thing you'll need to do is add support for an indian 
grabber (filldata.cpp) and a menu option to select it in the setup 
program (videosource.cpp).  Attached are my patches for these files. 
(Actually, the majority of the changes to filldata.cpp are for an 
optional command-line param for tv_grab_* grabbers "xmltv_options" so 
you might night want to bother merging those lines)

One you've got that going, you'll need to write a video listing grabber 
for find some other way to populate the program table.

I used the tv_grab_jp as an example but I didn't support anything like 
daily updates or options for date ranges.  I just run it once a week as 
"mythfilldatabase --nodelete" and it runs tv_grab_kr and reads the xmltv 
data it generates.

If you don't want to go that route, you can easily just insert new 
programs directly into the program table using SQL from a perl script. 
I do this for some programs that the website I use for my source doesn't 
reliably list.

Once you've got program data in there, the rest of it is pretty easy.  I 
use a cable box so tuning wasn't a problem.  Not sure about Indian 
television standards but it should be pretty straight-forward to add 
support if one of the existing frequency tables don't work.  All the 
important code is in libs/libmythtv, just have a look around and search 
with grep.

Unicode support is pretty complete and the only thing you need to do is 
choose an OSD font that will display your character set. (put a TTF file 
in /usr/local/share/mythtv/)

Let me know if you want any more of my patches or help, I haven't 
submitted them because they're all pretty hacky but they work for me.

Good luck!

Cheers
Jack





Anil Gupte wrote:
> Looking for expertise in MythTV and XMLTV setup for a new country.  We 
> are setting up MythTV in India and having a heck of a (bad) time.  
> Initially, we are setting it up using Knoppix, although we will 
> recompile from scratch eventually.  We just want to get it up and 
> running first.  If someone (some team) has set up a new country, 
> including writing a grabber, discovering frequencies and all that, we 
> sure could use your help and/or advice.  We have lots of Linux and C 
> expertise and we can probably find Perl skills (for XMLTV).  If you know 
> of someone and they are not on this list or not on this list anymore, 
> please forward this request to them.
> 
> We will really, really appreciate it.
> 
> Anil Gupte
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
-------------- next part --------------
Index: mythtv/libs/libmythtv/videosource.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videosource.cpp,v
retrieving revision 1.80
diff -u -r1.80 videosource.cpp
--- mythtv/libs/libmythtv/videosource.cpp	10 May 2005 23:33:56 -0000	1.80
+++ mythtv/libs/libmythtv/videosource.cpp	18 Jun 2005 08:20:38 -0000
@@ -559,6 +559,9 @@
 
     addTarget("tv_grab_jp", new XMLTV_generic_config(parent, "tv_grab_jp"));
     grabber->addSelection("Japan", "tv_grab_jp");
+ 
+    addTarget("tv_grab_kr", new XMLTV_generic_config(parent, "tv_grab_kr"));
+    grabber->addSelection("South Korea", "tv_grab_kr");
 
     addTarget("tv_grab_pt", new XMLTV_generic_config(parent, "tv_grab_pt"));
     grabber->addSelection("Portugal", "tv_grab_pt");
Index: mythtv/programs/mythfilldatabase/filldata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfilldatabase/filldata.cpp,v
retrieving revision 1.177
diff -u -r1.177 filldata.cpp
--- mythtv/programs/mythfilldatabase/filldata.cpp	3 May 2005 21:56:29 -0000	1.177
+++ mythtv/programs/mythfilldatabase/filldata.cpp	18 Jun 2005 08:20:38 -0000
@@ -43,6 +43,7 @@
 bool no_delete = false;
 bool isNorthAmerica = false;
 bool isJapan = false;
+bool isKorea = false;
 bool interrupted = false;
 bool refresh_today = false;
 bool refresh_tomorrow = true;
@@ -57,6 +58,7 @@
 QString lastdduserid;
 DataDirectProcessor ddprocessor;
 QString graboptions = "";
+QString koreamovie = "";
 
 class ChanInfo
 {
@@ -189,6 +191,7 @@
     int id;
     QString name;
     QString xmltvgrabber;
+    QString xmltvgrabberoptions;
     QString userid;
     QString password;
     QString lineupid;
@@ -1355,6 +1358,11 @@
                     // Hack for tv_grab_uk_rt
                     pginfo->catType = "movie";
                 }
+
+                if( isKorea && cat.contains(koreamovie) )
+                {
+                    pginfo->catType = "movie";
+                }
             }
             else if (info.tagName() == "date" && pginfo->airdate == "")
             {
@@ -2485,6 +2493,7 @@
 bool grabData(Source source, int offset, QDate *qCurrentDate = 0)
 {
     QString xmltv_grabber = source.xmltvgrabber;
+    QString xmltv_options = source.xmltvgrabberoptions;
 
     if (xmltv_grabber == "datadirect")
         return grabDDData(source, offset, *qCurrentDate, DD_ZAP2IT);
@@ -2508,78 +2517,87 @@
     QString command;
 
     if (xmltv_grabber == "tv_grab_uk")
-        command.sprintf("nice %s --days 7 --config-file '%s' --output %s",
-                        xmltv_grabber.ascii(), configfile.ascii(), 
+        command.sprintf("nice %s %s --days 7 --config-file '%s' --output %s",
+                        xmltv_grabber.ascii(), xmltv_options.ascii(), configfile.ascii(), 
                         filename.ascii());
     else if (xmltv_grabber == "tv_grab_uk_rt")
-        command.sprintf("nice %s --days 14 --config-file '%s' --output %s",
-                        xmltv_grabber.ascii(),
+        command.sprintf("nice %s %s --days 14 --config-file '%s' --output %s",
+                        xmltv_grabber.ascii(), xmltv_options.ascii(), 
                         configfile.ascii(), filename.ascii());
     else if (xmltv_grabber == "tv_grab_au")
-        command.sprintf("nice %s --days 7 --config-file '%s' --output %s",
-                        xmltv_grabber.ascii(), configfile.ascii(),
+        command.sprintf("nice %s %s --days 7 --config-file '%s' --output %s",
+                        xmltv_grabber.ascii(), xmltv_options.ascii(), configfile.ascii(),
                         filename.ascii());
     else if (xmltv_grabber == "tv_grab_de_tvtoday")
-        command.sprintf("nice %s --slow --days 1 --config-file '%s' --offset %d --output %s",
-                        xmltv_grabber.ascii(), configfile.ascii(),
+        command.sprintf("nice %s %s --slow --days 1 --config-file '%s' --offset %d --output %s",
+                        xmltv_grabber.ascii(), xmltv_options.ascii(), configfile.ascii(),
                         offset, filename.ascii());
     else if (xmltv_grabber == "tv_grab_fr")
-        command.sprintf("nice %s --days 7 '%s' --output %s",
-                        xmltv_grabber.ascii(), configfile.ascii(),
+        command.sprintf("nice %s %s --days 7 '%s' --output %s",
+                        xmltv_grabber.ascii(), xmltv_options.ascii(), configfile.ascii(),
                         filename.ascii());
     else if (xmltv_grabber == "tv_grab_nl")
-        command.sprintf("nice %s --output %s",
-                        xmltv_grabber.ascii(),
+        command.sprintf("nice %s %s --output %s",
+                        xmltv_grabber.ascii(), xmltv_options.ascii(), 
                         filename.ascii());
     else if (xmltv_grabber == "tv_grab_fi")
         // Use the default of 10 days for Finland's grabber
-        command.sprintf("nice %s --offset %d --config-file '%s' --output %s",
-                        xmltv_grabber.ascii(), offset,
+        command.sprintf("nice %s %s --offset %d --config-file '%s' --output %s",
+                        xmltv_grabber.ascii(), xmltv_options.ascii(), offset,
                         configfile.ascii(), filename.ascii());
     else if (xmltv_grabber == "tv_grab_es")
         // Use fixed interval of 3 days for Spanish grabber
-        command.sprintf("nice %s --days=4  --config-file '%s' --output %s",
-                        xmltv_grabber.ascii(), 
+        command.sprintf("nice %s %s --days=4  --config-file '%s' --output %s",
+                        xmltv_grabber.ascii(), xmltv_options.ascii(), 
                         configfile.ascii(), filename.ascii());
     else if (xmltv_grabber == "tv_grab_jp")
     {
          // Use fixed interval of 7 days for Japanese grabber
-         command.sprintf("nice %s --days 7 --enable-readstr --config-file '%s' --output %s",
-                         xmltv_grabber.ascii(), configfile.ascii(),
+         command.sprintf("nice %s %s --days 7 --enable-readstr --config-file '%s' --output %s",
+                         xmltv_grabber.ascii(), xmltv_options.ascii(), configfile.ascii(),
                          filename.ascii());
          isJapan = true;
     }
+    else if (xmltv_grabber == "tv_grab_kr")
+    {
+		// Use fixed interval of 7 days for Korean grabber
+		command.sprintf("nice %s %s --output %s",
+			xmltv_grabber.ascii(), xmltv_options.ascii(), 
+			filename.ascii());
+		isKorea = true;
+		koreamovie = QString::fromUtf8("영화");
+	}
     else if (xmltv_grabber == "tv_grab_no")
-        command.sprintf("nice %s --days 1 --offset %d --config-file '%s' --output %s",
-                        xmltv_grabber.ascii(), offset, configfile.ascii(),
+        command.sprintf("nice %s %s --days 1 --offset %d --config-file '%s' --output %s",
+                        xmltv_grabber.ascii(), xmltv_options.ascii(), offset, configfile.ascii(),
                         filename.ascii());
     else if (xmltv_grabber == "tv_grab_se_swedb")
-         command.sprintf("nice %s --days 1 --offset %d --config-file '%s' --output %s",
-                         xmltv_grabber.ascii(), offset, configfile.ascii(),
+         command.sprintf("nice %s %s --days 1 --offset %d --config-file '%s' --output %s",
+                         xmltv_grabber.ascii(), xmltv_options.ascii(), offset, configfile.ascii(),
                          filename.ascii());
     else if (xmltv_grabber == "tv_grab_dk")
         // Use fixed interval of 7 days for Danish grabber
-        command.sprintf("nice %s --days 7 --config-file '%s' --output %s",
-                        xmltv_grabber.ascii(), configfile.ascii(),
+        command.sprintf("nice %s %s --days 7 --config-file '%s' --output %s",
+                        xmltv_grabber.ascii(), xmltv_options.ascii(), configfile.ascii(),
                         filename.ascii());
     else if (xmltv_grabber == "tv_grab_pt")
         // Use fixed interval of 3 days for Portuguese grabber
-        command.sprintf("nice %s --days=4  --config-file '%s' --output %s",
-                        xmltv_grabber.ascii(), 
+        command.sprintf("nice %s %s --days=4  --config-file '%s' --output %s",
+                        xmltv_grabber.ascii(), xmltv_options.ascii(), 
                         configfile.ascii(), filename.ascii());
     else if (xmltv_grabber == "tv_grab_be_tvb")
-        command.sprintf("nice %s --days 1 --offset %d --config-file '%s' --output %s",
-                        xmltv_grabber.ascii(), offset, configfile.ascii(),
+        command.sprintf("nice %s %s --days 1 --offset %d --config-file '%s' --output %s",
+                        xmltv_grabber.ascii(), xmltv_options.ascii(), offset, configfile.ascii(),
                         filename.ascii());
     else if (xmltv_grabber == "tv_grab_be_tlm")
-        command.sprintf("nice %s --days 1 --offset %d --config-file '%s' --output %s",
-                        xmltv_grabber.ascii(), offset, configfile.ascii(),
+        command.sprintf("nice %s %s --days 1 --offset %d --config-file '%s' --output %s",
+                        xmltv_grabber.ascii(), xmltv_options.ascii(), offset, configfile.ascii(),
                         filename.ascii());
     else
     {
         isNorthAmerica = true;
-        command.sprintf("nice %s --days 1 --offset %d --config-file '%s' "
-                        "--output %s", xmltv_grabber.ascii(),
+        command.sprintf("nice %s %s --days 1 --offset %d --config-file '%s' "
+                        "--output %s", xmltv_grabber.ascii(), xmltv_options.ascii(), 
                         offset, configfile.ascii(), filename.ascii());
     }
 
@@ -2596,6 +2614,7 @@
          xmltv_grabber == "tv_grab_nl" ||
          xmltv_grabber == "tv_grab_fr" ||
          xmltv_grabber == "tv_grab_fi" ||
+         xmltv_grabber == "tv_grab_kr" ||
          xmltv_grabber == "tv_grab_jp" ||
          xmltv_grabber == "tv_grab_pt" ||
          xmltv_grabber == "tv_grab_be_tvb" ||
@@ -2746,7 +2765,7 @@
             xmltv_grabber == "tv_grab_fi" || xmltv_grabber == "tv_grab_es" ||
             xmltv_grabber == "tv_grab_nl" || xmltv_grabber == "tv_grab_au" ||
             xmltv_grabber == "tv_grab_fr" || xmltv_grabber == "tv_grab_jp" ||
-            xmltv_grabber == "tv_grab_pt")
+            xmltv_grabber == "tv_grab_pt" || xmltv_grabber == "tv_grab_kr" )
         {
             // These don't support the --offset option, so just grab the max.
             if (!grabData(*it, -1))
@@ -3520,7 +3539,7 @@
 
         MSqlQuery sourcequery(MSqlQuery::InitCon());
         QString querystr = QString("SELECT sourceid,name,xmltvgrabber,userid,"
-                                   "password,lineupid "
+                                   "password,lineupid,xmltvgrabberoptions "
                                    "FROM videosource ORDER BY sourceid;");
         sourcequery.exec(querystr);
         
@@ -3535,6 +3554,7 @@
                        newsource.id = sourcequery.value(0).toInt();
                        newsource.name = sourcequery.value(1).toString();
                        newsource.xmltvgrabber = sourcequery.value(2).toString();
+		       newsource.xmltvgrabberoptions = sourcequery.value(6).toString();
                        newsource.userid = sourcequery.value(3).toString();
                        newsource.password = sourcequery.value(4).toString();
                        newsource.lineupid = sourcequery.value(5).toString();


More information about the mythtv-dev mailing list