[mythtv] Trailing spaces in callsigns

Daniel Kristjansson danielk at cuymedia.net
Mon Oct 10 13:15:43 UTC 2011


On Sat, 2011-10-08 at 23:24 -0400, Jerry Rubinow wrote:

> 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.

SimpleDBStorage::GetSetClause(...) const is virtual, you can override it
in the Callsign class in channelsettings.cpp. Make it something like:

QString Callsign::GetSetClause(MSqlBindings &bindings) const
{
   QString tagname(":SET" + GetColumnName().toUpper());
   QString clause(ChannelDBStorage::GetSetClause(bindings));
   bindings[tagname] = user->GetDBValue().trimmed();
   return clause;
}

Basically, this runs the parent's GetSetClause() method, but rebinds
:SETCALLSIGN with a trimmed version of the callsign value.

-- Daniel



More information about the mythtv-dev mailing list