[mythtv-commits] Ticket #937: [PATCH]: mythfilldatabase --file tweaks

MythTV mythtv at cvs.mythtv.org
Wed Jan 4 18:08:07 UTC 2006


#937: [PATCH]: mythfilldatabase --file tweaks
--------------------------------+-------------------------------------------
 Reporter:  mcdmx at users.sf.net  |       Owner:  ijr
     Type:  patch               |      Status:  new
 Priority:  minor               |   Milestone:     
Component:  mythtv              |     Version:     
 Severity:  medium              |  
--------------------------------+-------------------------------------------
 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);
                  }
              }
          }
 }}}

-- 
Ticket URL: <http://cvs.mythtv.org/trac/ticket/937>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list