diff --git a/webclient/index.html b/webclient/index.html index ae72e0d..1076390 100755 --- a/webclient/index.html +++ b/webclient/index.html @@ -311,9 +311,8 @@
-

Add an url of a radio station stream that you want to listen to. The last 25 stations are saved locally (not - on the server yet). - To find stations, use the Browse function with Dirble, or use e.g. Listenlive or Add an url of a radio station stream that you want to listen to in the boxes below. The last 25 stations are saved locally (not + on the server yet). To find stations, use the Browse function with extensions like Dirble or TuneIn, the right values will appear in these boxes automatically. Or use websites like Listenlive or Dirble.

@@ -377,7 +376,7 @@
- + diff --git a/webclient/js/controls.js b/webclient/js/controls.js index 84c345e..b8587f1 100755 --- a/webclient/js/controls.js +++ b/webclient/js/controls.js @@ -9,8 +9,8 @@ function playBrowsedTracks(addtoqueue, trackid) { } toast('Loading...'); var selected = 0, counter = 0; -//only add one station for dirble, otherwise add all tracks - if ( trackid.indexOf('dirble') != -1 ) { + //only add one station for dirble, otherwise add all tracks + if (isRadioUri(trackid)) { mopidy.tracklist.add(null, null, trackid); } else { //add all items in the playlist @@ -514,7 +514,7 @@ function addRadioUri(name, uri) { $('#radionameinput').val(''); } uri = uri || $('#radiouriinput').val(); - if (validUri(uri)) { + if (isRadioUri(uri)) { toast('Selecting radiostation...'); //stop directly, for user feedback mopidy.playback.stop(true); diff --git a/webclient/js/functionsvars.js b/webclient/js/functionsvars.js index 93d5bbb..15895b0 100755 --- a/webclient/js/functionsvars.js +++ b/webclient/js/functionsvars.js @@ -47,6 +47,9 @@ var customTracklists = []; var ua = navigator.userAgent, isMobileSafari = /Mac/.test(ua) && /Mobile/.test(ua), isMobileWebkit = /WebKit/.test(ua) && /Mobile/.test(ua), isMobile = /Mobile/.test(ua), isWebkit = /WebKit/.test(ua); +// the first part of Mopidy extensions which serve radiostations (streams) +var radioExtensionsUris = ['somafm', 'tunein', 'dirble']; + //constants PROGRAM_NAME = 'MusicBox'; //PROGRAM_NAME = 'Mopidy'; @@ -422,4 +425,9 @@ $.event.special.swipe = $.extend($.event.special.swipe, { } } }); -*/ \ No newline at end of file +*/ + +function isRadioUri (uri) { + var uriSplit = uri.split(":"); + return validUri || radioExtensionsUris.indexOf(uriSplit[0].toLowerCase()) >= 0; +} diff --git a/webclient/js/gui.js b/webclient/js/gui.js index 7102bab..d23ad57 100755 --- a/webclient/js/gui.js +++ b/webclient/js/gui.js @@ -77,7 +77,7 @@ function resizeMb() { } function setSongInfo(data) { - if (!data) { return; } + if (!data || (songdata == data) ) { return; } if (data.name == '') { return; }; @@ -120,11 +120,7 @@ function setSongInfo(data) { if (data.name && (songdata.name == data.name)) { return; } - if (data) { - songdata = data; - } else { - data = songdata; - } + songdata = data; artistshtml = ''; artiststext = ''; @@ -144,6 +140,8 @@ function setSongInfo(data) { $("#songlength").html(''); pauseTimer(); $('#trackslider').slider('disable'); + $('#radionameinput').val(data.name); + $('#radiouriinput').val(data.uri); } else { songlength = data.length; $("#songlength").html(timeFromSeconds(data.length / 1000)); diff --git a/webclient/js/radiostations.js b/webclient/js/radiostations.js deleted file mode 120000 index b4b2196..0000000 --- a/webclient/js/radiostations.js +++ /dev/null @@ -1 +0,0 @@ -/boot/config/radiostations.js \ No newline at end of file diff --git a/webclient/js/radiostations.js b/webclient/js/radiostations.js new file mode 100755 index 0000000..76c429f --- /dev/null +++ b/webclient/js/radiostations.js @@ -0,0 +1,14 @@ +/** + * Default Radiostations which appear in the webinterface. Edit if you like. + * Take care when editting. Only edit the stuff between '' + * And don't use the default Windows Notepad for this (use Notepad++ on Windows) + */ + +var radioStations = []; +//fill with defaults + radioStations.push(['NPR 24', 'http://nprdmp.ic.llnwd.net/stream/nprdmp_live01_mp3']); + radioStations.push(['3FM Dutch', 'http://icecast.omroep.nl/3fm-bb-mp3']); + radioStations.push(['BBC WorldService', 'http://vprbbc.streamguys.net:8000/vprbbc24.mp3']); + radioStations.push(['Arrow Jazz', 'http://81.173.3.132:8082']); + radioStations.push(['PBS Australia', 'http://eno.emit.com:8000/pbsfm_live_64.mp3']); + radioStations.push(['Kiss FM Berlin', 'http://stream.kissfm.de/kissfm/mp3-128/internetradio/']);