mirror of
				https://github.com/SuperBFG7/ympd
				synced 2025-10-31 05:43:01 +00:00 
			
		
		
		
	Merge branch 'dirble_fix' of git://github.com/Nofre/ympd into Nofre-dirble_fix
This commit is contained in:
		| @@ -50,7 +50,12 @@ To run ympd with SSL support: | |||||||
| - tell ympd to use a webport using SSL and where to find the certificate:  | - tell ympd to use a webport using SSL and where to find the certificate:  | ||||||
| ``` | ``` | ||||||
| # ./ympd -w "ssl://8081:/path/to/ssl.pem" | # ./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 | Copyright | ||||||
| --------- | --------- | ||||||
|   | |||||||
| @@ -35,9 +35,7 @@ | |||||||
|         <ul id="nav_links" class="nav navbar-nav"> |         <ul id="nav_links" class="nav navbar-nav"> | ||||||
|           <li id="queue"><a href="#/">Queue</a></li> |           <li id="queue"><a href="#/">Queue</a></li> | ||||||
|           <li id="browse"><a href="#/browse/0/">Browse database</a></li> |           <li id="browse"><a href="#/browse/0/">Browse database</a></li> | ||||||
| <!-- |  | ||||||
|           <li id="dirble"><a href="#/dirble/">Dirble</a></li> |           <li id="dirble"><a href="#/dirble/">Dirble</a></li> | ||||||
| --> |  | ||||||
|           <li><a href="#" data-toggle="modal" data-target="#addstream">Add Stream</a></li> |           <li><a href="#" data-toggle="modal" data-target="#addstream">Add Stream</a></li> | ||||||
|           <li><a href="#" data-toggle="modal" data-target="#settings" onclick="getHost();">Settings</a></li> |           <li><a href="#" data-toggle="modal" data-target="#settings" onclick="getHost();">Settings</a></li> | ||||||
|         </ul> |         </ul> | ||||||
|   | |||||||
| @@ -16,6 +16,8 @@ | |||||||
|    Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |    Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||||||
| */ | */ | ||||||
|  |  | ||||||
|  | var TOKEN = ""; | ||||||
|  |  | ||||||
| var socket; | var socket; | ||||||
| var last_state; | var last_state; | ||||||
| var last_outputs; | var last_outputs; | ||||||
| @@ -107,6 +109,9 @@ var app = $.sammy(function() { | |||||||
|  |  | ||||||
|  |  | ||||||
|     this.get(/\#\/dirble\/(\d+)\/(\d+)/, function() { |     this.get(/\#\/dirble\/(\d+)\/(\d+)/, function() { | ||||||
|  |          | ||||||
|  |         if (TOKEN === "") context.redirect("#/0"); | ||||||
|  |          | ||||||
|         prepare(); |         prepare(); | ||||||
|         current_app = 'dirble'; |         current_app = 'dirble'; | ||||||
|         $('#breadcrump').removeClass('hide').empty().append("<li><a href=\"#/dirble/\">Categories</a></li><li>"+dirble_selected_cat+"</li>"); |         $('#breadcrump').removeClass('hide').empty().append("<li><a href=\"#/dirble/\">Categories</a></li><li>"+dirble_selected_cat+"</li>"); | ||||||
| @@ -132,6 +137,9 @@ var app = $.sammy(function() { | |||||||
|  |  | ||||||
|  |  | ||||||
|     this.get(/\#\/dirble\//, function() { |     this.get(/\#\/dirble\//, function() { | ||||||
|  |          | ||||||
|  |         if (TOKEN === "") context.redirect("#/0"); | ||||||
|  |          | ||||||
|         prepare(); |         prepare(); | ||||||
|         current_app = 'dirble'; |         current_app = 'dirble'; | ||||||
|         $('#breadcrump').removeClass('hide').empty().append("<li>Categories</li>"); |         $('#breadcrump').removeClass('hide').empty().append("<li>Categories</li>"); | ||||||
| @@ -237,6 +245,8 @@ $(document).ready(function(){ | |||||||
| 				break; | 				break; | ||||||
| 		} | 		} | ||||||
| 	}, true); | 	}, true); | ||||||
|  |              | ||||||
|  |     if (TOKEN === "") $('#dirble').addClass('hide'); | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -928,7 +938,7 @@ function dirble_load_categories() { | |||||||
|  |  | ||||||
|     dirble_page = 1; |     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'); |         $('#dirble_loading').addClass('hide'); | ||||||
|  |  | ||||||
| @@ -976,7 +986,7 @@ function dirble_load_categories() { | |||||||
|  |  | ||||||
| function dirble_load_stations() { | 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'); |         $('#dirble_loading').addClass('hide'); | ||||||
|         if (data.length == 20) $('#next').removeClass('hide'); |         if (data.length == 20) $('#next').removeClass('hide'); | ||||||
| @@ -1003,7 +1013,7 @@ function dirble_load_stations() { | |||||||
|             click: function() { |             click: function() { | ||||||
|                 var _this = $(this); |                 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); |                     socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream); | ||||||
|                     $('.top-right').notify({ |                     $('.top-right').notify({ | ||||||
| @@ -1021,7 +1031,7 @@ function dirble_load_stations() { | |||||||
|                 "<span class=\"glyphicon glyphicon-play\"></span></a>").find('a').click(function(e) { |                 "<span class=\"glyphicon glyphicon-play\"></span></a>").find('a').click(function(e) { | ||||||
|                     e.stopPropagation(); |                     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); |                         socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream); | ||||||
|                         $('.top-right').notify({ |                         $('.top-right').notify({ | ||||||
| @@ -1042,7 +1052,7 @@ function dirble_load_stations() { | |||||||
|             click: function() { |             click: function() { | ||||||
|                 var _this = $(this); |                 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); |                     socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream); | ||||||
|                     $('.top-right').notify({ |                     $('.top-right').notify({ | ||||||
| @@ -1060,7 +1070,7 @@ function dirble_load_stations() { | |||||||
|                 "<span class=\"glyphicon glyphicon-play\"></span></a>").find('a').click(function(e) { |                 "<span class=\"glyphicon glyphicon-play\"></span></a>").find('a').click(function(e) { | ||||||
|                     e.stopPropagation(); |                     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); |                         socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream); | ||||||
|                         $('.top-right').notify({ |                         $('.top-right').notify({ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 SuperBFG7
					SuperBFG7