I’m not a JS programmer, but are pretty familiar with other languages, so are starting to look at a plugin for getting streamn urls form iheart radio.
I’ve fouind the follow repo that might help with the actually communication with iheart - https://github.com/TooTallNate/iheart, but at teh moment just trying to get my head around create the initial views in volumio.
I’ve updated addToBrowseSources and get an initial menu entry…good start.
So now working on when I click on that entry to get the plugins internal navigation working.
As far as I can tell that’s the handleBrowseUri function.
So I’ve over done the logging here, because the trouble is I can’t see the loogin appearing
iheartrad.prototype.handleBrowseUri = function (curUri) {
var self = this;
self.commandRouter.logger.info('iheartrad.handleBrowseUri: ' + curUri);
var response;
if (curUri.startsWith('iheartrad')) {
self.commandRouter.logger.info('iheartrad: found an iheart url');
if (curUri === 'iheartrad') {
self.commandRouter.logger.info('iheartrad: Default url: ' + curUri);
//response = self.getRootContent();
self.commandRouter.logger.info('iheartrad: Default url: after getRootContent');
}
else if (curUri === 'iheartrad/zm') {
response = self.getRadioContent('zm');
}
else {
self.commandRouter.logger.info('iheartrad: reject');
response = libQ.reject();
}
}
else
self.commandRouter.logger.info('iheartrad.handleBrowseUri: No uri specififed');
return response;
};
Heres the result of clicking on teh iheartrad menu item
Oct 02 11:18:47 garage-volumio volumio[23025]: info: CoreCommandRouter::volumioGetState
Oct 02 11:18:47 garage-volumio volumio[23025]: info: Listing playlists
Oct 02 11:18:47 garage-volumio volumio[23025]: info: Listing playlists
Oct 02 11:18:50 garage-volumio volumio[23025]: info: CoreCommandRouter::executeOnPlugin: iheartrad , handleBrowseUri
Oct 02 11:18:50 garage-volumio volumio[23025]: info: iheartrad: iheartrad
Oct 02 11:18:50 garage-volumio volumio[23025]: info: iheartrad: Default url
Oct 02 11:18:50 garage-volumio volumio[23025]: error: Failed to execute browseSource: TypeError: Cannot read property 'fail' of undefined
I can’t see these log entries:
self.commandRouter.logger.info('iheartrad.handleBrowseUri: ' + curUri);
self.commandRouter.logger.info('iheartrad: Default url: ' + curUri);
self.commandRouter.logger.info('iheartrad: Default url: after getRootContent');
When I finish editing my code I’ve been running volumio plugin refresh from inside the code directory (i’m writing and editing on my volumion raspberry pi). I thought that’s all I had to do, but it looks like it’s not loading the updated code, so I need to restart volumio each time? I tend to refresh the plugin page after the update command the activate the plugin.
Any pointers grateful. For reference (it’s ugly…remember when I said I had never coded JS before) repo is here: https://github.com/psyciknz/volumio-plugins/blob/gh-pages/plugins/music_service/iheartrad/index.js