📄 displaymusiclyrics.jsp
字号:
<%@page contentType="text/html;charset=ISO-8859-15" pageEncoding="ISO-8859-1"%>
<%@page import="org.homeplayer.util.*"%>
<%@page import="org.homeplayer.data.*"%>
<%@page import="org.homeplayer.util.lyrics.*"%>
<%@page import="java.io.*"%>
<%@page import="java.net.*"%>
<jsp:useBean id="hppc" class="org.homeplayer.web.HPPageContext" scope="request">
<jsp:setProperty name="hppc" property="request" value="<%=request%>"/>
</jsp:useBean>
<%
final int SCREEN_WIDTH = 590;
hppc.setRequest(request);
hppc.setStopLink("/action.jsp?next=" + WebUtil.urlEncode(hppc.getUpUrl())+"&control=stop");
hppc.setPauseLink("/action.jsp?next=" + WebUtil.urlEncode("info.jsp?link=A") + "&control=pause");
hppc.setVolumeKeyEnabled(true);
hppc.setYellowLink(WebUtil.setParam("/musicslideshow.jsp","refreshed=true"));
int numPage = WebUtil.getParam(request, "page", 1);
VLCControl vlc = VLCControl.shareInstance();
VLCInfo vlcInfo = vlc.getInfo();
if( vlcInfo != null && vlcInfo.getState().equals(VLCInfo.STATE_STOP)) {
hppc.setRefresh(0, hppc.getUpUrl() ) ;
%>
<jsp:forward page="/WEB-INF/jsp/empty.jsp" />
<%
return ;
}
if (vlcInfo.getCurrentPlayList() != null) {
String thisurl = WebUtil.urlEncode(hppc.getLocalURL());
thisurl = WebUtil.removeParam(thisurl, "refreshed");
hppc.setPreviousPageUrl("/action.jsp?next=" + thisurl + "&control=previous");
hppc.setNextPageUrl("/action.jsp?next=" + thisurl + "&control=next");
}
request.setAttribute("vlcInfo", vlcInfo);
MediaItem media = vlcInfo.getCurrentMedia();
Music music = null;
if(media instanceof Music) {
music = (Music)media;
} else if(media instanceof WEBRadio) {
music = ((WEBRadio)media).getCurrentMusic() ;
}
MediaItem mi = (MediaItem) HPSession.get("MUSICSLIDESHOW_LAST_MEDIA");
if(mi!=null && music!=null && !media.equals(mi)) {
request.getRequestDispatcher("/musicslideshow.jsp?level=2").forward(request, response);
return;
}
music = music==null ? mi instanceof Music ? (Music)mi : null : music ;
//current URL
String currentUrl = hppc.getLocalURL();
HPSession.set("PLAY_URL", currentUrl);
//pause?
boolean pause = WebUtil.getParam(request, "pause", false);
if (pause) {
String unPausedUrl = WebUtil.removeParam(currentUrl, "pause");
hppc.setPauseLink(unPausedUrl);
} else {
String pausedUrl = WebUtil.addParam(currentUrl, "pause=true");
// set the pause link only if it has not been set before
if (hppc.getLinks().get("pause") == null) {
hppc.setPauseLink(pausedUrl);
}
}
if (request.getAttribute("vlcInfo") == null) {
hppc.setStopLink(hppc.getUpUrl());
}
hppc.setRefresh(5, currentUrl);
if(music!=null ) {
LyricsSourceFromLocalFile lsflf = new LyricsSourceFromLocalFile(music);
String lyrics = lsflf.getLyrics();
if(!lyrics.equals("")) {
LyricsFormatForWeb lw = new LyricsFormatForWeb(lyrics, numPage, 1, 15);
if(lw.hasPreviousPage()) {
hppc.setProgrammUpLink("/media/displayMusicLyrics.jsp?page="+(numPage-1));
}
if(lw.hasNextPage()) {
hppc.setProgrammDownLink("/media/displayMusicLyrics.jsp?page="+(numPage+1));
}
%>
<html>
<head><jsp:include page="/WEB-INF/jsp/head.jsp" /></head>
<body background="ts://127.0.0.1?ox=0&oy=0&ow=1&oh=1">
<jsp:include page="skins/default/exttoppage.jsp"/>
<table align="center" width="<%= SCREEN_WIDTH-20%>">
<tr> <%-- on affiche le nom de l'artiste --%>
<td height="5">
<img width="1" height="1" src="/images/blanck.gif">
</td>
</tr>
<tr>
<td align="center" colspan="2">
<table border="2" cellpadding="3" cellspacing="0">
<tr>
<td align="center" bgcolor="<%= hppc.color("#88888833") %>">
<%
String pageTitle = music.getArtist()+" - "+music.getAlbum()+ " - "+music.getTitle();
String size = "0";
if(pageTitle.length()>45) {
size = "+1";
}
%>
<font size="<%= size%>"><%= pageTitle %></font>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%= lw.getFormattedString("+1")%>
<table align="center" width="<%= SCREEN_WIDTH-20%>">
<tr>
<td>
<img src="/images/yellowbutton.gif" /> Revenir au slideshow <!-- width="16" height="16" -->
</td>
<td>
<%
if(lw.hasPreviousPage()) {
%>
<img src="/images/ArrowUp.gif" /> Page pr閏閐ente <!-- width="24" height="24" -->
<%
} else {
%>
<%
}
%>
</td>
<td>
<%
if(lw.hasNextPage()) {
%>
<img src="/images/ArrowDown.gif" /> Page suivante <!-- width="24" height="24" -->
<%
} else {
%>
<%
}
%>
</td>
</tr>
</table>
</body>
</html>
<%
}
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -