diff --git a/README.md b/README.md
index 4c92337..7655920 100644
--- a/README.md
+++ b/README.md
@@ -50,7 +50,12 @@ To run ympd with SSL support:
- tell ympd to use a webport using SSL and where to find the certificate:
```
# ./ympd -w "ssl://8081:/path/to/ssl.pem"
-```
+
+Dirble support
+--------------
+
+1. Get an API-key from http://dirble.com
+2. Add the key at ```var TOKEN = "";```, in ```mpd.js```.
Copyright
---------
diff --git a/htdocs/index.html b/htdocs/index.html
index 8914565..879cfd6 100644
--- a/htdocs/index.html
+++ b/htdocs/index.html
@@ -35,9 +35,7 @@
diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js
index 1f8589c..e6e06a4 100644
--- a/htdocs/js/mpd.js
+++ b/htdocs/js/mpd.js
@@ -16,6 +16,8 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+var TOKEN = "";
+
var socket;
var last_state;
var last_outputs;
@@ -107,6 +109,9 @@ var app = $.sammy(function() {
this.get(/\#\/dirble\/(\d+)\/(\d+)/, function() {
+
+ if (TOKEN === "") context.redirect("#/0");
+
prepare();
current_app = 'dirble';
$('#breadcrump').removeClass('hide').empty().append("Categories"+dirble_selected_cat+"");
@@ -132,6 +137,9 @@ var app = $.sammy(function() {
this.get(/\#\/dirble\//, function() {
+
+ if (TOKEN === "") context.redirect("#/0");
+
prepare();
current_app = 'dirble';
$('#breadcrump').removeClass('hide').empty().append("Categories");
@@ -237,6 +245,8 @@ $(document).ready(function(){
break;
}
}, true);
+
+ if (TOKEN === "") $('#dirble').addClass('hide');
});
@@ -928,7 +938,7 @@ function dirble_load_categories() {
dirble_page = 1;
- $.getJSON( "http://api.dirble.com/v2/categories?token=2e223c9909593b94fc6577361a", function( data ) {
+ $.getJSON( "http://api.dirble.com/v2/categories?token="+TOKEN, function( data ) {
$('#dirble_loading').addClass('hide');
@@ -976,7 +986,7 @@ function dirble_load_categories() {
function dirble_load_stations() {
- $.getJSON( "http://api.dirble.com/v2/category/"+dirble_catid+"/stations?page="+dirble_page+"&per_page=20&token=2e223c9909593b94fc6577361a", function( data ) {
+ $.getJSON( "http://api.dirble.com/v2/category/"+dirble_catid+"/stations?page="+dirble_page+"&per_page=20&token="+TOKEN, function( data ) {
$('#dirble_loading').addClass('hide');
if (data.length == 20) $('#next').removeClass('hide');
@@ -1003,7 +1013,7 @@ function dirble_load_stations() {
click: function() {
var _this = $(this);
- $.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) {
+ $.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token="+TOKEN, function( data ) {
socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream);
$('.top-right').notify({
@@ -1021,7 +1031,7 @@ function dirble_load_stations() {
"").find('a').click(function(e) {
e.stopPropagation();
- $.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) {
+ $.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token="+TOKEN, function( data ) {
socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream);
$('.top-right').notify({
@@ -1042,7 +1052,7 @@ function dirble_load_stations() {
click: function() {
var _this = $(this);
- $.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) {
+ $.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token="+TOKEN, function( data ) {
socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream);
$('.top-right').notify({
@@ -1060,7 +1070,7 @@ function dirble_load_stations() {
"").find('a').click(function(e) {
e.stopPropagation();
- $.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) {
+ $.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token="+TOKEN, function( data ) {
socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream);
$('.top-right').notify({