K-vanc / Tempest-EPG-Generator

The fastest XMLTV formatted EPG Generator with GUI and the lowest memory usage
https://hub.docker.com/r/kvanc/tempest_epg
Other
100 stars 17 forks source link

#addstart# and #addend# operators not working if the result is 0 #117

Closed UzunMuhalefet closed 2 months ago

UzunMuhalefet commented 2 months ago

Issue Type

Please choose your issue type

Hi my friend,

I am unsure whether this is a bug or you did it intentionally.

If the result of a field is 0 then #addstart# and #addend# operators are not working.

I wanted to add rating icons for tv.telecom.kz source. I uploaded the signs to a repo and wanted to build the icon URL with the result then I faced this situation.

Example URL: https://kt.server-api.lfstrm.tv/channels/559d210c78d72701950089f8/programs?period=1714338000:1714510799&app.version=3.2.13&app.hash=6e7f16814&app.buildDate=1711538307404&app.id=sequoia&app.buildType=portal&app.whitelabel=kt&app.hostname=&app.env=&device.type=pc&device.brand=pc&device.model=none&device.uuid=bd83c71c-7079-4d8a-934a-3a90d0532e97&device.drm=wvm

Rating and Rating Icon Configuration: 'rating' => '"age_rating":(.?)}', 'rating_icon' => '"age_rating":(.?)}||#addstart#https://raw.githubusercontent.com/UzunMuhalefet/rating-icons/main/telecom.kz/||#addend#.png',

Results: Screenshot 2024-04-29 at 12 32 27

Screenshot 2024-04-29 at 12 32 33

As you can see, if the rating is 0, then I could not build the icon URL with #addstart# and #addend# commands.

I don't think I am doing something wrong because I can get the links for the rest. But if there is a better way to do it please tell me :)

K-vanc commented 2 months ago

Hi,

That's a nice catch. it is not related with addstart/addend commands but I didn't consider as someone use 0 as value of rating icon. If you don't specify, php considers 0 as empty so this is what happens. Anyway I fixed it and you will be able to do what you want as of release 1.7.0.0. thanks for reporting

Now, below command will do the trick and will not cause any problem on next releases;

'rating' => '"age_rating"(:\\d+)}',
'rating_icon' => '"age_rating"(:\\d+)}||#replace#(:)||https://raw.githubusercontent.com/UzunMuhalefet/rating-icons/main/telecom.kz/||#addend#.png',

Above is direct copy-paste from siteconfig so if you are using Siteconfig Editor, do not forget to change double backslashes (\) into single