You are here

How to replace icon based on title

2 posts / 0 new
Last post
dr-bond
Offline
Joined: 6 years
Last seen: 5 years
How to replace icon based on title

Here is what scrubs the title

index_title.scrub {single|"t"|:"|",|",}

I'm trying to replace any shows which don't have an icon with OFF-AIR which works but some shows like Teleshopping don't have an icon, so rather than displaying OFF-AIR, i would like to show a teleshopping icon but the teleshopping icon does not get added, i'm trying to replace the OFF-AIR icon with Teleshopping.png if the index_title = Teleshopping

* icons
index_showicon.scrub {regex||"programmeuuid":\s*"(.+?)"||}
index_showicon.modify {addstart('index_showicon' not "")|https://images.metadata.sky.com/pd-image/}
index_showicon.modify {addstart(="")|https://i.ibb.co/ZTjxdyY/OFF-AIR.png}
index_showicon.modify {replace((debug)index_title = "Teleshopping")|https://i.ibb.co/P6jYZ3F/Teleshopping.png}

I also tried the following but i could do not see anything in the WebGrab Plus Doc about being able to use and to match two operators as true because i would prefer to only add the Teleshopping icon if Teleshopping is blank. the below code would be my preferred way but i can't get it working.

* icons
index_showicon.scrub {regex||"programmeuuid":\s*"(.+?)"||}
index_showicon.modify {addstart('index_showicon' not "")|https://images.metadata.sky.com/pd-image/}
index_showicon.modify {addstart(index_title = "Teleshopping" and index_showicon = "")|https://i.ibb.co/P6jYZ3F/Teleshopping.png}
index_showicon.modify {addstart(index_title = "Teleshopping" and index_showicon = "")|https://i.ibb.co/ZTjxdyY/OFF-AIR.png}

Any help would be much appreciated

dr-bond
Offline
Joined: 6 years
Last seen: 5 years

I'm not sure if this is the best way that this can be done, especially if you want to change the icon for multiple different titles etc.. but i managed to get it working for what i needed, to replace titles with Teleshopping with an icon if the icon is blank and then for any other blanks to be replaced with OFF-AIR, here is the code below.

* icons
index_temp_4.scrub {regex||"programmeuuid":\s*"(.+?)"||}
index_temp_4.modify {addstart('index_temp_4' not "")|https://images.metadata.sky.com/pd-image/}
index_temp_4.modify {addend('index_title'="Teleshopping")|https://i.ibb.co/P6jYZ3F/Teleshopping.png}
index_showicon.modify {addend('index_temp_4' not ="")|'index_temp_4'}
index_showicon.modify {addend('index_showicon'="")|https://i.ibb.co/ZTjxdyY/OFF-AIR.png}
Log in or register to post comments

Brought to you by Jan van Straaten

Program Development - Jan van Straaten ------- Web design - Francis De Paemeleere
Supported by: servercare.nl