﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	mlocked
937	[PATCH]: mythfilldatabase --file tweaks	mcdmx@…	Isaac Richards	"mythfilldatabase --file doesn't add the xmltvid to the channel table. This patch fixes this and also provides two additional features:

 * build callsign from first two words of the channel name
 * if the --preset option is present and chanstr is empty, use chanid%1000 (produces chanstr 1..n)

{{{
Index: filldata.cpp
===================================================================
--- filldata.cpp        (revision 8501)
+++ filldata.cpp        (working copy)
@@ -2200,18 +2200,34 @@
                 if ((mplexid > 0) || (minor == 0))
                     chanid = ChannelUtil::CreateChanID(id, (*i).chanstr);
 
-                if ((*i).callsign == """")
-                    (*i).callsign = QString::number(chanid);
+                if ((*i).callsign.isEmpty() ) {
+                    QString tmp = (*i).name.stripWhiteSpace().upper();
+                    QString t1 = tmp.section("" "", 0,0);
+                    QString t2 = tmp.section("" "", 1,1);
+                    if( t2.isEmpty() ) {
+                        tmp.remove(5,tmp.length());
+                    } else {
+                        t1.remove(4,t1.length()).stripWhiteSpace();
+                        t1.append(t2.remove(5-t1.length(),t2.length()));
+                        tmp=t1;
+                    }
+                    (*i).callsign = tmp.stripWhiteSpace();
+                }
 
                 if (chanid > 0)
                 {
+                    QString cstr = QString((*i).chanstr);
+                    if( channel_preset && cstr.isEmpty() ) {
+                        cstr = QString::number(chanid%1000);
+                    }
                     ChannelUtil::CreateChannel(
                         mplexid,          id,        chanid, 
-                        (*i).callsign,    (*i).name, (*i).chanstr,
+                        (*i).callsign,    (*i).name, cstr,
                         0 /*service id*/, major,     minor,
                         false /*use on air guide*/,  false /*hidden*/,
                         false /*hidden in guide*/,
-                        freqid,      localfile, (*i).tvformat);
+                        freqid,      localfile, (*i).tvformat,
+                        (*i).xmltvid);
                 }
             }
         }
}}}"	patch	closed	minor	unknown	mythtv	head	medium	fixed			0
