[mythtv] [PATCH] OSD regexp substitution

Chris Pinkham cpinkham at bc2va.org
Wed Oct 22 14:47:10 EDT 2003


> For awhile now, I've been wanting the program subtitle to be displayed
> in quotes before the program description in the OSD.  I finally got
> around to digging into that code and the available OSD themes and
> found that it can already be done with th %FIELD% style substitution.

The blueosd theme uses this some, but when I added this feature I posted
a message about it on the -dev list and left it up to theme designers
to use or not use it in their themes.

<snip>

> I didn't like this so I added another substitution style.  The syntax
> is "%FIELD|prefix|suffix|ifnull%".  If the field is not null, the
> prefix and suffix text will be prepended and appended, respectively,

I haven't tested it, but was wondering if it is possible to make all 3
optional with one regex.  So it would be "%FIELD|prefix|suffix|ifnull%".
A user could use any one of the following:

%FIELD%
%FIELD|prefix%
%FIELD|prefix|suffix%
%FIELD|prefix|suffix|ifnull%

So I could have:

<value>%SUBTITLE%%DESCRIPTION| - %</value>

Which would evalutate to something like "This is the Subtitle - This is the
Description" if the description was filled in and "This is the Subtitle"
if the description was empty.  No big deal but it would eliminate having
extra '|' chars around if I don't want a suffix or ifnull section and
also would allow the same regex to handle all 4 possible examples above.

Overall I like the idea and have had it on my todo list to work on
sometime but haven't had a chance to get back to that part of the code.
I haven't come up with any cleaner/better design either since reading your
post last night.

If the optional parts like I describe make sense and you can recode the
regex to make that work and repost a patch I'll get that applied.

The programinfo mod will get applied when I make my next commit to CVS,
thanks for the patch.

-- 

Chris



More information about the mythtv-dev mailing list