[Slim-Checkins] r12590 - in /trunk/server/HTML/Maestro: browsedb.html html/main.js pageheader.html status_header.html xmlbrowser.html
mherger at svn.slimdevices.com
mherger at svn.slimdevices.com
Fri Aug 17 08:41:08 PDT 2007
Author: mherger
Date: Fri Aug 17 08:41:08 2007
New Revision: 12590
URL: http://svn.slimdevices.com?rev=12590&view=rev
Log:
Bug: n/a
Description: some more player control panel updates (volume, bitrate, playtime...)
Modified:
trunk/server/HTML/Maestro/browsedb.html
trunk/server/HTML/Maestro/html/main.js
trunk/server/HTML/Maestro/pageheader.html
trunk/server/HTML/Maestro/status_header.html
trunk/server/HTML/Maestro/xmlbrowser.html
Modified: trunk/server/HTML/Maestro/browsedb.html
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/browsedb.html?rev=12590&r1=12589&r2=12590&view=diff
==============================================================================
--- trunk/server/HTML/Maestro/browsedb.html (original)
+++ trunk/server/HTML/Maestro/browsedb.html Fri Aug 17 08:41:08 2007
@@ -5,7 +5,7 @@
[% pagetitle = browseby | string; pageicon = browseby; noSpacer = 1 %]
[% maestroScripts = BLOCK %]
- <script type="text/javascript" src="[% webroot %]html/browse.js"></script>
+ <script type="text/javascript" src="[% webroot %]html/browse.js"></script>
[% END %]
[% PROCESS pageheader.html %]
Modified: trunk/server/HTML/Maestro/html/main.js
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/html/main.js?rev=12590&r1=12589&r2=12590&view=diff
==============================================================================
--- trunk/server/HTML/Maestro/html/main.js (original)
+++ trunk/server/HTML/Maestro/html/main.js Fri Aug 17 08:41:08 2007
@@ -53,6 +53,8 @@
Player = function(){
var pollTimer;
+ var playTimeTimer;
+ var playTime = 0;
var playerStatus = {
power: null,
@@ -68,8 +70,47 @@
Ext.Ajax.url = '/jsonrpc.js';
Ext.Ajax.timeout = 4000;
- pollTimer = new Ext.util.DelayedTask(Player.getStatus, this);
+// TODO: set volume when clicking on volume bar - broken in FF&Safari, getting negative values :-(
+/* Ext.get('ctrlVolume').on('click', function(ev, target){
+ if (el = Ext.get(target)) {
+ x = el.getX();
+ x = Ext.fly(target).getX();
+ x = 100 * (ev.getPageX() - el.getX()) / el.getWidth();
+ alert(x);
+ }
+ });
+*/
+ pollTimer = new Ext.util.DelayedTask(this.getStatus, this);
+ playTimeTimer = new Ext.util.DelayedTask(this.updatePlayTime, this);
this.getStatus();
+ },
+
+ updatePlayTime : function(time, totalTime){
+ if (playerStatus.mode == 'play') {
+ if (! isNaN(time))
+ playTime = time;
+
+ if (! isNaN(totalTime))
+ Ext.get('ctrlTotalTime').update(' (' + this.formatTime(totalTime) + ')');
+
+ Ext.get('ctrlPlaytime').update(this.formatTime(playTime));
+ playTime += 0.5;
+ }
+ else
+ Ext.get('ctrlPlaytime').update(this.formatTime(0));
+
+ playTimeTimer.delay(500);
+ },
+
+ formatTime : function(seconds){
+ hours = Math.floor(seconds / 3600);
+ minutes = Math.floor((seconds - hours*3600) / 60);
+ seconds = Math.floor(seconds % 60);
+
+ formattedTime = (hours ? hours + ':' : '');
+ formattedTime += (minutes ? (minutes < 10 && hours ? '0' : '') + minutes : '0') + ':';
+ formattedTime += (seconds ? (seconds < 10 ? '0' : '') + seconds : '00');
+ return formattedTime;
},
updateStatus : function(response) {
@@ -82,29 +123,40 @@
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
+ result.current_title ? result.current_title : (
+ (result.playlist_loop[0].disc ? result.playlist_loop[0].disc + '-' : '')
+ + 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('ctrlBitrate').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();
-*/
+ Ext.get('ctrlCurrentAlbum').update(
+ result.playlist_loop[0].album
+ + (result.playlist_loop[0].year ? ' (' + result.playlist_loop[0].year +')' : '')
+ );
+
+ this.updatePlayTime(result.time ? result.time : 0, result.duration ? result.duration : 0);
+
if (result.playlist_loop[0].id) {
Ext.get('ctrlCurrentArt').update('<img src="/music/' + result.playlist_loop[0].id + '/cover_96x96.jpg">');
}
-
- modeImg = '<img src="' + webroot + 'html/images/' + (result.mode=='play' ? 'btn_pause_normal.png' : 'btn_pause_normal.png') + '">';
- el = Ext.get('ctrlMode');
- el.update(modeImg);
+
+ // update play/pause button
Ext.get('ctrlMode').update('<img src="' + webroot + 'html/images/' + (result.mode=='play' ? 'btn_play_normal.png' : 'btn_pause_normal.png') + '">');
+
+ // update volume button
+ volumeIcon = 'level_5';
+ if (result['mixer volume'] <= 0)
+ volumeIcon = 'level_0';
+ else if (result['mixer volume'] >= 100)
+ volumeIcon = 'level_11';
+ else {
+ volVal = Math.ceil(result['mixer volume']/9.9);
+ volumeIcon = 'level_' + volVal;
+ }
+ Ext.get('ctrlVolume').update('<img src="' + webroot + 'html/images/' + volumeIcon + '.png">');
playerStatus = {
power: result.power,
@@ -114,21 +166,7 @@
volume: result['mixer volume']
};
}
-
-/* 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);
},
@@ -188,6 +226,12 @@
{
this.getUpdate();
}
+
+ else if (result['mixer volume'] && result['mixer volume'] != playerStatus.volume) {
+ this.updateStatus(response)
+ }
+ else
+ this.updatePlayTime(result.time, result.duration);
}
}
},
@@ -224,6 +268,10 @@
openPlayerControl : function(){
window.open(webroot + 'status_header.html', "gaasd", "width=500,height=165");
- }
+ },
+
+ // values could be adjusted if not enough
+ volumeUp : function(){ this.playerControl(['mixer', 'volume', '+2.5']) },
+ volumeDown : function(){ this.playerControl(['mixer', 'volume', '-2.5']) }
}
}();
Modified: trunk/server/HTML/Maestro/pageheader.html
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/pageheader.html?rev=12590&r1=12589&r2=12590&view=diff
==============================================================================
--- trunk/server/HTML/Maestro/pageheader.html (original)
+++ trunk/server/HTML/Maestro/pageheader.html Fri Aug 17 08:41:08 2007
@@ -8,13 +8,6 @@
<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(){
- return {
- }
- }();
- </script>
[% maestroScripts %]
[% END %]
Modified: trunk/server/HTML/Maestro/status_header.html
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/status_header.html?rev=12590&r1=12589&r2=12590&view=diff
==============================================================================
--- trunk/server/HTML/Maestro/status_header.html (original)
+++ trunk/server/HTML/Maestro/status_header.html Fri Aug 17 08:41:08 2007
@@ -54,11 +54,11 @@
<td align="right">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
- <td><img src="[% webroot %]html/images/btn_volume_low_normal.png" alt="" height="22" width="22" border="0" /></td>
+ <td onclick="Player.volumeDown();"><img src="[% webroot %]html/images/btn_volume_low_normal.png" alt="" height="22" width="22" border="0" /></td>
<td><img src="[% webroot %]html/images/spacer.gif" alt="" height="10" width="5" border="0" /></td>
- <td><img src="[% webroot %]html/images/level_5.png" alt="" height="22" width="57" border="0" /></td>
+ <td id="ctrlVolume"><img src="[% webroot %]html/images/level_5.png" alt="" height="22" width="57" border="0" /></td>
<td><img src="[% webroot %]html/images/spacer.gif" alt="" height="10" width="5" border="0" /></td>
- <td><img src="[% webroot %]html/images/btn_volume_hi_normal.png" alt="" height="22" width="22" border="0" /></td>
+ <td onclick="Player.volumeUp();"><img src="[% webroot %]html/images/btn_volume_hi_normal.png" alt="" height="22" width="22" border="0" /></td>
</tr>
</table>
</td>
@@ -82,16 +82,16 @@
<td><img src="[% webroot %]html/images/spacer.gif" alt="" height="12" width="12" border="0" /></td>
</tr>
<tr>
- <td class="current_track_exp">[% "ARTIST" | string %][% "COLON" | string %] <span id="ctrlCurrentArtist"> </span></td>
+ <td class="current_track_exp">[% "ARTIST" | string %][% "COLON" | string %] <span id="ctrlCurrentArtist"></span></td>
</tr>
<tr>
- <td class="current_track_exp">[% "ALBUM" | string %][% "COLON" | string %] <span id="ctrlCurrentAlbum"> </span></td>
+ <td class="current_track_exp">[% "ALBUM" | string %][% "COLON" | string %] <span id="ctrlCurrentAlbum"></span></td>
</tr>
<tr>
- <td class="current_track_exp" id="ctrlPlaytime"><!-- 4:32 --> </td>
+ <td class="current_track_exp"><span id="ctrlPlaytime"></span><span id="ctrlTotalTime"></span></td>
</tr>
<tr>
- <td class="current_track_exp"><!-- [% "SONG" | string %][% "COLON" | string %] <span id="ctrlCurrentSong">Gasoline</span> --> </td>
+ <td class="current_track_exp">[% "BITRATE" | string %][% "COLON" | string %] <span id="ctrlBitrate"></span></td>
</tr>
</table>
</td>
Modified: trunk/server/HTML/Maestro/xmlbrowser.html
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/xmlbrowser.html?rev=12590&r1=12589&r2=12590&view=diff
==============================================================================
--- trunk/server/HTML/Maestro/xmlbrowser.html (original)
+++ trunk/server/HTML/Maestro/xmlbrowser.html Fri Aug 17 08:41:08 2007
@@ -1,5 +1,5 @@
[% maestroScripts = BLOCK %]
- <script type="text/javascript" src="[% webroot %]html/browse.js"></script>
+ <script type="text/javascript" src="[% webroot %]html/browse.js"></script>
[% END %]
[% IF query %]
More information about the checkins
mailing list