UNPKG

node-tunein-radio

Version:

NodeJS Module to browse, search and play streams from TuneIn Radio

1,201 lines 45.3 kB
[ { "__docId__": 1, "kind": "external", "name": "Infinity", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Infinity", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 2, "kind": "external", "name": "NaN", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~NaN", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 3, "kind": "external", "name": "undefined", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~undefined", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 4, "kind": "external", "name": "null", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~null", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 5, "kind": "external", "name": "Object", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Object", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 6, "kind": "external", "name": "object", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~object", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 7, "kind": "external", "name": "Function", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Function", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 8, "kind": "external", "name": "function", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~function", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 9, "kind": "external", "name": "Boolean", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Boolean", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 10, "kind": "external", "name": "boolean", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~boolean", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 11, "kind": "external", "name": "Symbol", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Symbol", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 12, "kind": "external", "name": "Error", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Error", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 13, "kind": "external", "name": "EvalError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~EvalError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 14, "kind": "external", "name": "InternalError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/InternalError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~InternalError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 15, "kind": "external", "name": "RangeError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~RangeError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 16, "kind": "external", "name": "ReferenceError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~ReferenceError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 17, "kind": "external", "name": "SyntaxError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~SyntaxError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 18, "kind": "external", "name": "TypeError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~TypeError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 19, "kind": "external", "name": "URIError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~URIError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 20, "kind": "external", "name": "Number", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Number", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 21, "kind": "external", "name": "number", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~number", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 22, "kind": "external", "name": "Date", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Date", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 23, "kind": "external", "name": "String", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~String", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 24, "kind": "external", "name": "string", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~string", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 25, "kind": "external", "name": "RegExp", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~RegExp", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 26, "kind": "external", "name": "Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 27, "kind": "external", "name": "Int8Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Int8Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 28, "kind": "external", "name": "Uint8Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Uint8Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 29, "kind": "external", "name": "Uint8ClampedArray", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Uint8ClampedArray", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 30, "kind": "external", "name": "Int16Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Int16Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 31, "kind": "external", "name": "Uint16Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Uint16Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 32, "kind": "external", "name": "Int32Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Int32Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 33, "kind": "external", "name": "Uint32Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Uint32Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 34, "kind": "external", "name": "Float32Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Float32Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 35, "kind": "external", "name": "Float64Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Float64Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 36, "kind": "external", "name": "Map", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Map", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 37, "kind": "external", "name": "Set", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Set", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 38, "kind": "external", "name": "WeakMap", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~WeakMap", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 39, "kind": "external", "name": "WeakSet", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~WeakSet", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 40, "kind": "external", "name": "ArrayBuffer", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~ArrayBuffer", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 41, "kind": "external", "name": "DataView", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~DataView", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 42, "kind": "external", "name": "JSON", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~JSON", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 43, "kind": "external", "name": "Promise", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Promise", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 44, "kind": "external", "name": "Generator", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Generator", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 45, "kind": "external", "name": "GeneratorFunction", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~GeneratorFunction", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 46, "kind": "external", "name": "Reflect", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Reflect", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 47, "kind": "external", "name": "Proxy", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Proxy", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 48, "kind": "file", "name": "src/index.js", "content": "'use strict';\n\nconst axios = require('axios');\nconst axiosExtensions = require('axios-extensions');\nconst url = require('url');\nconst qs = require('qs');\n\n/**\n * TuneIn class, the main class implementing the module\n *\n * @example\n * let tuneinOptions = {\n * protocol: 'https', // Protocol to use, either http or https\n * cacheRequests: true, // Wheter to cache results or not, default false\n * cacheTTL: 1000 * 60 * 60, // Cache TTL, default 5 minutes\n * partnerId: process.env.TUNEIN_PARTNERID, // PartnerID to be used when interacting with the TuneIn API\n * };\n *\n * let tunein = new TuneIn(tuneinOptions);\n */\nmodule.exports = class TuneIn {\n /**\n * Constructur for a TuneIn object.\n * @param {object} options this is an options object with all the optionals parameters used to initialise the TuneIn client\n * @example\n * let tuneinOptions = {\n * protocol: 'https', // Protocol to use, either http or https\n * cacheRequests: true, // Wheter to cache results or not, default false\n * cacheTTL: 1000 * 60 * 60, // Cache TTL, default 5 minutes\n * partnerId: process.env.TUNEIN_PARTNERID, // PartnerID to be used when interacting with the TuneIn API\n * };\n */\n constructor(options) {\n options = options || {};\n let protocol = options.protocol || 'https';\n let cacheRequests = options.cacheRequests || false;\n let cacheTTL = options.cacheTTL || 1000 * 60 * 10;\n let partnerId = options.partnerId || '';\n\n axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';\n axios.defaults.baseURL = protocol + '://opml.radiotime.com';\n axios.defaults.params = {\n render: 'json'\n };\n\n if (cacheRequests === true) {\n axios.defaults.adapter = axiosExtensions.cacheAdapterEnhancer(\n axios.defaults.adapter,\n true,\n 'cache',\n cacheTTL\n );\n }\n\n if (partnerId != '') {\n axios.defaults.params.partnerId = partnerId;\n }\n }\n\n /**\n * Search TuneIn for a match\n * @param {string} query a query string to search for in the TuneIn catalog\n * @example\n * let queryString = 'rai radio';\n * let search = tunein.search(queryString);\n * search.then(function(results) {\n * console.log(results);\n * });\n */\n search(query) {\n let req = {};\n req.params = {};\n\n req.url = '/Search.ashx';\n req.params.query = query;\n\n return this._call_tunein_get(req);\n }\n\n /**\n * @private\n */\n _call_tunein_get(req) {\n return new Promise( (resolve, reject) => {\n axios.get(req.url, req)\n .then(function(results) {\n let head = results.data.head;\n if (head.status != 200) {\n reject(results.data);\n return new Error(`TuneIn Request error: ${head.fault}`);\n }\n\n for (var i in results.data.body) {\n if (results.data.body[i].URL) {\n results.data.body[i].URLObj = url.parse(results.data.body[i].URL, true);\n }\n }\n return resolve((results.data));\n })\n .catch(function(err) {\n return new Error(`TuneIn Request error: ${err}`);\n });\n });\n }\n\n /**\n * @private\n */\n _call_tunein_post(req, postData) {\n return new Promise( (resolve, reject) => {\n axios.post(req.url, qs.stringify(postData), req)\n .then(function(results) {\n let head = results.data.head;\n if (head.status != 200) {\n reject(results.data);\n return new Error(`TuneIn Request error: ${head.fault}`);\n }\n return resolve((results.data));\n })\n .catch(function(err) {\n return new Error(`TuneIn Request error: ${err}`);\n });\n });\n }\n\n /**\n * Tune a stream. This will return an object containing details for the specific stream, including URL and format.\n * @param {string} id The ID of the stream to tune, usually resulting from a browsing or a search call\n */\n tune_radio(id) {\n let req = {};\n req.params = {};\n\n req.url = '/Tune.ashx';\n req.params.id = id;\n\n return this._call_tunein_get(req);\n }\n\n /**\n * Describe a stream. This method will retrieve detailed information about a stream.\n *\n * @param {string} id The ID of the stream to fetch information for\n * @param {boolean} nowplaying If true it also fetches information about the show being currently aired\n */\n describe(id, nowplaying = false) {\n let req = {};\n req.params = {};\n\n req.url = '/Describe.ashx';\n if (nowplaying == true) {\n req.params.c = 'nowplaying';\n }\n req.params.id = id;\n\n return this._call_tunein_get(req);\n }\n\n /**\n * Authenticate with supplied username / password, to get access to favorite and customised results\n * @param {object} options Options to be passed to the POST call, must contain user's credential\n * @example\n * let authOptions = {\n * username: 'user@example.com',\n * password: 'secretpassword'\n * };\n * let auth = tunein.authenticate(authOptions);\n * auth.then(function(results) {\n * console.log(results[0].AccountId);\n * });\n */\n authenticate(options) {\n options = options || {};\n\n let req = {};\n req.url = '/Account.ashx';\n req.params = {};\n req.params.c = 'auth';\n\n return this._call_tunein_post(req, options);\n }\n\n /**\n * @private\n */\n _call_browse(options, req) {\n options = options || {};\n let c = options.c || '';\n let id = options.id || '';\n let filter = options.filter || '';\n let offset = options.offset || '';\n let pivot = options.pivot || '';\n let username = options.username || '';\n\n if (c) {\n req.params.c = c;\n }\n if (id) {\n req.params.id = id;\n }\n if (filter) {\n req.params.filter = filter;\n }\n if (offset) {\n req.params.offset = offset;\n }\n if (pivot) {\n req.params.pivot = pivot;\n }\n if (username) {\n req.params.username = username;\n }\n\n return this._call_tunein_get(req);\n }\n\n /**\n * Browse a podcast (Show) for episodes details\n * @param {object} options - Options object including the show ID\n * @example\n * let showOptions = {\n * c: 'pbrowse',\n * id: 'p191418'\n * };\n * let show = tunein.browse_show(showOptions);\n * show.then(function(results) {\n * console.log(results);\n * });\n */\n browse_show(options) {\n let req = {};\n req.params = {};\n req.url = '/Tune.ashx';\n\n return this._call_browse(options, req);\n }\n\n /**\n * Browse will browse the TuneIn directory depending on the supplied options paramethers\n *\n * @param {object} options - Options object for browsing\n * @return {object} results - A JSON object with results from the remote API\n */\n browse(options) {\n let req = {};\n req.params = {};\n req.url = '/Browse.ashx';\n\n return this._call_browse(options, req);\n }\n\n /**\n * Browse the local streams category\n * @param {string} username - Currently ignored\n */\n browse_local(username) {\n return this.browse({c: 'local', username: username});\n }\n\n /**\n * Browse the Music streams category\n * @param {string} username - Currently ignored\n */\n browse_music(username) {\n return this.browse({c: 'music'});\n }\n\n /**\n * Browse the talk streams category\n * @param {string} username - Currently ignored\n */\n browse_talk(username) {\n return this.browse({c: 'talk'});\n }\n\n /**\n * Browse the sports streams category\n * @param {string} username - Currently ignored\n */\n browse_sports(username) {\n return this.browse({c: 'sports'});\n }\n\n /**\n * Browse streams locations\n * @param {string} username - Currently ignored\n */\n browse_locations(username) {\n return this.browse({id : 'r0'});\n }\n\n /**\n * Browse streams languages\n * @param {string} username - Currently ignored\n */\n browse_langs(username) {\n return this.browse({c: 'lang'});\n }\n\n /**\n * Browse the podcasts directory\n * @param {string} username - Currently ignored\n */\n browse_podcast(username) {\n return this.browse({c: 'podcast'});\n }\n\n /**\n * Browse the popular streams category\n * @param {string} username - Currently ignored\n */\n browse_popular(username) {\n return this.browse({c: 'popular'});\n }\n\n /**\n * Browse the best streams category\n * @param {string} username - Currently ignored\n */\n browse_best(username) {\n return this.browse({c: 'best'});\n }\n}\n", "static": true, "longname": "/home/piffio/src/volumio/node-tunein-radio/src/index.js", "access": "public", "description": null, "lineNumber": 1 }, { "__docId__": 49, "kind": "class", "name": "TuneIn", "memberof": "src/index.js", "static": true, "longname": "src/index.js~TuneIn", "access": "public", "export": true, "importPath": "node-tunein-radio", "importStyle": "TuneIn", "description": "TuneIn class, the main class implementing the module", "examples": [ "let tuneinOptions = {\n protocol: 'https', // Protocol to use, either http or https\n cacheRequests: true, // Wheter to cache results or not, default false\n cacheTTL: 1000 * 60 * 60, // Cache TTL, default 5 minutes\n partnerId: process.env.TUNEIN_PARTNERID, // PartnerID to be used when interacting with the TuneIn API\n };\n\nlet tunein = new TuneIn(tuneinOptions);" ], "lineNumber": 21, "interface": false }, { "__docId__": 50, "kind": "constructor", "name": "constructor", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#constructor", "access": "public", "description": "Constructur for a TuneIn object.", "examples": [ "let tuneinOptions = {\n protocol: 'https', // Protocol to use, either http or https\n cacheRequests: true, // Wheter to cache results or not, default false\n cacheTTL: 1000 * 60 * 60, // Cache TTL, default 5 minutes\n partnerId: process.env.TUNEIN_PARTNERID, // PartnerID to be used when interacting with the TuneIn API\n};" ], "lineNumber": 33, "params": [ { "nullable": null, "types": [ "object" ], "spread": false, "optional": false, "name": "options", "description": "this is an options object with all the optionals parameters used to initialise the TuneIn client" } ] }, { "__docId__": 51, "kind": "method", "name": "search", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#search", "access": "public", "description": "Search TuneIn for a match", "examples": [ "let queryString = 'rai radio';\nlet search = tunein.search(queryString);\nsearch.then(function(results) {\n console.log(results);\n});" ], "lineNumber": 70, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "query", "description": "a query string to search for in the TuneIn catalog" } ], "return": { "types": [ "*" ] } }, { "__docId__": 52, "kind": "method", "name": "_call_tunein_get", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#_call_tunein_get", "access": "private", "description": "", "lineNumber": 83, "params": [ { "name": "req", "types": [ "*" ] } ], "return": { "types": [ "*" ] } }, { "__docId__": 53, "kind": "method", "name": "_call_tunein_post", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#_call_tunein_post", "access": "private", "description": "", "lineNumber": 109, "params": [ { "name": "req", "types": [ "*" ] }, { "name": "postData", "types": [ "*" ] } ], "return": { "types": [ "*" ] } }, { "__docId__": 54, "kind": "method", "name": "tune_radio", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#tune_radio", "access": "public", "description": "Tune a stream. This will return an object containing details for the specific stream, including URL and format.", "lineNumber": 130, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "id", "description": "The ID of the stream to tune, usually resulting from a browsing or a search call" } ], "return": { "types": [ "*" ] } }, { "__docId__": 55, "kind": "method", "name": "describe", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#describe", "access": "public", "description": "Describe a stream. This method will retrieve detailed information about a stream.", "lineNumber": 146, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "id", "description": "The ID of the stream to fetch information for" }, { "nullable": null, "types": [ "boolean" ], "spread": false, "optional": false, "name": "nowplaying", "description": "If true it also fetches information about the show being currently aired" } ], "return": { "types": [ "*" ] } }, { "__docId__": 56, "kind": "method", "name": "authenticate", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#authenticate", "access": "public", "description": "Authenticate with supplied username / password, to get access to favorite and customised results", "examples": [ "let authOptions = {\n username: 'user@example.com',\n password: 'secretpassword'\n};\nlet auth = tunein.authenticate(authOptions);\nauth.then(function(results) {\n console.log(results[0].AccountId);\n});" ], "lineNumber": 172, "params": [ { "nullable": null, "types": [ "object" ], "spread": false, "optional": false, "name": "options", "description": "Options to be passed to the POST call, must contain user's credential" } ], "return": { "types": [ "*" ] } }, { "__docId__": 57, "kind": "method", "name": "_call_browse", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#_call_browse", "access": "private", "description": "", "lineNumber": 186, "params": [ { "name": "options", "types": [ "*" ] }, { "name": "req", "types": [ "*" ] } ], "return": { "types": [ "*" ] } }, { "__docId__": 58, "kind": "method", "name": "browse_show", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#browse_show", "access": "public", "description": "Browse a podcast (Show) for episodes details", "examples": [ "let showOptions = {\n c: 'pbrowse',\n id: 'p191418'\n};\nlet show = tunein.browse_show(showOptions);\nshow.then(function(results) {\n console.log(results);\n});" ], "lineNumber": 230, "params": [ { "nullable": null, "types": [ "object" ], "spread": false, "optional": false, "name": "options", "description": "Options object including the show ID" } ], "return": { "types": [ "*" ] } }, { "__docId__": 59, "kind": "method", "name": "browse", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#browse", "access": "public", "description": "Browse will browse the TuneIn directory depending on the supplied options paramethers", "lineNumber": 244, "params": [ { "nullable": null, "types": [ "object" ], "spread": false, "optional": false, "name": "options", "description": "Options object for browsing" } ], "return": { "nullable": null, "types": [ "object" ], "spread": false, "description": "results - A JSON object with results from the remote API" } }, { "__docId__": 60, "kind": "method", "name": "browse_local", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#browse_local", "access": "public", "description": "Browse the local streams category", "lineNumber": 256, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "username", "description": "Currently ignored" } ], "return": { "types": [ "*" ] } }, { "__docId__": 61, "kind": "method", "name": "browse_music", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#browse_music", "access": "public", "description": "Browse the Music streams category", "lineNumber": 264, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "username", "description": "Currently ignored" } ], "return": { "types": [ "*" ] } }, { "__docId__": 62, "kind": "method", "name": "browse_talk", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#browse_talk", "access": "public", "description": "Browse the talk streams category", "lineNumber": 272, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "username", "description": "Currently ignored" } ], "return": { "types": [ "*" ] } }, { "__docId__": 63, "kind": "method", "name": "browse_sports", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#browse_sports", "access": "public", "description": "Browse the sports streams category", "lineNumber": 280, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "username", "description": "Currently ignored" } ], "return": { "types": [ "*" ] } }, { "__docId__": 64, "kind": "method", "name": "browse_locations", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#browse_locations", "access": "public", "description": "Browse streams locations", "lineNumber": 288, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "username", "description": "Currently ignored" } ], "return": { "types": [ "*" ] } }, { "__docId__": 65, "kind": "method", "name": "browse_langs", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#browse_langs", "access": "public", "description": "Browse streams languages", "lineNumber": 296, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "username", "description": "Currently ignored" } ], "return": { "types": [ "*" ] } }, { "__docId__": 66, "kind": "method", "name": "browse_podcast", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#browse_podcast", "access": "public", "description": "Browse the podcasts directory", "lineNumber": 304, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "username", "description": "Currently ignored" } ], "return": { "types": [ "*" ] } }, { "__docId__": 67, "kind": "method", "name": "browse_popular", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#browse_popular", "access": "public", "description": "Browse the popular streams category", "lineNumber": 312, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "username", "description": "Currently ignored" } ], "return": { "types": [ "*" ] } }, { "__docId__": 68, "kind": "method", "name": "browse_best", "memberof": "src/index.js~TuneIn", "generator": false, "async": false, "static": false, "longname": "src/index.js~TuneIn#browse_best", "access": "public", "description": "Browse the best streams category", "lineNumber": 320, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "username", "description": "Currently ignored" } ], "return": { "types": [ "*" ] } }, { "kind": "index", "content": "# TuneIn Radio API client\n\n```node-tunein-radio``` is a simple TuneIn Radio API javascript client, designed to be used in NodeJS.\n\n[![Build Status](https://travis-ci.org/piffio/node-tunein-radio.svg?branch=master)](https://travis-ci.org/piffio/node-tunein-radio)\n[![Coverage Status](https://coveralls.io/repos/github/piffio/node-tunein-radio/badge.svg?branch=master)](https://coveralls.io/github/piffio/node-tunein-radio?branch=master)\n[![Dependencies](https://david-dm.org/piffio/node-tunein-radio.svg)](https://david-dm.org/piffio/node-tunein-radio)\n\n# Install\n```bash\n$ npm install node-tunein-radio\n```\n\n# Use\n```javascript\nvar TuneIn = require('node-tunein-radio');\n\nvar tunein = new TuneIn({ ... });\n\ntunein.browse().then(function(result) {\n console.log(result);\n}).catch(function(err) {\n console.log(err);\n});\n```\n\n# Constructor options\n\nWhen you instantiate a new TuneIn object, you can pass in an options object with the following fields:\n\n```javascript\nvar tunein = new TuneIn({\n protocol : 'https', // Protocol to use, either 'http' or 'https', default https\n cacheRequests : false, // Wheter or not to cache requests, default false\n cacheTTL : 1000 * 60 * 5, // TTL for cached results, default 5 mins\n partnerId : 'no default' // a partnerId string provided by TuneIn, default to undefined\n});\n```\n\n# Documentation\n\nYou can read the full documentation on [GitHub Pages](https://piffio.github.io/node-tunein-radio/).\n\n# License\n\nMIT\n\n# Contributing\n\nIssues reports and PR are welcome.\n", "longname": "/home/piffio/src/volumio/node-tunein-radio/README.md", "name": "./README.md", "static": true, "access": "public" }, { "kind": "packageJSON", "content": "{\n \"name\": \"node-tunein-radio\",\n \"version\": \"0.2.0\",\n \"description\": \"NodeJS Module to browse, search and play streams from TuneIn Radio\",\n \"main\": \"src/index.js\",\n \"scripts\": {\n \"test\": \"mocha --reporter spec\",\n \"cover\": \"node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha -- -R spec test/*\",\n \"lint\": \"eslint --ignore-path .gitignore .\",\n \"docs\": \"./node_modules/.bin/esdoc\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/piffio/node-tunein-radio.git\"\n },\n \"keywords\": [\n \"tunein\",\n \"volumio\"\n ],\n \"author\": \"Sergio Visinoni <piffio@piffio.org> (https://github.com/piffio/)\",\n \"license\": \"ISC\",\n \"bugs\": {\n \"url\": \"https://github.com/piffio/node-tunein-radio/issues\"\n },\n \"homepage\": \"https://github.com/piffio/node-tunein-radio#readme\",\n \"engines\": {\n \"node\": \">=6.11.0\"\n },\n \"dependencies\": {\n \"ajv\": \"^6.1.1\",\n \"axios\": \"^0.18.0\",\n \"axios-extensions\": \"^1.2.0\",\n \"qs\": \"^6.5.1\"\n },\n \"devDependencies\": {\n \"chai\": \"^4.1.2\",\n \"coveralls\": \"^3.0.0\",\n \"eslint\": \"^4.9.0\",\n \"eslint-config-airbnb-base\": \"^12.1.0\",\n \"eslint-plugin-import\": \"^2.7.0\",\n \"istanbul\": \"^0.4.5\",\n \"mocha\": \"^5.0.1\",\n \"esdoc\": \"^1.0.4\",\n \"esdoc-node\": \"^1.0.3\",\n \"esdoc-standard-plugin\": \"^1.0.0\"\n }\n}\n", "longname": "/home/piffio/src/volumio/node-tunein-radio/package.json", "name": "package.json", "static": true, "access": "public" } ]