[Slim-Checkins] r12575 - in /trunk/server/HTML: EN/html/ Maestro/ Maestro/html/ Maestro/html/images/

mherger at svn.slimdevices.com mherger at svn.slimdevices.com
Thu Aug 16 07:38:32 PDT 2007


Author: mherger
Date: Thu Aug 16 07:38:32 2007
New Revision: 12575

URL: http://svn.slimdevices.com?rev=12575&view=rev
Log:
Bug: n/a
Description: current song display panel working, but still missing things like playtime etc.

Added:
    trunk/server/HTML/Maestro/html/images/btn_next_normal.png   (with props)
    trunk/server/HTML/Maestro/html/images/btn_play_normal.png   (with props)
    trunk/server/HTML/Maestro/html/images/btn_power_normal.png   (with props)
    trunk/server/HTML/Maestro/html/images/btn_repeat_normal.png   (with props)
    trunk/server/HTML/Maestro/html/images/btn_shuffle_normal.png   (with props)
    trunk/server/HTML/Maestro/html/images/btn_volume_hi_normal.png   (with props)
    trunk/server/HTML/Maestro/html/images/btn_volume_low_normal.png   (with props)
    trunk/server/HTML/Maestro/html/images/playerbase_std_mid.png   (with props)
    trunk/server/HTML/Maestro/html/images/toggle_player_std.png   (with props)
Modified:
    trunk/server/HTML/EN/html/vars.js
    trunk/server/HTML/Maestro/html/index.js
    trunk/server/HTML/Maestro/index.html
    trunk/server/HTML/Maestro/pageheader.html

Modified: trunk/server/HTML/EN/html/vars.js
URL: http://svn.slimdevices.com/trunk/server/HTML/EN/html/vars.js?rev=12575&r1=12574&r2=12575&view=diff
==============================================================================
--- trunk/server/HTML/EN/html/vars.js (original)
+++ trunk/server/HTML/EN/html/vars.js Thu Aug 16 07:38:32 2007
@@ -2,6 +2,7 @@
 	var webroot       = "[% webroot %]";
 	[% IF refresh %]var refreshtime   = "[% refresh %]";[% END %]
 	var player        = "[% playerURI %]";
+	var playerid      = "[% player %]";
 	var url           = "[% statusroot %]";
 	var statusroot    = "[% statusroot %]";
 	var browserTarget;

Added: trunk/server/HTML/Maestro/html/images/btn_next_normal.png
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/html/images/btn_next_normal.png?rev=12575&view=auto
==============================================================================
Binary file - no diff available.

Propchange: trunk/server/HTML/Maestro/html/images/btn_next_normal.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: trunk/server/HTML/Maestro/html/images/btn_next_normal.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: trunk/server/HTML/Maestro/html/images/btn_play_normal.png
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/html/images/btn_play_normal.png?rev=12575&view=auto
==============================================================================
Binary file - no diff available.

Propchange: trunk/server/HTML/Maestro/html/images/btn_play_normal.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: trunk/server/HTML/Maestro/html/images/btn_play_normal.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: trunk/server/HTML/Maestro/html/images/btn_power_normal.png
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/html/images/btn_power_normal.png?rev=12575&view=auto
==============================================================================
Binary file - no diff available.

Propchange: trunk/server/HTML/Maestro/html/images/btn_power_normal.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: trunk/server/HTML/Maestro/html/images/btn_power_normal.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: trunk/server/HTML/Maestro/html/images/btn_repeat_normal.png
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/html/images/btn_repeat_normal.png?rev=12575&view=auto
==============================================================================
Binary file - no diff available.

Propchange: trunk/server/HTML/Maestro/html/images/btn_repeat_normal.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: trunk/server/HTML/Maestro/html/images/btn_repeat_normal.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: trunk/server/HTML/Maestro/html/images/btn_shuffle_normal.png
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/html/images/btn_shuffle_normal.png?rev=12575&view=auto
==============================================================================
Binary file - no diff available.

Propchange: trunk/server/HTML/Maestro/html/images/btn_shuffle_normal.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: trunk/server/HTML/Maestro/html/images/btn_shuffle_normal.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: trunk/server/HTML/Maestro/html/images/btn_volume_hi_normal.png
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/html/images/btn_volume_hi_normal.png?rev=12575&view=auto
==============================================================================
Binary file - no diff available.

Propchange: trunk/server/HTML/Maestro/html/images/btn_volume_hi_normal.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: trunk/server/HTML/Maestro/html/images/btn_volume_hi_normal.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: trunk/server/HTML/Maestro/html/images/btn_volume_low_normal.png
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/html/images/btn_volume_low_normal.png?rev=12575&view=auto
==============================================================================
Binary file - no diff available.

Propchange: trunk/server/HTML/Maestro/html/images/btn_volume_low_normal.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: trunk/server/HTML/Maestro/html/images/btn_volume_low_normal.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: trunk/server/HTML/Maestro/html/images/playerbase_std_mid.png
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/html/images/playerbase_std_mid.png?rev=12575&view=auto
==============================================================================
Binary file - no diff available.

Propchange: trunk/server/HTML/Maestro/html/images/playerbase_std_mid.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: trunk/server/HTML/Maestro/html/images/playerbase_std_mid.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: trunk/server/HTML/Maestro/html/images/toggle_player_std.png
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/html/images/toggle_player_std.png?rev=12575&view=auto
==============================================================================
Binary file - no diff available.

Propchange: trunk/server/HTML/Maestro/html/images/toggle_player_std.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: trunk/server/HTML/Maestro/html/images/toggle_player_std.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: trunk/server/HTML/Maestro/html/index.js
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/html/index.js?rev=12575&r1=12574&r2=12575&view=diff
==============================================================================
--- trunk/server/HTML/Maestro/html/index.js (original)
+++ trunk/server/HTML/Maestro/html/index.js Thu Aug 16 07:38:32 2007
@@ -1,6 +1,18 @@
 Main = function(){
+	var pollTimer;
+
+	var playerStatus = {
+		power: null,
+		modus: null,
+		title: null,
+		track: null
+	};
+
 	return {
 		init : function(){
+			pollTimer = new Ext.util.DelayedTask(Main.pollStatus, this);
+			this.pollStatus();
+
 			var layout = new Ext.BorderLayout('mainbody', {
 				north: {
 					split:false,
@@ -46,7 +58,139 @@
 			Ext.get('rightpanel').setHeight(colHeight - 155);
 
 			this.layout();
+		},
+		
+		
+		updateStatus : function(response) {
+
+			if (response && response.responseText) {
+				var responseText = Ext.util.JSON.decode(response.responseText);
+				
+				// only continue if we got a result and player
+				if (responseText.result && responseText.result.player_connected) {
+					var result = responseText.result;
+					if (result.power && result.playlist_tracks > 0) {
+						Ext.get('ctrlCurrentTitle').update(
+							result.current_title ? result.current_title :
+							result.playlist_loop[0].tracknum + ". " + result.playlist_loop[0].title
+						);
+//						Ext.get('statusSongCount').update(result.playlist_tracks);
+//						Ext.get('statusPlayNum').update(result.playlist_cur_index + 1);
+//						Ext.get('statusBitrate').update(result.playlist_loop[0].bitrate);
+						Ext.get('ctrlCurrentArtist').update(result.playlist_loop[0].artist);
+						Ext.get('ctrlCurrentAlbum').update(result.playlist_loop[0].album);
+//						Ext.get('statusYear').update(result.playlist_loop[0].year);
+		
+/*						var playlistUpdater = Ext.get('playlist').getUpdateManager();
+						playlistUpdater.setDefaultUrl(webroot + 'playlist.html');
+						playlistUpdater.showLoadIndicator = false;
+						playlistUpdater.refresh();
+*/		
+						if (result.playlist_loop[0].id) {
+							Ext.get('ctrlCurrentArt').update('<img src="/music/' + result.playlist_loop[0].id + '/cover_96x96.jpg">');
+						}
+		
+						playerStatus = {
+							power: result.power,
+							mode: result.mode,
+							title: result.current_title,
+							track: result.playlist_loop[0].url
+						};
+					}
+		
+/*					else if (playerStatus.name) {
+							var playlistUpdater = Ext.get('playlist').getUpdateManager();
+							playlistUpdater.setDefaultUrl(webroot + 'playlist.html');
+							playlistUpdater.showLoadIndicator = false;
+							playlistUpdater.refresh();
+							
+							playerStatus = {
+								power: null,
+								mode: null,
+								title: null,
+								track: null
+							};
+					}
+*/				}
+			}
+			pollTimer.delay(5000);
+		},
+		
+		
+		// only poll to see whether the currently playing song has changed
+		// don't request all status info to minimize performance impact on the server
+		pollStatus : function() {
+			Ext.Ajax.request({
+				url: '/jsonrpc.js',
+				method: 'POST',
+				params: Ext.util.JSON.encode({
+					id: 1, 
+					method: "slim.request", 
+					params: [ 
+						playerid,
+						[ 
+							"status",
+							"-",
+							1,
+							"tags:u"
+						]
+					]
+				}),
+
+				success: function(response){
+					if (response && response.responseText) {
+						var responseText = Ext.util.JSON.decode(response.responseText);
+						
+						// only continue if we got a result and player
+						if (responseText.result && responseText.result.player_connected) {
+							var result = responseText.result;
+							if ((result.power && result.power != playerStatus.power) ||
+								(result.mode && result.mode != playerStatus.mode) ||
+								(result.current_title && result.current_title != playerStatus.title) ||
+								(result.playlist_tracks > 0 && result.playlist_loop[0].url != playerStatus.track))
+							{
+								
+								Ext.Ajax.request({
+									method: 'POST',
+									url: '/jsonrpc.js', 
+									timeout: 4000,
+//									failure: this.updateStatus,
+//									success: this.updateStatus,
+
+									failure: function(response){
+										this.updateStatus(response);
+									},
+
+									success: function(response){
+										this.updateStatus(response);
+									},
+
+									params: Ext.util.JSON.encode({
+										id: 1, 
+										method: "slim.request", 
+										params: [ 
+											playerid,
+											[ 
+												"status",
+												"-",
+												1,
+												"tags:gabehldiqtyru"
+											]
+										]
+									}),
+									scope: this
+								});
+							}
+						}
+					}
+				},
+				
+				scope: this
+			});
+			
+			pollTimer.delay(5000);
 		}
+
 	};   
 }();
 Ext.EventManager.onDocumentReady(Main.init, Main, true);

Modified: trunk/server/HTML/Maestro/index.html
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/index.html?rev=12575&r1=12574&r2=12575&view=diff
==============================================================================
--- trunk/server/HTML/Maestro/index.html (original)
+++ trunk/server/HTML/Maestro/index.html Thu Aug 16 07:38:32 2007
@@ -7,12 +7,10 @@
 		<link rel="stylesheet" type="text/css" href="/html/ext/resources/css/ext-all.css" />
 		<link rel="stylesheet" type="text/css" href="[% webroot %]slim-ext.css" />
 		<link rel="stylesheet" type="text/css" href="[% webroot %]slimserver.css" />
+
 		<script type="text/javascript" src="/html/ext/adapter/ext/ext-base.js"></script>
 		<script type="text/javascript" src="/html/ext/ext-all.js"></script>
-
-		<script type="text/javascript">
-			var strings = new Array();
-		</script>
+		<script TYPE="text/javascript">[% PROCESS html/vars.js %]</script>		
 
 		<style>
 			html, body {
@@ -35,6 +33,11 @@
 				border: 0;
 				scroll
 			}
+
+			.section_header { color: #fff; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; padding-left: 6px; }
+			.selector { color: #333; font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; line-height: 16px; padding-left: 6px; }
+			.current_track { color: white; font-size: 10px; font-family: Arial, Verdana, Helvetica, sans-serif; padding-left: 4px; }
+			.current_track_exp { color: white; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif; padding-left: 6px; }
 		</style>
 
 		<script type="text/javascript" src="[% webroot %]html/index.js"></script>
@@ -109,23 +112,23 @@
 												<td colspan="4">
 													<table width="100%" border="0" cellspacing="0" cellpadding="0">
 														<tr>
-															<td rowspan="6" width="96"><img src="[% webroot %]music/0/cover_96x96.jpg" alt="" height="96" width="96" border="0" /></td>
-															<td class="section_header">Current Track</td>
+															<td rowspan="6" width="96" id="ctrlCurrentArt"><img src="[% webroot %]music/0/cover_96x96.jpg" alt="" height="96" width="96" border="0" /></td>
+															<td class="section_header" id="ctrlCurrentTitle"></td>
 														</tr>
 														<tr>
 															<td><img src="[% webroot %]html/images/spacer.gif" alt="" height="12" width="12" border="0" /></td>
 														</tr>
 														<tr>
-															<td class="current_track_exp">Song: Gasoline</td>
+															<td class="current_track_exp">[% "ARTIST" | string %][% "COLON" | string %] <span id="ctrlCurrentArtist">Audioslave</span></td>
 														</tr>
 														<tr>
-															<td class="current_track_exp">Artist: Audioslave</td>
+															<td class="current_track_exp">[% "ALBUM" | string %][% "COLON" | string %] <span id="ctrlCurrentAlbum">Audioslave</span></td>
 														</tr>
 														<tr>
-															<td class="current_track_exp">Album: Audioslave</td>
+															<td class="current_track_exp" id="ctrlPlaytime"><!-- 4:32 -->&nbsp;</td>
 														</tr>
 														<tr>
-															<td class="current_track_exp">4:32</td>
+															<td class="current_track_exp"><!-- [% "SONG" | string %][% "COLON" | string %] <span id="ctrlCurrentSong">Gasoline</span> -->&nbsp;</td>
 														</tr>
 													</table>
 												</td>

Modified: trunk/server/HTML/Maestro/pageheader.html
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/pageheader.html?rev=12575&r1=12574&r2=12575&view=diff
==============================================================================
--- trunk/server/HTML/Maestro/pageheader.html (original)
+++ trunk/server/HTML/Maestro/pageheader.html Thu Aug 16 07:38:32 2007
@@ -7,6 +7,7 @@
 		[% IF maestroScripts %]
 			<script type="text/javascript" src="/html/ext/adapter/ext/ext-base.js"></script>
 			<script type="text/javascript" src="/html/ext/ext-all.js"></script>
+			<script TYPE="text/javascript">[% PROCESS html/vars.js %]</script>
 
 			<script type="text/javascript">
 				var Tools = function(){



More information about the checkins mailing list