Add regexp support to Infolabels
#1
Question 
I plan to extend Infolabels to support regexp. I'm thinking of something like
Code:
$REGEXP[Some.Infolabel, regexp, prefix, postfix]
What do you think, do we need more than that or is this sufficient?
Reply
#2
I had a look at the code and think using something like
Code:
$INFO[Some.Infolabel, prefix, postfix, °regexp°]
will be easier to handle. If some one would like to use "°" he has to use $DEGREE like it is with $COMMA for "," now.
Reply
#3
The only thing I'm worried about with this is that these things are read/generated every frame, so any additional processing slows things down.

Now, ideally it would be only updated when the info is updated, but this would require a rewrite of the infomanager (not necessarily a bad thing, but there is much to think about).

I guess the degree symbols are to get around the "]" termination issue?

How are you going to choose the resulting group from the regexp?

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#4
Quote:The only thing I'm worried about with this is that these things are read/generated every frame, so any additional processing slows things down. Now, ideally it would be only updated when the info is updated, but this would require a rewrite of the infomanager (not necessarily a bad thing, but there is much to think about).
I agree. It will slow down if you make use of regexp in a lot of labels. I have no time for a rewrite - sorry - but yes, that would be the cleanest solution.

I came up with this becuase I need to split the Title-Tag of my mp3 files (extract version of song and featuring artists). At the moment I have my own patch which creates 2 new infolabels for this information, but I thought a more general solution which might be used by other xbmc users too whould be better.

At the moment I'm testing first version of regexp. I'll post a patch when it is done. Then you can have a look at it and discuss if it gets into xbmc or not.
Reply
#5
Sounds good.

Let's see what the impact of it is before we start thinking about rewrites Wink

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#6
Had to pause yesterday, my wife does not like my new project :p

Function is implemented as follows:
Code:
$INFO[Some.Infolabel, prefix, postfix, regexp]
I added $CLSQRBR as replacement for "]" (like $COMMA for ",").
Works fine so far, I can not notice any performance issues while using it in skin (8 regexp in Home.xml at the same time).
Quote:How are you going to choose the resulting group from the regexp?
I didn't implement this feature at the moment (first group is chosen every time) since I think it is not needed. Or do you see a need for that? If so, I can add it.

I plan to upload the patch after final testing this evening.
Reply
#7
No need at all. The first group is fine.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#8
Patch submitted to sf - ID 1576940.
Reply

Logout Mark Read Team Forum Stats Members Help
Add regexp support to Infolabels0