|
@@ -32,6 +32,8 @@ class Radio {
|
|
|
this.showsURL = showsURL
|
|
|
this.feed = feed
|
|
|
this.name = ''
|
|
|
+ this.description = ''
|
|
|
+ this.logo = null
|
|
|
this.shows = []
|
|
|
this.schedule = null
|
|
|
}
|
|
@@ -43,14 +45,44 @@ class Radio {
|
|
|
return this.streaming
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Change radio name
|
|
|
- */
|
|
|
setName (name) {
|
|
|
this.name = name
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * The radio name, as inferred by stream-meta
|
|
|
+ *
|
|
|
+ * @returns {string}
|
|
|
+ */
|
|
|
+ getName() {
|
|
|
+ return this.name
|
|
|
+ }
|
|
|
+
|
|
|
+ setDescription(desc) {
|
|
|
+ this.description = desc
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * The description of the radio, as inferred by stream-meta
|
|
|
+ *
|
|
|
+ * @returns {string}
|
|
|
+ */
|
|
|
+ getDescription() {
|
|
|
+ return this.description
|
|
|
+ }
|
|
|
+
|
|
|
+ setLogo(logo) {
|
|
|
+ this.logo = logo
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @returns {string} the URL of the logo, or `null` if not found
|
|
|
+ */
|
|
|
+ getLogo() {
|
|
|
+ return this.logo
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
*
|
|
|
* @returns {Array<RadioShow>}
|
|
|
*/
|
|
@@ -251,11 +283,20 @@ async function get (siteurl, options) {
|
|
|
try {
|
|
|
text = await resp.text()
|
|
|
|
|
|
- const data = JSON.parse(text)
|
|
|
- const name = data['icy-name']
|
|
|
- if (name !== undefined) {
|
|
|
- manifest.setName(name)
|
|
|
- }
|
|
|
+ const data = JSON.parse(text)
|
|
|
+ const name = data['icy-name']
|
|
|
+ if (name !== undefined) {
|
|
|
+ manifest.setName(name)
|
|
|
+ }
|
|
|
+ const desc = data['icy-description']
|
|
|
+ if (desc !== undefined) {
|
|
|
+ manifest.setDescription(desc)
|
|
|
+ }
|
|
|
+
|
|
|
+ const logo = data['icy-logo']
|
|
|
+ if (desc !== undefined) {
|
|
|
+ manifest.setLogo(logo)
|
|
|
+ }
|
|
|
} catch (e) {
|
|
|
if (e instanceof SyntaxError) {
|
|
|
true
|