Add regexp support to Infolabels - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93) +--- Thread: Add regexp support to Infolabels (/showthread.php?tid=22568) |
Add regexp support to Infolabels - buttergemuese - 2006-10-11 I plan to extend Infolabels to support regexp. I'm thinking of something like Code: $REGEXP[Some.Infolabel, regexp, prefix, postfix] - buttergemuese - 2006-10-11 I had a look at the code and think using something like Code: $INFO[Some.Infolabel, prefix, postfix, °regexp°] - jmarshall - 2006-10-11 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 - buttergemuese - 2006-10-12 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. - jmarshall - 2006-10-12 Sounds good. Let's see what the impact of it is before we start thinking about rewrites Cheers, Jonathan - buttergemuese - 2006-10-13 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] 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. - jmarshall - 2006-10-13 No need at all. The first group is fine. - buttergemuese - 2006-10-14 Patch submitted to sf - ID 1576940. |