Inverter Path / Replace Operator Problem #193
Replies: 2 comments 5 replies
-
Hi and thanks for the good words but yes, this is the best epg grabber ever made 😄 Anyway, what you asked is possible with inverter module but requires some experience since it is a bit complicated. I will explain step by step so you can modify or directly use as it is based on your needs. First of all, star rating shall be in "value/limit" format as per xmltv.dtd and Tempest applies the same standard so some commands such as ||#max# will not work for this format. Up to now, I only saw 4 types of limit as "/4", "/5", "/10" and "/100" so to convert all into 5 stars limit, you need to calculate them into a fixed format such as "/10" by adding below string to top of inverter-path;
so all our star-rating values converted to "/10" limiter such as "6.7/10", Now you need to replace them with star symbols based on a logic. It should go from lowest value to highest since replace operations will be performed with first-in/first-out sequence. The second input of inverter-path will be;
this will replace scores upto but not including 3 values such as 1.6/10 or 2.4/10 into "★☆☆☆☆" and stars will increase on each range of "3-4" , "5-6", "7-8" and "9-10" since above 2 following commands belong to same element, you can merge them into single block as;
Now, star-rating value is completely converted to star order. Next step is to move it into another element since players will not recognize it in this format.
will move it to the end of description with a new line and "Stars[{system}]: ★★★★☆" format. {system} there is a dynamic variable which takes the star-rating system name from siteconfig and replace it so if star-rating system is defined as IMDb in siteconfig, it will be shown as "Stars[IMDb]: ★★★★☆" or you can hardcode it as you want. And finally, you can remove star-rating type from the xml file since it has been moved to desc and remaining tag is useless in that format so you can add below command to end of inverter path;
This is how it looked in my file after conversion; Edit: btw I noticed you are using star symbol in something like html format. I used only unicode values for not having issue with some players. Not all the players may render your star symbol but all will render mine as fine. You may replace the stars on above code with your symbols. |
Beta Was this translation helpful? Give feedback.
-
you are welcome 👍 |
Beta Was this translation helpful? Give feedback.
-
Hey y'all!
First and foremost this is probably the best epg grabber for sure, I truly love it. Really really well done K-vanc!
Maybe some of you can help me though. I am working with Webgrab+ alongside Tempest and wrote myself a Perl script to replace the from numbers to star symbols ☆, and also adding them to the tag.
That worked quite well and then I looked at the EPGs in Tempest and I wanted to adapt the configs also to be able to use my script.
So far so good, and after reading through the superb manual dozens of times, I figured this should be possible without any script at all, just via the inverter path settings. But apparently I am too dumb for that :D
I hope someone can help me. Here's what I got:
["subtitle":"##episode# • #","##subtitle##"]["desc":"##country(,)##","# • #date##","# • #episode##","#\n#desc#..#","#\n-\nIMDb: #star-rating##"][“credits”:||#delete#]["writer":||#delete#]["producer":||#delete#]["composer":||#delete#]["actor":||#delete#]["director":||#delete#]["date":"#(.*?)#"]["category":"##category(,)##"||#max#2][“country”:||#delete#]["episode":"#(.*?)#"]["rating":||#delete#]
that's the main part of the inverter config. but then I tried the star-rating parts, quite different versions but nothing worked as I wanted it:
[“star-rating”:"##star-rating##"||#replace#(/5)||☆]
that's where I started but I read that I could shorten the code even so I went through various versions:
[“star-rating”:||#replace#(/5)$||]
[“star-rating”:||#replace#(\/5)||⭐]
[“star-rating”:||#replace#(\/5)$||⭐||#max#1]
["star-rating":"#(.*?)#"||#replace#(/5)||blubb]
right now I am debugging and using some different strings to replace in order to find it easily in the final epg "blubb".
Anyway, I hope someone can help me.... here is what it should look like when it's finished (the output is from Webgrab+ and my perl script):
Beta Was this translation helpful? Give feedback.
All reactions