Custom widget: Squeezebox Radio Stream button

Hi!
This is nothing special, but maybe will be useful for someone.
This is a clickable button with image to play radio stream to be used with Squeezebox players.
The advantage of this button is that it converts radio stream into URI directly (on-the-fly) from habpanel so it makes it very easy and quick to configure any radiostation directly from Habpanel.
Example look:

How to:

  1. Create converturi.js file directly in ‘html’ directory with the following:
angular.module('encodeuri', []).filter('encodeuri', function() {
  return function(input) {
    return  encodeURIComponent(input);
  };
});
  1. Add ‘StreamURIitem’ item (and others if you need) to your .items
String StreamURIitem
String StreamLogoItem
String StreamNameItem
  1. Make rule e.g. playstream.rules and place it into ‘rules’ directory. Don’t forget to edit ‘Your_Squeezebox_Player_PlayPause’ to your Squeezebox player PlayPause channel item. Also if you have item different than StreamURIitem then edit it here.
rule "Squeezebox Radio Playstream"
when
    Item StreamURIitem received update
then
    sendHttpGetRequest(StreamURIitem.state.toString)
    Your_Squeezebox_Player_PlayPause.sendCommand(ON)
end

  1. Import widget to Habpanel
    Squeezebox_PlayStream.widget.json (4.1 KB)
  2. Add widget and configure it following embeded description.

Enjoy!

2 Likes