• Welcome to RadioDJ - Free Radio Automation Software Forum. Please log in or sign up.

Top Ten Artists Played with Google Scripts and embed into website

Started by Lotus, September 18, 2021, 12:55:00 AM

Lotus

Not sure if this will help anybody but it works and serves the purpose I needed so I thought I would pass it along. It isn't a step for step tutorial and if they are supposed to be then feel free to delete this.
I wanted to have the top ten artists played on my website.

I went into google and created a sheet and followed the instructions on this blog.
https://www.actiondesk.io/blog/google-sheets-script-to-automatically-retrieve-sql-data

Where it asks for SQL I used this SQL (probably cleaner SQL but this works...except it doesn't bring in ties if it goes over 10 items...i need to figure that out)
select radiodj2.history.artist, count(*)
from radiodj2.history
where radiodj2.history.id_subcat not in (8,9,35,37)
GROUP BY artist
ORDER BY 2 DESC
LIMIT 10;


Then on the google script I set up a trigger to refresh every 10 minutes (very simple...I just followed the steps).
Then on the google sheet I picked publish to web and picked embed and copied the iframe code to my clipboard.
Then I went into my wordpress webpage and created a new page and pasted the embed code in and saved.

https://x-factorradio.com/top-ten-played-artists/

If you go to set this up and run into problems let me know and I will see if I can help.

Problems that I ran into - On the blog that is linked above they have some code you can put in for a trigger. I ended up with a bunch of triggers somehow that I had to go in and delete.

Future problem I am going to run into is that my radio DJ broadcast server is on a dynamic IP so when it changes my google script will fail. I need to set up a dynamic DNS IP thing to account for the dynamic IP. I have never done this but will figure it out this weekend.

stevewa

Dude I'm a punker! I listen to alternative!

I registered my domain name at a mainstream company named GoDaddy where the owner is a jock who shoots elephants!

LOL

Lotus

 ::)
Quote from: stevewa on September 18, 2021, 11:43:47 AM
Dude I'm a punker! I listen to alternative!

I registered my domain name at a mainstream company named GoDaddy where the owner is a jock who shoots elephants!

LOL

PresidentOfACPJ

Quote from: Lotus on September 18, 2021, 12:55:00 AM
Not sure if this will help anybody but it works and serves the purpose I needed so I thought I would pass it along. It isn't a step for step tutorial and if they are supposed to be then feel free to delete this.
I wanted to have the top ten artists played on my website.

I went into google and created a sheet and followed the instructions on this blog.
https://www.actiondesk.io/blog/google-sheets-script-to-automatically-retrieve-sql-data

Where it asks for SQL I used this SQL (probably cleaner SQL but this works...except it doesn't bring in ties if it goes over 10 items...i need to figure that out)
select radiodj2.history.artist, count(*)
from radiodj2.history
where radiodj2.history.id_subcat not in (8,9,35,37)
GROUP BY artist
ORDER BY 2 DESC
LIMIT 10;


Then on the google script I set up a trigger to refresh every 10 minutes (very simple...I just followed the steps).
Then on the google sheet I picked publish to web and picked embed and copied the iframe code to my clipboard.
Then I went into my wordpress webpage and created a new page and pasted the embed code in and saved.

https://x-factorradio.com/top-ten-played-artists/

If you go to set this up and run into problems let me know and I will see if I can help.

Problems that I ran into - On the blog that is linked above they have some code you can put in for a trigger. I ended up with a bunch of triggers somehow that I had to go in and delete.

Future problem I am going to run into is that my radio DJ broadcast server is on a dynamic IP so when it changes my google script will fail. I need to set up a dynamic DNS IP thing to account for the dynamic IP. I have never done this but will figure it out this weekend.

Isnt easier to use radioDJ demoscript, and customize it?
Dude, about your dynamic ip, try to use DUC, from No-ip“, this is the best solution for it today.

At least if i got wut you meant.
KBMZ RADIO:

radiorockfm.com.br/
twitter: @radiorockfmreal/
fb: @radiorockfmreal

studioflashback.com.br
twitter: @radiosflashback
fb: @radiostudioflashback

BR The Classic Rock:
radiorockfm.com.br/br
twitter. @classicrockbr
fb: @classicrockbr

ZTOP:
radiorockfm.com.br/ztop
twitter: @ztop
fb: @ztop