THIS PACKAGE WORKS ON WINDOWS ONLY DUE TO FILE ENCODING ISSUES
We have created a web API package which can request metadata from the SR Open API v.2. Among the data one can currently request are a list of radio channels, a list of radio programs and the current program running on each channel.
library(Lab5) library(shiny)
There are three main functions in this package, we demonstrate them below. The function get_channels requests a list of available SR radio channels and their channel ids.
a <- get_channels() head(a)
The function get_programs requests the currently non-archived (i.e. purportedly still broadcasting) programs and returns a dataframe of their names, broadcast channel ids and broadcast channel name.
b <- get_programs(get_channels()) head(b)
The function get_song takes input a character channel name and a dataframe containing channels and channel ids. Despite the name, this function actually does not return the current song playing on the input channel. Rather, it returns the current program name and the current program episode playing on the channel, where applicable.
c <-get_song("P3",get_channels()) c
The main function runs the first two functions and saves the data frames returned, using fileEncoding = "UTF-8", in two .csv files in a folder one directory up and then two directories down into /Shinyapp/data.
main()
This package has a shiny app which can be run from github using call runGitHub("thozh912/Shinyapp"). You need Lab5 package and shiny package to run it.
runGitHub("thozh912/Shinyapp")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.