Hello!
I've been struggling with a way for my fiance and I to actually use the Google calendar we share. And by that I mean getting her to actually see it. We fall asleep on the couch quite a bit, so I wanted to set the calendar as our Roku screensaver. This way — we actually pay attention to what's on it.
Fast-forward: It worked! —but I now have one thing I need a bit of coding help with.
I have this bit of code in my screensaver:
m.canvas.SetLayer(1,{ url: "https://api.apiflash.com/v1/urltoimage?access_key=<MYKEYGOESHERE>&format=png&ttl="+rnd(10000).tostr()+"&url=<MYURLGOESHERE>"
I am looking to replace the pseudo-random integer between 1 and 10000 with a pseudo-random integer between 5000 and 10000. I figure I can do this with simple addition by adding 5000 to rnd(5000). Buuuut I can't figure out how to do it while having it embedded in this URL.
In case anyone is curious what the **bleep** I am doing, here's the jist of it:
1. I set up a pretty-looking shared calendar via a (free) service called DAKboard
2. I use a (free) service called API Flash to screenshot my DAKboard URL into a 1080p PNG
3. I use a poorly-coded Roku screensaver to display that image URL
The hangup is that the free version of API Flash has a (totally understandable) monthly limit. I don't need this thing to update more than once every 2-4 hours or so — so I'm cool with using a long Time-to-Live value BUT as we all know if I set a static URL then the Roku cache causes it to not update, well, ever — so I'm using my TTL variable as my cachebuster since adding random flags at the end cause issues with the API Flash syntax.
Anyway - that's it. I like how it ends up looking.
Let me know if you can help me with math coding!
Cool little project! It should be as easy as
...&ttl="+(rnd(5000)+5000).toStr()+"&url=...
Cool little project! It should be as easy as
...&ttl="+(rnd(5000)+5000).toStr()+"&url=...
Aw man! I was so close!
Thanks a ton — I'll update with the results when I get a chance to apply.
EDIT: Worked beautifully! Thanks again, renojim!