Opened 10 years ago

Closed 9 years ago

#12003 closed Patch - Bug Fix (fixed)

Episode info not usable in templates in themes

Reported by: thomas@… Owned by: Jonatan Lindblad <jlindblad@…>
Priority: minor Milestone: 0.27.6
Component: Themes Version: Unspecified
Severity: medium Keywords:
Cc: Ticket locked: no

Description

I'm opening this bug and attaching this patch as requested by JYA in November. I couldn't find a bug already open on this issue.

The theming guide says we should be able to use %##x##% in theme templates to show season and episode info, but it does not work (in 0.27, perhaps master as well).

This is Jonatan Lindblad's patch, he mentions

"It looks like an issue with the regular expression used to extract the fields. # is not a word character and therefore the matching fails. The attached patch should fix that by matching against non-whitespace characters."

The full thread is here http://www.mythtv.org/pipermail/mythtv-theming/2013-November/000894.html

Attachments (1)

SetTextFromMap.patch (1.2 KB) - added by anonymous 10 years ago.

Download all attachments as: .zip

Change History (12)

Changed 10 years ago by anonymous

Attachment: SetTextFromMap.patch added

comment:1 Changed 9 years ago by Jonatan Lindblad <jlindblad@…>

Owner: set to Jonatan Lindblad <jlindblad@…>
Resolution: fixed
Status: newclosed

In 6eb4afbd48652a99a2ec4cddd774de2101aacc83/mythtv:

Fix using ##x## for season and episode in templated text

Fixes #12003.

Signed-off-by: Paul Harrison <pharrison@…>
(cherry picked from commit acdc9f86988379b842f56b89089f4e8d029dec37)

comment:2 Changed 9 years ago by paulh

Milestone: unknown0.27.5

comment:3 Changed 9 years ago by Frank Phillips <fphillips81@…>

My problem is this commit causes the regex to capture parentheses because we went from word chacters (\w) to any non-whitespace char (\S). This creates a non-matching variable like "YEAR|)". Please revert this commit. If it is necessary to keep them around in 0.27 branch, you can change (\w+) to (\w+|##x##|s##e##).

To be specific, we are talking about the use of ##x##/s##e## as variables in template text (and only in video-ui, for historical reasons). It is documented in wiki:Video-ui.xml?, but I doubt if this ever worked. The regex hasn't changed since 2010 [96df30] and the map was created in 2012 [34b933]. Why enable it now, backed by the 00x00/s00e00 alternatives in [d4e651]? The themes I have looked at only used ##x##/s##e## as textarea name attributes, which don't use the regex. I don't know if there has been any netvision/rss usage.

I've been using http://sourceforge.net/projects/qregexp-editor/ to visualize the captures.

comment:4 Changed 9 years ago by Frank Phillips <fphillips81@…>

Here is qregexp-editor output, for reference.

With \S:

% (|YEAR|)%" 
"--> Capture 1:  (|" 
"------> Pos:8" 
"--> Capture 2:  (" 
"------> Pos:8" 
"--> Capture 3: " 
"--> Capture 4: YEAR|)" 
"------> Pos:11" 
"--> Capture 5: " 
"--> Capture 6: " 

With commit reverted (\w):

% (|YEAR|)%" 
"--> Capture 1:  (|" 
"------> Pos:8" 
"--> Capture 2:  (" 
"------> Pos:8" 
"--> Capture 3: " 
"--> Capture 4: YEAR" 
"------> Pos:11" 
"--> Capture 5: |)" 
"------> Pos:15" 
"--> Capture 6: )" 
"------> Pos:16" 

comment:5 Changed 9 years ago by Karl Egly

Resolution: fixed
Status: closednew

reopening to track Frank's remark

this commit causes the regex to capture parentheses because we went from word chacters (\w) to any non-whitespace char (\S). This creates a non-matching variable like "YEAR|)". Please revert this commit. If it is necessary to keep them around in 0.27 branch, you can change (\w+) to (\w+|##x##|s##e##).

comment:6 Changed 9 years ago by Stuart Auchterlonie

Milestone: 0.27.50.27.6

comment:7 Changed 9 years ago by Karl Dietz <dekarl@…>

In bb6fe50f70e47b836bcc9752af32996fd114a15e/mythtv:

Fiddle with the theme template regular expression for #12003

It appears that \w worked for a long time. But does not match #
so it was changed to \S which matches everything but white space.

Now try with \w and explicit #.

The regexp is tested with online tools.
(I couldn't get QRegExp-Editor to build and refactoring to suit unit
tests didn't look easy)

I'll pull it into fixes/0.27 once I hear success reports.

Refs #12003

comment:8 Changed 9 years ago by Karl Egly

Status: newinfoneeded_new

comment:9 Changed 9 years ago by jpoet

Thank you, Karl. After upgrading to master after 9 months, I discovered MythUI <template>s were very broken. This change fixes them.

comment:10 in reply to:  7 Changed 9 years ago by Frank Phillips <fphillips81@…>

Replying to Karl Dietz <dekarl@…>:

In bb6fe50f70e47b836bcc9752af32996fd114a15e/mythtv:

Fiddle with the theme template regular expression for #12003

It appears that \w worked for a long time. But does not match #
so it was changed to \S which matches everything but white space.

Now try with \w and explicit #.

The regexp is tested with online tools.
(I couldn't get QRegExp-Editor to build and refactoring to suit unit
tests didn't look easy)

I'll pull it into fixes/0.27 once I hear success reports.

Refs #12003

I just rebuilt qregexp-editor following INSTALL from the 0.2.1 tarball on Arch. For usage, note that cpp wants double backslashes and the tool wants singles.

I tested the strings I use with it and they check out:

%DESCRIPTION%
%TITLE%% (|YEAR|)%
%LONGREPEAT%%(|STARS|) %%DESCRIPTION%
%##x##%
%s##e##%

I'll pull it into fixes/0.27 once I hear success reports.

Refs #12003 }}}

I'm not able to test 0.27 with the change at this time.

comment:11 Changed 9 years ago by Karl Dietz <dekarl@…>

Resolution: fixed
Status: infoneeded_newclosed

In e5e095bcb6d03f1edd107c04a8cd14c90145c079/mythtv:

Fiddle with the theme template regular expression for #12003

It appears that \w worked for a long time. But does not match #
so it was changed to \S which matches everything but white space.

Now try with \w and explicit #.

The regexp is tested with online tools.
(I couldn't get QRegExp-Editor to build and refactoring to suit unit
tests didn't look easy)

Fixes #12003

(cherry picked from commit bb6fe50f70e47b836bcc9752af32996fd114a15e)

Note: See TracTickets for help on using tickets.