Commit fc1227e4 authored by Francois Cartegnie's avatar Francois Cartegnie

web intf: display art correctly

parent 1ad23782
...@@ -59,7 +59,7 @@ body{ ...@@ -59,7 +59,7 @@ body{
} }
#controlTable{ #controlTable{
position:relative; position:relative;
height: 140px; height: 150px;
} }
#controlButtons{ #controlButtons{
position: absolute; position: absolute;
...@@ -87,19 +87,20 @@ body{ ...@@ -87,19 +87,20 @@ body{
#volumesliderzone{ #volumesliderzone{
position: absolute; position: absolute;
top: 20px; top: 20px;
left: 440px; left: 435px;
width: 205px; width: 210px;
} }
#volumeSlider{ #volumeSlider{
width: 200px; width: 208px;
} }
#artszone{ #artszone{
position: absolute; position: absolute;
top: 0; top: 0;
left: 650px; left: 648px;
width: 141px; width: 150px;
height: 150px;
vertical-align: top; vertical-align: top;
} }
...@@ -107,7 +108,7 @@ body{ ...@@ -107,7 +108,7 @@ body{
position:absolute; position:absolute;
left: 0; left: 0;
top: 100px; top: 100px;
width: 650px; width: 645px;
vertical-align: bottom; vertical-align: bottom;
} }
...@@ -208,3 +209,8 @@ div.centered{ ...@@ -208,3 +209,8 @@ div.centered{
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
.hidden{
visibility: hidden;
display: none;
}
var current_id = 1; var current_id = 1;
var currentArt = null; var currentArt = null;
var current_que = 'main'; var current_que = 'main';
function updateArt(url)
{
$('#albumArt').fadeOut(500, function(){
$(this).addClass('hidden')
.removeAttr('height')
.removeAttr('width')
.attr('src',url);
});
}
function updateStatus(){ function updateStatus(){
$.ajax({ $.ajax({
url: 'requests/status.xml', url: 'requests/status.xml',
...@@ -50,16 +59,18 @@ function updateStatus(){ ...@@ -50,16 +59,18 @@ function updateStatus(){
$('#buttonRepeat').addClass('ui-state-default'); $('#buttonRepeat').addClass('ui-state-default');
$('#buttonRepeat').removeClass('ui-state-active'); $('#buttonRepeat').removeClass('ui-state-active');
} }
if($('[name="artwork_url"]',data).text()!=currentArt){
if($('[name="artwork_url"]',data).text()!=currentArt
&& $('[name="artwork_url"]',data).text()!="")
{
var tmp = new Date(); var tmp = new Date();
$('#albumArt').attr('src','/art?'+tmp.getTime());
currentArt = $('[name="artwork_url"]',data).text(); currentArt = $('[name="artwork_url"]',data).text();
$('#albumArt').css({ updateArt('/art?'+tmp.getTime());
'visibility':'visible', }else if($('[name="artwork_url"]',data).text()==""
'display':'block' && currentArt!='images/vlc-48.png')
}); {
}else if($('[name="artwork_url"]',data).text()==""){ currentArt='images/vlc-48.png';
$('#albumArt').attr('src','images/vlc-48.png'); updateArt(currentArt);
} }
if(pollStatus){ if(pollStatus){
setTimeout( updateStatus, 1000 ); setTimeout( updateStatus, 1000 );
...@@ -422,6 +433,23 @@ function sendEQCmd(params){ ...@@ -422,6 +433,23 @@ function sendEQCmd(params){
} }
$(function(){ $(function(){
$('#albumArt').load(function(){
var width=$(this).width();
var height=$(this).height();
var max=Math.max(width,height);
if(max>150)
{
var ratio=150/max;
width=Math.floor(width*ratio);
height=Math.floor(height*ratio);
}
$(this).attr('width',width)
.attr('height',height)
.css('margin-left', Math.floor((150 - width)/2))
.css('margin-top', Math.floor((150 - height)/2))
.removeClass('hidden')
.fadeIn();
});
$('#libraryTree').jstree({ $('#libraryTree').jstree({
"xml_data":{ "xml_data":{
"ajax":{ "ajax":{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment