Trump
- Red_Dragon - Jul 3, 2025 - 8:09pm
Republican Party
- Red_Dragon - Jul 3, 2025 - 7:27pm
Hey Baby, It's The 4th O' July
- Red_Dragon - Jul 3, 2025 - 6:54pm
NY Times Strands
- GeneP59 - Jul 3, 2025 - 5:28pm
NYTimes Connections
- GeneP59 - Jul 3, 2025 - 5:01pm
Wordle - daily game
- GeneP59 - Jul 3, 2025 - 4:23pm
July 2025 Photo Theme - Stone
- KurtfromLaQuinta - Jul 3, 2025 - 4:04pm
Country Up The Bumpkin
- KurtfromLaQuinta - Jul 3, 2025 - 3:49pm
Democratic Party
- rgio - Jul 3, 2025 - 2:28pm
M.A.G.A.
- islander - Jul 3, 2025 - 1:53pm
Immigration
- R_P - Jul 3, 2025 - 1:23pm
The Obituary Page
- ScottFromWyoming - Jul 3, 2025 - 11:27am
USA! USA! USA!
- R_P - Jul 3, 2025 - 11:23am
Israel
- R_P - Jul 3, 2025 - 11:10am
Mixtape Culture Club
- miamizsun - Jul 3, 2025 - 10:35am
Documentaries
- Proclivities - Jul 3, 2025 - 9:31am
Annoying stuff. not things that piss you off, just annoyi...
- Steely_D - Jul 3, 2025 - 8:36am
Today in History
- Red_Dragon - Jul 3, 2025 - 8:15am
DQ (as in 'Daily Quote')
- black321 - Jul 3, 2025 - 7:40am
Love & Hate
- miamizsun - Jul 3, 2025 - 7:15am
Radio Paradise Comments
- miamizsun - Jul 3, 2025 - 7:09am
Copyright and theft
- black321 - Jul 3, 2025 - 6:48am
Bug Reports & Feature Requests
- wossName - Jul 3, 2025 - 6:30am
Britain
- R_P - Jul 2, 2025 - 11:04pm
Trump Lies™
- R_P - Jul 2, 2025 - 5:01pm
Best Song Comments.
- ScottFromWyoming - Jul 2, 2025 - 3:41pm
Outstanding Covers
- NoEnzLefttoSplit - Jul 2, 2025 - 2:38pm
Protest Songs
- R_P - Jul 2, 2025 - 2:20pm
Name My Band
- oldviolin - Jul 2, 2025 - 2:11pm
Fox Spews
- islander - Jul 2, 2025 - 10:39am
Music Videos
- black321 - Jul 2, 2025 - 8:02am
Economix
- rgio - Jul 2, 2025 - 7:37am
New Music
- ScottFromWyoming - Jul 2, 2025 - 7:30am
Carmen to Stones
- KurtfromLaQuinta - Jul 1, 2025 - 7:44pm
Climate Change
- R_P - Jul 1, 2025 - 5:27pm
Baseball, anyone?
- rgio - Jul 1, 2025 - 11:06am
Artificial Intelligence
- drucev - Jul 1, 2025 - 8:58am
President(s) Musk/Trump
- VV - Jul 1, 2025 - 8:10am
June 2025 Photo Theme - Arches
- Alchemist - Jun 30, 2025 - 9:10pm
Please help me find this song
- LazyEmergency - Jun 30, 2025 - 8:42pm
Forum Posting Guidelines
- rickylee123 - Jun 30, 2025 - 6:17pm
Thanks William!
- buddy - Jun 30, 2025 - 5:49pm
Living in America
- R_P - Jun 30, 2025 - 3:15pm
Gardeners Corner
- marko86 - Jun 30, 2025 - 10:39am
Comics!
- Red_Dragon - Jun 30, 2025 - 7:59am
Birthday wishes
- Coaxial - Jun 30, 2025 - 6:36am
Talk Behind Their Backs Forum
- VV - Jun 30, 2025 - 5:39am
Global Mix renaming
- frazettaart - Jun 29, 2025 - 9:23am
Iran
- R_P - Jun 28, 2025 - 8:56pm
Live Music
- Steely_D - Jun 28, 2025 - 6:53pm
What Are You Going To Do Today?
- ScottFromWyoming - Jun 28, 2025 - 10:17am
• • • The Once-a-Day • • •
- oldviolin - Jun 28, 2025 - 9:52am
Musky Mythology
- R_P - Jun 27, 2025 - 3:00pm
Know your memes
- oldviolin - Jun 27, 2025 - 11:41am
What Makes You Sad?
- oldviolin - Jun 27, 2025 - 10:41am
Calling all Monty Python fans!
- FeydBaron - Jun 27, 2025 - 10:30am
Strips, cartoons, illustrations
- R_P - Jun 27, 2025 - 10:23am
SCOTUS
- Red_Dragon - Jun 27, 2025 - 8:30am
Framed - movie guessing game
- Proclivities - Jun 27, 2025 - 6:25am
Yummy Snack
- Proclivities - Jun 26, 2025 - 1:17pm
Parents and Children
- kurtster - Jun 26, 2025 - 11:32am
What Makes You Laugh?
- NoEnzLefttoSplit - Jun 25, 2025 - 9:36pm
PUNS- Political Punditry and so-called journalism
- oldviolin - Jun 25, 2025 - 12:06pm
Lyrics that strike a chord today...
- black321 - Jun 25, 2025 - 11:30am
What The Hell Buddy?
- oldviolin - Jun 25, 2025 - 10:32am
Astronomy!
- black321 - Jun 25, 2025 - 8:58am
The Grateful Dead
- black321 - Jun 25, 2025 - 7:13am
Billionaires
- R_P - Jun 24, 2025 - 4:57pm
Great guitar faces
- Steely_D - Jun 24, 2025 - 4:15pm
Buying a Cell Phone
- Steely_D - Jun 24, 2025 - 3:05pm
Anti-War
- R_P - Jun 24, 2025 - 12:57pm
Photography Forum - Your Own Photos
- Alchemist - Jun 24, 2025 - 10:40am
RIP Mick Ralphs
- geoff_morphini - Jun 23, 2025 - 10:40pm
Congress
- maryte - Jun 23, 2025 - 1:39pm
Europe
- R_P - Jun 23, 2025 - 11:30am
|
Index »
Radio Paradise/General »
General Discussion »
RP Now Playing Widget for iOS
|
Page: |
Diamar

Location: Orcas Island, WA Gender:  
|
Posted:
Jan 27, 2022 - 12:14pm |
|
Iâve been using Scriptable to display a âNow Playingâ widget for RP on iOS. I cobbled it together from some random code bits I picked up from the web, then customized it. It lets you see the album covers and song title/artist for the currently playing song on any RP channel.
To use it: - Install the Scriptable app on your iOS device if itâs not there already
- Launch the Scriptable app, then create and save a new script using the code at the end of this post
- Create a new widget (or widget stack) on your iOS device, choosing âScriptableâ as the type and any of the Run Script widgets it can make
- Specify the newly-made script from step 2 above, adding the parameter for the channel youâd like the widget to display (main, mellow, rock, world). If you donât add a parameter, âmainâ will default
If you put 4 calls to your widget in a widget stack, you can just scroll through all the channels and see covers.
The only thing I canât control is how quickly the screen updates, since iOS doesnât apparently let you have too much control over that. But itâll always refresh if you tap it (but it launches the Scriptable app to show it).
Hereâs the code:
let stationName = "main"
let stationID = 0
stationId = getConfiguredStationId()
let nowPlaying = await loadNowPlaying(stationId)
let widget = await createWidget(nowPlaying, stationName)
if (config.runsInWidget) {
Script.setWidget(widget)
Script.complete()
} else await widget.presentLarge()
async function createWidget(nowPlaying,stationName) {
let widget = new ListWidget()
widget.setPadding(8, 10, 12, 10)
// set gradient background with transparency
let gradient = new LinearGradient()
gradient.colors =
gradient.locations = <0.0, 1>
widget.backgroundGradient = gradient
widget.backgroundColor = new Color("#1c1c1c")
// load image
let coverArt = await loadImage(nowPlaying.cover)
widget.backgroundImage = coverArt
//Set refresh time unless this song is almost over
//Only mess with this if we have more than "enough" seconds left
const enough = 4
if (nowPlaying.time > enough) {
const n = new Date(Date.now())
widget.refreshAfterDate = new Date((Number(n) + 1000 * Math.max(1, nowPlaying.time-enough)))
} else widget.refreshAfterDate = null
widget.addSpacer()
//add channel
let channelTxt = widget.addText("RP " + stationName)
channelTxt.font = Font.semiboldRoundedSystemFont(12)
channelTxt.textColor = Color.red()
// add title and artist
let titleTxt = widget.addText(nowPlaying.title)
titleTxt.font = Font.boldRoundedSystemFont(15)
titleTxt.textColor = Color.white()
widget.addSpacer(2)
let artistTxt = widget.addText(nowPlaying.artist)
artistTxt.font = Font.boldRoundedSystemFont(14)
artistTxt.textColor = Color.yellow()
//widget.url = "vlc-x-callback://x-callback-url/stream?url=https://stream.radioparadise.com/" + stationName
return widget
}
// verify the configured flac stream
function getConfiguredStationId() {
let param = args.widgetParameter
let stationID
//if(param != null) {
switch (param) {
case 'main':
stationId = 0
stationName = "Main"
break
case 'mellow':
stationId = 1
stationName = "Mellow"
break
case 'rock':
stationId = 2
stationName = "Rock"
break
case 'world':
stationId = 3
stationName = "World"
break
default:
stationId = 0
stationName = "Main"
}
return stationId
}
// helper function to load and parse a restful json api
async function loadNowPlaying(stationId) {
const url = "https://api.radioparadise.com/api/now_playing?chan=" + stationId
let req = new Request(url)
let json = await req.loadJSON()
return json
}
// helper function to download an image from a given url
async function loadImage(imgUrl) {
let req = new Request(imgUrl)
let image = await req.loadImage()
return image
}
|
|
|