I built a now-playing widget for Radio Paradise which shows album artwork and metadata. It queries a simple REST api (json) and loads the image. Once touched it opens the flac stream of Radioparadise in VLC (via callback-url).
Hey Marco! This looks absolutely great! I really want to do the same with my local radio station here in The Netherlands. Can you help me with that? The track information comes from here. Sometimes there is no album cover url available in the api and then I want to use this image.
I see you are a big fan of building widgets in Scribtable, I really appreciate it!
Sure, that’s not that big a deal. You‘re looking for
let title = nowPlaying.data[0].title
let artist = nowPlaying.data[0].artist
let imageUrl
if (nowPlaying.data[0].imageUrl != null && nowPlaying.data[0].imageUrl.length > 0) {
imageUrl = nowPlaying.data[0].imageUrl
} else {
imageUrl = "https://www.npo3fm.nl/templates/npo3fm/images/placeholder-1by1.png"
}
let coverArt = await loadImage(imageUrl)
let title = "THIS IS ALL UPPERCASE"
// transform to lowercase
title = title.toLowerCase()
// capitalize every first character
title.replace(/\b\w/g, function(c) {
return c.toUpperCase();
});
Thanks! I really appreciate that! This is what I have now. Can you help me to change the text to some uppercase and I want the logo down a little so that it is the same height as the album cover.
Unfortunately it’s not possible to display content side by side.
// add title and artist
let title = nowPlaying.title.toLowerCase()
// capitalize every first character
title = title.replace(/\b\w/g, function(c) {
return c.toUpperCase();
});
let titleTxt = widget.addText(title)
titleTxt.font = Font.boldSystemFont(12)
titleTxt.textColor = Color.white()
titleTxt.leftAlignText()
widget.addSpacer(2)
let artist = nowPlaying.artist.toLowerCase()
// capitalize every first character
artist = artist.replace(/\b\w/g, function(c) {
return c.toUpperCase();
});
let artistTxt = widget.addText(artist)
artistTxt.font = Font.systemFont(10)
artistTxt.textColor = Color.white()
artistTxt.textOpacity = 0.6
artistTxt.leftAlignText()
You could try to set the cover as background and play a little bit with transparency. Just change the last two digits of the Color (notice that there are 8, not 6).
This is really cool - if only for the discovery of radio paradise! -
I know widget update rates are kind of iffy, but this one seems never to update! (Plays the radio station, but the cover is stuck) I’m not sure what may block this?