$(document).ready(function() { RefreshTitlesvelvetfm(); }); function addTimeStamp(){ tstmp = new Date(); return tstmp.getTime(); } function RefreshTitlesvelvetfm() { $.ajax({ type: "GET", url: "/whatson/velvetfm/NowOnAir.xml?timestamp="+addTimeStamp(), dataType: "xml", success: ShowTitleArtistvelvetfm }); //alert("/whatson_remote/updateartistpic.asp?timestamp="+addTimeStamp()+"&q="+qArtist); $.ajax({ type: "GET", url: "/whatson/velvetfm/AirPlayNext.xml?timestamp="+addTimeStamp(), dataType: "xml", success: ShowNextSongsvelvetfm }); $.ajax({ type: "GET", url: "/whatson/velvetfm/AirPlayHistory.xml?timestamp="+addTimeStamp(), dataType: "xml", success: ShowLastSongsvelvetfm }); } function ShowTitleArtistvelvetfm(xml) { $(xml).find("Song").each(function() { qTitle = $(this).attr("title"); $("#velvetfm_title").html($(this).attr("title")); $(xml).find("Artist").each(function() { $("#velvetfm_artist").html($(this).attr("name")); qArtist = $(this).attr("name"); $.ajax({ type: "GET", url: "/whatson_remote/updatetrackpic.asp?timestamp="+addTimeStamp()+"&t="+qTitle+"&a="+qArtist, dataType: "text", success: ShowNowPicvelvetfm }); }); }); } function ShowNowPicvelvetfm(txt) { if (txt!=''){ $("#velvetfm_pic").attr("src",txt); $("#velvetfm_pic").show(); } else{ $("#velvetfm_pic").attr("src",''); $("#velvetfm_pic").hide(); } } function ShowLastSongsvelvetfm(xml) { var tmpLastSongs=""; $(xml).find("Song").each(function() { tmpLastSongs = tmpLastSongs + $(this).find("Info").attr("StartTime")+ " > "; tmpLastSongs = tmpLastSongs +"" + $(this).attr("title") + " >"; tmpLastSongs = tmpLastSongs + $(this).find("Artist").attr("name")+ "
"; }); $("#velvetfm_lastsongs").html(tmpLastSongs); } function ShowNextSongsvelvetfm(xml) { var j=0; $(xml).find("Song").each(function() { if (j==0 ){ $("#velvetfm_nexttitle").html( $(this).attr("title") ); $("#velvetfm_nextartist").html( $(this).find("Artist").attr("name") ); } j=j+1; $("#nextheader").show(); }); } var oRefreshvelvetfm; oRefreshvelvetfm = window.setInterval("RefreshTitlesvelvetfm()", 50000);