updates for radio

This commit is contained in:
woutervanwijk 2014-03-06 13:15:14 +01:00
parent d173fad774
commit 837c7ba4ee
5 changed files with 33 additions and 15 deletions

View File

@ -311,9 +311,8 @@
<div class="">
<ul id="radiostationstable" class="table"></ul>
<p>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. <a href="http://www.listenlive.eu/" target="_blank">Listenlive</a> or <a
<p>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 <a href="http://www.listenlive.eu/" target="_blank">Listenlive</a> or <a
href="http://www.dirble.com/" target="_blank">Dirble</a>.</p>
<form>
@ -377,7 +376,7 @@
</div>
<!-- /page one -->
<script type="text/javascript" src="/mopidy/mopidy.js"></script>
<script type="text/javascript" src="/mopidy/mopidy.min.js"></script>
<script type="text/javascript" src="js/iscroll-lite.js"></script>
<!-- <script type="text/javascript" src="js/jquery.mobile.iscrollview-closure-min.js"></script> -->
<script src="js/jquery.cookie.js"></script>

View File

@ -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);

View File

@ -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, {
}
}
});
*/
*/
function isRadioUri (uri) {
var uriSplit = uri.split(":");
return validUri || radioExtensionsUris.indexOf(uriSplit[0].toLowerCase()) >= 0;
}

View File

@ -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));

View File

@ -1 +0,0 @@
/boot/config/radiostations.js

14
webclient/js/radiostations.js Executable file
View File

@ -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/']);