[mythtv] Trailing spaces in callsigns
Jerry Rubinow
jerrymr at gmail.com
Sun Oct 9 03:24:23 UTC 2011
On Sat, Sep 24, 2011 at 9:38 AM, Jerry Rubinow <jerrymr at gmail.com> wrote:
> On Fri, Sep 16, 2011 at 1:18 AM, Jerry Rubinow <jerrymr at gmail.com> wrote:
>
>> On Fri, Sep 16, 2011 at 12:31 AM, Michael T. Dean <
>> mtdean at thirdcontact.com> wrote:
>>
>>> On 09/15/2011 09:58 PM, Jerry Rubinow wrote:
>>> > On Thu, Sep 15, 2011 at 1:44 PM, Michael T. Dean<
>>> mtdean at thirdcontact.com>wrote:
>>> >
>>> >> On 09/15/2011 12:15 PM, Jerry Rubinow wrote:
>>> >>> On Thu, Sep 15, 2011 at 12:06 PM, Stuart Morgan wrote:
>>> >>>> On Thursday 15 Sep 2011 07:44:51 Jerry Rubinow wrote:
>>> >>>>> Would a patch be accepted which trimmed off trailing whitespace in
>>> the channel callsigns before doing the comparison for merging channels in
>>> the program guide?
>>> >>>> Would it not be easier in the long term to trim the whitespace at
>>> the time the callsign is inserted into the database instead of all the
>>> places that it's read back from the database?
>>> >>>>
>>> >>>> A one-off DB update could address the existing instances of
>>> trailing/leading whitespace.
>>> >> Ah, yeah, I misread it thinking he was asking about fixing the
>>> callsigns
>>> >> in the editors so they're put in the database correctly. But, yeah, I
>>> >> agree it should be fixed upon insert--meaning we only need a fix for
>>> the
>>> >> 4 channel editors (mythtv-setup, frontend, MythWeb, and HTTP setup).
>>> > I started looking at mythtv-setup, channeleditor.cpp to be specific. I
>>> see
>>> > where it reads the DB and populates the UI with the channel info, but I
>>> > don't see how edited info gets back into the DB. Background: lots of
>>> C++
>>> > experience, not so much with QT, some DB work, enough to puzzle my way
>>> > through understanding a query.
>>> >
>>>
>>> Looks like ChannelUtil::CreateChannel() and
>>> ChannelUtil::UpdateChannel(), which are probably used by the frontend
>>> editor, too.
>>>
>>> Also, it seems that the xmltv config(?) uses
>>> ChannelData::handleChannels().
>>
>>
>> Ok, it looks like there are four places that UPDATE the channel table and
>> one place that INSERTs into the channel table. Would modifying these five
>> places to trim trailing whitespace before modifying callsign cover all four
>> channel editors?
>>
>> UPDATE:
>> libmythtv/tv_rec.cpp:
>> SetChannelInfo
>> mfdb/channeldata.cpp:
>> handleChannels
>> libmythtv/datadirect.cpp:
>> UpdateChannelsUnsafe
>> libmythtv/channelutil.cpp:
>> UpdateChannel
>>
>> INSERT:
>> libmythtv/channelutil.cpp:
>> CreateChannel
>>
>> -Jerry
>>
>
> I put trimmed() calls in all the above places, but mythtv-setup doesn't
> seem to use UpdateChannel in channelutil.cpp in the channel editor. I'm
> having a bit of trouble following the GUI code as far as finding the code
> path from channeleditor.cpp to any code which updates the database. It
> looks like ChannelEditor::edit puts up the channel edit screen, using
> ChannelWizard, and then updates the main page when the user is done, using
> fillList. So I guess the updating must happen inside ChannelWizard, but I'm
> unable to find any code path to database updating. Any nudges in the right
> direction appreciated.
>
> Also, Mike, you mentioned a frontend channel editor and HTTP setup channel
> editor - is the MFE channel editor somewhere in the setup screens?
> What/where is the HTTP setup?
>
I've managed to locate where the updated channel info is getting into the
database in the mythtv-setup channel editor, and the initial suggestion from
Mike and Stuart of simply trimming the argument to the UPDATE/INSERT doesn't
look like it is going to work in this case. The channel editor uses some
kind of data-driven system which ends up calling ConfigurationGroup::Save =>
SimpleDBStorage::Save, which is a very generic method for updating table
info and would have no idea what and when to trim. It just cycles through
the list of data and writes out each piece. There may be a way to do it,
but I don't understand how the mythtv-setup UI system works in connection
with the data it's updating.
My last few messages didn't get any replies, but hopefully this one will.
I'd like to keep working on this, but without further guidance, I'm at a
dead end.
-Jerry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.mythtv.org/pipermail/mythtv-dev/attachments/20111008/fb6a743b/attachment.html
More information about the mythtv-dev
mailing list