Update Style evey 5min

Hey guys.

im new to openstagecontrol but been working with touchOSC for quite a while.
i'm trying to get my resolume thumbnails into the buttons bg with the restapi feature.

if i start resolume before the openstage server everything works fine and my thumbnails getting loaded. but if i update one of my clips the backgrounds wont be loaded again.

is there a way to autorefresh the style css of a button periodically?

thanks in advance
Marcel

Can you post the content of your button's css ?

i'm getting those pictures from the Resolume RestAPI

background:url('http://192.168.0.153:1234/api/v1/composition/layers/2/clips/1/thumbnail');
background-size: contain; 
background-repeat: no-repeat;
background-position: center;

We'll use a timestamp in the url to force the browser to redownload the asset then, create a variable widget with the following onCreate script:

// variable.onCreate
setInterval(()=>{
  // update the variable's value periodically 
  // using current date timestamp
  set(this, Date.now())
}, 10000 /* ms*/)

then append the timestamp to the asset url using the inheritance syntax:

background:url('http://192.168.0.153:1234/api/v1/composition/layers/2/clips/1/thumbnail?t=@{variable_widget_id}');

If re-downloading every thumbnail periodically is too much, empty the variable's onCreate script, create a button and use its onValue script to update the variable whenever the button is clicked:

// button.onValue
set('variable_widget_id', Date.now())

guess resolume wont take the ?t=@...
tried it with the script running on create and also forced it with the button.

need to restart the server everytime i did changes to resolume arena.

Hmm, maybe this will work:

JS{
if (@{variable_widget_id} !== 0)
 return "background:url('http://192.168.0.153:1234/api/v1/composition/layers/2/clips/1/thumbnail');"
else return ""
}
background-size: contain; 
background-repeat: no-repeat;
background-position: center;
// in place of set(this, Date.now())
// replace "this" with the variable's id if calling from a button's onValue (see previous post)
set(this, 0) // make the conditional css empty
setTimeout(()=>{
  set(this, 1) // restore it shortly after
}, 1)