Echo Dot music information


#1

In my expression statement in webcore, [Echo - White Echo : audioTrackData] gives {“title”:“Fires”,“artist”:“Jordan St. Cyr”,“album”:“Divine Sound Radio”,“albumArtUrl”:“https://m.media-amazon.com/images/I/51xH-Y57TsL. UL600 .jpg”,“mediaSource”:“Amazon Music”}

I cannot figure out the syntax for the expression to give just the album title or artist.


#2

See if you get anything if you log this to console.

replace([Echo - White Echo : audioTrackData],"\{","","\}","",)


#3

I can parse the information out of the string of course. But I thought just the right syntax would give me the info I need.


#4

I have one extra comma at the end, just drop that


#5

I’m pretty sure I have not made myself clear.
[Echo - White Echo : audioTrackData] = {“title”:“Fires”,“artist”:“Jordan St. Cyr”,“album”:“Divine Sound Radio”,“albumArtUrl”:“https://m.media-amazon.com/images/I/51xH-Y57TsL. UL600 .jpg”,“mediaSource”:“Amazon Music”}

I’m trying to assign the artist and title to my variable @@Pad_Artist_Title.

In my set variable command, how to I pull out just the artist or title info?
@@Pad_Artist_Title = [Echo - White Echo : audioTrackData].artist ???
or
@@Pad_Artist_Title = [Echo - White Echo : audioTrackData].title ???


#6

LOL, it’s me who didn’t explain why I asked to see if you can get anything out of that expression. The curly bracket is messing with the functions and I’m not at home to try it on my echo. I wanted to see if you can extract the string without the curly brackets.


#7

Without the end comma…


#8

ok, let me play with this for a bit.


#9

For testing, save the output of replace([Echo - White Echo : audioTrackData],"\{","","\}","") to a variable info or anything you want but replace it in th expression below.

Artist
mid(info, indexOf(info,'“artist”:“')+10, (indexOf(info,'“album”')-2)-(indexOf(info,'“artist”:“')+10))

Title
mid(info, 9, (indexOf(info,'“artist”:“')-11))

See if it works on other titles.


#10

I can parse it out as you have suggested here. I was just hoping for a more graceful approach. LOL


#11

Yeah, not pretty at all.


#12

Thanks for the help my friend. I’ll keep trying. :slight_smile:


#13

No prob, it was good distraction for a monday morning. I do notice you do a lot of music stuff with webcore :slight_smile: me, I just stick an earbud in my ear and start cooking lol.


#14

I probably do WAY to much music stuff with webcore. I am constantly playing music on my ceiling speakers throughout my house…in the kitchen, in the den, in the bathroom, in the shower…you name it. My wife just rolls her eyes at all of the Christmas music. During our family Christmas party yesterday, I had https://www.amazon.com/Wish-Merry-Christmas-Cappella-Girls/dp/B006DLOPOC/ref=sr_1_1?crid=35Z52DZPK0M9K&keywords=We+Wish+You+A+Merry+Christmas+(A+Cappella+Girls)&qid=1640630830&sprefix=we+wish+you+a+merry+christmas+a+cappella+girls+%2Caps%2C162&sr=8-1 playing every hour overhead like an airport announcement. :smile:


#15

Is that a json string, can you

just variable.artist it?


#16

I tried variable.artist and many other iterations…nada.


#17


#18

You rock sir!! Perfect.


#19

The Parse JSON data is what I was missing :slight_smile: Very nice!


#20

Me too! The elegant solution I was looking for. Thanks gentlemen!