fixed browsing, moved default radiostations to its own file to be able to edit them in musicbox
This commit is contained in:
parent
154772d6ea
commit
05124f272b
@ -287,7 +287,7 @@
|
||||
background-color: #ddd !important;
|
||||
}
|
||||
|
||||
#browselist li a, #playlistslist li a {
|
||||
#playlistslist li a {
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
|
||||
@ -389,6 +389,7 @@
|
||||
<script src="js/library.js"></script>
|
||||
<script src="js/functionsvars.js"></script>
|
||||
<script src="js/process_ws.js"></script>
|
||||
<script src="js/radiostations.js"></script>
|
||||
|
||||
<!-- use lastfm -->
|
||||
<script type="text/javascript" src="js/lastfm.api.md5.js"></script>
|
||||
|
||||
9
webclient/js/controls.js
vendored
9
webclient/js/controls.js
vendored
@ -9,7 +9,6 @@ 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 ) {
|
||||
mopidy.tracklist.add(null, null, trackid);
|
||||
@ -17,15 +16,13 @@ function playBrowsedTracks(addtoqueue, trackid) {
|
||||
//add all items in the playlist
|
||||
$('.browsetrack').each(function() {
|
||||
mopidy.tracklist.add(null, null, this.id);
|
||||
if (this.id = trackid) {
|
||||
if (this.id == trackid) {
|
||||
selected = counter;
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
counter++;
|
||||
} );
|
||||
}
|
||||
|
||||
selected = counter - selected;
|
||||
|
||||
for (var i = 0; i <= selected; i++) {
|
||||
mopidy.playback.next();
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ TRACK_TIMER = 1000;
|
||||
|
||||
//check status timer, every 5 or 10 sec
|
||||
STATUS_TIMER = 10000;
|
||||
|
||||
/*
|
||||
var radioStations = [];
|
||||
//fill with defaults
|
||||
radioStations.push(['NPR 24', 'http://nprdmp.ic.llnwd.net/stream/nprdmp_live01_mp3']);
|
||||
@ -80,7 +80,7 @@ var radioStations = [];
|
||||
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/']);
|
||||
|
||||
*/
|
||||
|
||||
/*******
|
||||
*
|
||||
|
||||
@ -259,6 +259,7 @@ function initSocketevents() {
|
||||
});
|
||||
|
||||
mopidy.on("event:trackPlaybackStarted", function(data) {
|
||||
console.log(mopidy);
|
||||
mopidy.playback.getTimePosition().then(processCurrentposition, console.error);
|
||||
setPlayState(true);
|
||||
setSongInfo(data.tl_track.track);
|
||||
@ -310,7 +311,7 @@ $(document).bind("pageinit", function() {
|
||||
});
|
||||
|
||||
/************************
|
||||
* diverse
|
||||
* gui stuff
|
||||
************************/
|
||||
function enterFullscreen() {
|
||||
if (isMobileSafari) { alert ("To get this app in Full Screen, you have to add it to your home-screen using the Share button."); exit(); }
|
||||
@ -485,7 +486,7 @@ $(document).ready(function(event) {
|
||||
// Connect to server
|
||||
mopidy = new Mopidy();
|
||||
// mopidy.on(console.log.bind(console)); // Log all events
|
||||
|
||||
// mopidy.on(console.error.bind(console));
|
||||
//initialize events
|
||||
initSocketevents();
|
||||
|
||||
@ -498,9 +499,6 @@ $(document).ready(function(event) {
|
||||
|
||||
initgui = false;
|
||||
window.onhashchange = locationHashChanged;
|
||||
// Log all events
|
||||
//mopidy.on(function() {
|
||||
//});
|
||||
|
||||
//update gui status every x seconds from mopdidy
|
||||
setInterval(updateTimer, STATUS_TIMER);
|
||||
@ -584,14 +582,4 @@ $(document).ready(function(event) {
|
||||
event.stopImmediatePropagation(); }
|
||||
} );
|
||||
|
||||
//mopidy.on("state:online", debug);
|
||||
|
||||
});
|
||||
|
||||
function debug() {
|
||||
if (mopidy.tracklist === undefined) {
|
||||
alert('Broke at ' + new Date());
|
||||
} else {
|
||||
setTimeout(debug, 100);
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ function processBrowseDir(resultArr) {
|
||||
if ((!resultArr) || (resultArr == '')) {
|
||||
return;
|
||||
}
|
||||
// console.log(resultArr);
|
||||
console.log(resultArr);
|
||||
|
||||
if (resultArr.length == 0) {
|
||||
return;
|
||||
@ -100,18 +100,19 @@ function processBrowseDir(resultArr) {
|
||||
|
||||
if (rooturi.indexOf(':') == -1 ) {
|
||||
rooturi = '';
|
||||
child += '<li><a href="#" onclick="return getBrowseDir();">..</a></li>';
|
||||
child += '<li><a href="#" onclick="return getBrowseDir();"><h1 class="trackname">..</h1></a></li>';
|
||||
} else {
|
||||
child += '<li><a href="#" onclick="return getBrowseDir(this.id);" id="' + rooturi + '">..</a></li>';
|
||||
child += '<li><a href="#" onclick="return getBrowseDir(this.id);" id="' + rooturi + '"><h1 class="trackname">..</h1></a></li>';
|
||||
}
|
||||
|
||||
// console.log('new:' + rooturi);
|
||||
|
||||
for (var i = 0; i < resultArr.length; i++) {
|
||||
if(resultArr[i].type == 'track' ) {
|
||||
child += '<li><a href="#" class="browsetrack" onclick="return playBrowsedTracks(0, this.id);" id="' + resultArr[i].uri + '"">' + resultArr[i].name + '</a></li>';
|
||||
// console.log(resultArr[i]);
|
||||
child += '<li><a href="#" class="browsetrack" onclick="return playBrowsedTracks(0, this.id);" id="' + resultArr[i].uri + '""><h1 class="trackname">' + resultArr[i].name + '</h1></a></li>';
|
||||
} else {
|
||||
child += '<li><a href="#" onclick="return getBrowseDir(this.id);" id="' + resultArr[i].uri + '"">' + resultArr[i].name + '</a></li>';
|
||||
child += '<li><a href="#" onclick="return getBrowseDir(this.id);" id="' + resultArr[i].uri + '""><h1 class="trackname">' + resultArr[i].name + '</h1></a></li>';
|
||||
}
|
||||
};
|
||||
// console.log(child);
|
||||
|
||||
12
webclient/js/radiostations.js
Executable file
12
webclient/js/radiostations.js
Executable file
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Default Radiostations
|
||||
*/
|
||||
|
||||
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/']);
|
||||
Loading…
Reference in New Issue
Block a user