Attached is a short patch that will add a command line option 
(--no_channel_name_updates) to mythfilldatabase. This will prevent the 
updating logic from rewriting the channel's name with whatever it is called 
by the source of the listing data. Ie. You can edit your channel names in the 
setup program (Channel Editor) and those custom names will not get 
overwritten. 

 I sent it as a patch rather than just commiting it as I've never touched 
mythfilldatabase before, and I have not really thought through all the logic. 
? filldata.cpp.diff
Index: filldata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfilldatabase/filldata.cpp,v
retrieving revision 1.144
diff -u -r1.144 filldata.cpp
--- filldata.cpp	21 Jan 2005 07:19:38 -0000	1.144
+++ filldata.cpp	25 Jan 2005 22:02:10 -0000
@@ -50,6 +50,7 @@
 bool dd_grab_all = false;
 bool dddataretrieved = false;
 bool mark_repeats = true;
+bool update_channel_names = true;
 
 QString lastdduserid;
 DataDirectProcessor ddprocessor;
@@ -775,9 +776,25 @@
     if (dd_station_info.first())
     {
         QSqlQuery dd_update;
-        dd_update.prepare("UPDATE channel SET callsign = :CALLSIGN,"
-                " name = :NAME, channum = :CHANNEL, freqid = :FREQID "
-                " WHERE xmltvid = :STATIONID AND sourceid = :SOURCEID;");
+        if(update_channel_names)
+        {
+            //
+            //  User/mythbackend can pass --no_channel_name_updates on the
+            //  command line to set this flag false, thereby not constantly
+            //  overwriting user edited custom channel names
+            //
+        
+            dd_update.prepare("UPDATE channel SET callsign = :CALLSIGN,"
+                    " name = :NAME, channum = :CHANNEL, freqid = :FREQID "
+                    " WHERE xmltvid = :STATIONID AND sourceid = :SOURCEID;");
+        }
+        else
+        {
+            dd_update.prepare("UPDATE channel SET callsign = :CALLSIGN,"
+                    " channum = :CHANNEL, freqid = :FREQID "
+                    " WHERE xmltvid = :STATIONID AND sourceid = :SOURCEID;");
+            
+        }
         do
         {
             QString channel = dd_station_info.value(3).toString();
@@ -793,7 +810,10 @@
                 freqid = channel;
 
             dd_update.bindValue(":CALLSIGN", dd_station_info.value(0));
-            dd_update.bindValue(":NAME", dd_station_info.value(1));
+            if(update_channel_names)
+            {
+                dd_update.bindValue(":NAME", dd_station_info.value(1));
+            }
             dd_update.bindValue(":STATIONID", dd_station_info.value(2));
             dd_update.bindValue(":CHANNEL", channel);
             dd_update.bindValue(":SOURCEID", source.id);
@@ -3112,6 +3132,10 @@
                 }
             }
         }
+        else if (!strcmp(a.argv()[argpos], "--no_channel_name_updates"))
+        {
+            update_channel_names = false;
+        }
         else if (!strcmp(a.argv()[argpos], "-h") ||
                  !strcmp(a.argv()[argpos], "--help"))
         {
@@ -3147,6 +3171,10 @@
             cout << "   <sourceid>    = cardinput\n";
             cout << "   <xawtvrcfile> = file to read\n";
             cout << "\n";
+            cout << "--no_channel_name_updates\n";
+            cout << "   Channel name will not be overwritten with the name used in data source. This makes\n";
+            cout << "   it possible to keep custom (usually shorter) user edited names in the database.\n";
+            cout << "\n";
             cout << "--graboptions <\"options\">\n";
             cout << "   Pass options to grabber\n";
             cout << "\n";
_______________________________________________
mythtv-dev mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to