Conflicts: libresonic-main/pom.xml libresonic-main/src/main/java/org/libresonic/player/controller/ChangeCoverArtController.java libresonic-main/src/main/java/org/libresonic/player/controller/DLNASettingsController.java libresonic-main/src/main/java/org/libresonic/player/controller/InternetRadioSettingsController.java libresonic-main/src/main/java/org/libresonic/player/controller/PlayQueueController.java libresonic-main/src/main/java/org/libresonic/player/controller/RightController.java libresonic-main/src/main/java/org/libresonic/player/controller/ShareManagementController.java libresonic-main/src/main/java/org/libresonic/player/controller/ShareSettingsController.java libresonic-main/src/main/java/org/libresonic/player/controller/SonosSettingsController.java libresonic-main/src/main/java/org/libresonic/player/controller/TranscodingSettingsController.java libresonic-main/src/main/webapp/WEB-INF/libresonic-servlet.xml pom.xmlmaster
commit
e5dc517fa1
@ -0,0 +1,69 @@ |
||||
/* |
||||
* This file is part of Libresonic. |
||||
* |
||||
* Libresonic is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* Libresonic is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
|
||||
* |
||||
* Copyright 2016 (C) Libresonic Authors |
||||
* Based upon Subsonic, Copyright 2009 (C) Sindre Mehus |
||||
*/ |
||||
|
||||
package org.libresonic.player.domain; |
||||
|
||||
/** |
||||
* @author Sindre Mehus |
||||
* @version $Id$ |
||||
*/ |
||||
public class AlbumNotes { |
||||
|
||||
private final String notes; |
||||
private final String musicBrainzId; |
||||
private final String lastFmUrl; |
||||
private final String smallImageUrl; |
||||
private final String mediumImageUrl; |
||||
private final String largeImageUrl; |
||||
|
||||
public AlbumNotes(String notes, String musicBrainzId, String lastFmUrl, String smallImageUrl, |
||||
String mediumImageUrl, String largeImageUrl) { |
||||
this.notes = notes; |
||||
this.musicBrainzId = musicBrainzId; |
||||
this.lastFmUrl = lastFmUrl; |
||||
this.smallImageUrl = smallImageUrl; |
||||
this.mediumImageUrl = mediumImageUrl; |
||||
this.largeImageUrl = largeImageUrl; |
||||
} |
||||
|
||||
public String getNotes() { |
||||
return notes; |
||||
} |
||||
|
||||
public String getMusicBrainzId() { |
||||
return musicBrainzId; |
||||
} |
||||
|
||||
public String getLastFmUrl() { |
||||
return lastFmUrl; |
||||
} |
||||
|
||||
public String getSmallImageUrl() { |
||||
return smallImageUrl; |
||||
} |
||||
|
||||
public String getMediumImageUrl() { |
||||
return mediumImageUrl; |
||||
} |
||||
|
||||
public String getLargeImageUrl() { |
||||
return largeImageUrl; |
||||
} |
||||
} |
@ -0,0 +1,50 @@ |
||||
/* |
||||
* This file is part of Libresonic. |
||||
* |
||||
* Libresonic is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* Libresonic is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
|
||||
* |
||||
* Copyright 2014 (C) Sindre Mehus |
||||
*/ |
||||
|
||||
package org.libresonic.player.domain; |
||||
|
||||
/** |
||||
* @author Sindre Mehus |
||||
* @version $Id$ |
||||
*/ |
||||
public class LastFmCoverArt { |
||||
|
||||
private final String imageUrl; |
||||
private final String artist; |
||||
private final String album; |
||||
|
||||
public LastFmCoverArt(String imageUrl, String artist, String album) { |
||||
this.imageUrl = imageUrl; |
||||
this.artist = artist; |
||||
this.album = album; |
||||
} |
||||
|
||||
public String getImageUrl() { |
||||
return imageUrl; |
||||
} |
||||
|
||||
public String getArtist() { |
||||
return artist; |
||||
} |
||||
|
||||
public String getAlbum() { |
||||
return album; |
||||
} |
||||
} |
||||
|
@ -1,89 +0,0 @@ |
||||
/* |
||||
This file is part of Libresonic. |
||||
|
||||
Libresonic is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
Libresonic is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2016 (C) Libresonic Authors |
||||
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus |
||||
*/ |
||||
package org.libresonic.player.domain; |
||||
|
||||
import java.util.Date; |
||||
|
||||
import org.apache.commons.lang.StringUtils; |
||||
|
||||
import org.libresonic.player.service.SettingsService; |
||||
|
||||
/** |
||||
* Controller for the "Podcast receiver" page. |
||||
* |
||||
* @author Sindre Mehus |
||||
*/ |
||||
public class LicenseInfo { |
||||
|
||||
private String licenseEmail; |
||||
private boolean licenseValid; |
||||
private final Date trialExpires; |
||||
private long trialDaysLeft; |
||||
private final Date licenseExpires; |
||||
|
||||
public LicenseInfo(String licenseEmail, boolean licenseValid, Date trialExpires, |
||||
long trialDaysLeft, Date licenseExpires) { |
||||
this.licenseEmail = licenseEmail; |
||||
this.licenseValid = licenseValid; |
||||
this.trialExpires = trialExpires; |
||||
this.trialDaysLeft = trialDaysLeft; |
||||
this.licenseExpires = licenseExpires; |
||||
} |
||||
|
||||
public String getLicenseEmail() { |
||||
return licenseEmail; |
||||
} |
||||
|
||||
public void setLicenseEmail(String licenseEmail) { |
||||
this.licenseEmail = StringUtils.trimToNull(licenseEmail); |
||||
} |
||||
|
||||
public boolean isLicenseValid() { |
||||
return licenseValid; |
||||
} |
||||
|
||||
public void setLicenseValid(boolean licenseValid) { |
||||
this.licenseValid = licenseValid; |
||||
} |
||||
|
||||
public boolean isTrial() { |
||||
return trialExpires != null && !licenseValid; |
||||
} |
||||
|
||||
public boolean isTrialExpired() { |
||||
return trialExpires != null && (trialExpires.before(new Date()) || trialDaysLeft > SettingsService.TRIAL_DAYS + 1); |
||||
} |
||||
|
||||
public boolean isLicenseOrTrialValid() { |
||||
return isLicenseValid() || !isTrialExpired(); |
||||
} |
||||
|
||||
public Date getTrialExpires() { |
||||
return trialExpires; |
||||
} |
||||
|
||||
public long getTrialDaysLeft() { |
||||
return trialDaysLeft; |
||||
} |
||||
|
||||
public Date getLicenseExpires() { |
||||
return licenseExpires; |
||||
} |
||||
} |
@ -0,0 +1,49 @@ |
||||
/** |
||||
* This file is part of Libresonic. |
||||
* |
||||
* Libresonic is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* Libresonic is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
|
||||
* |
||||
* Copyright 2014 (C) Sindre Mehus |
||||
*/ |
||||
|
||||
package org.libresonic.player.service; |
||||
|
||||
import java.util.LinkedHashMap; |
||||
import java.util.Map; |
||||
|
||||
import de.umass.lastfm.cache.ExpirationPolicy; |
||||
|
||||
/** |
||||
* Artist and album info is cached permanently. Everything else is cached one year. |
||||
* |
||||
* @author Sindre Mehus |
||||
* @version $Id$ |
||||
*/ |
||||
public class LastFmExpirationPolicy implements ExpirationPolicy { |
||||
|
||||
private final static long ONE_YEAR = 12 * 30 * 24 * 3600 * 1000L; |
||||
|
||||
private final Map<String, Long> methodToExpirationTime = new LinkedHashMap<String, Long>() {{ |
||||
put("artist.getInfo", Long.MAX_VALUE); // Cache forever
|
||||
put("album.getInfo", Long.MAX_VALUE); // Cache forever
|
||||
put("album.search", -1L); // Don't cache
|
||||
}}; |
||||
|
||||
@Override |
||||
public long getExpirationTime(String method, Map<String, String> params) { |
||||
Long expirationTime = methodToExpirationTime.get(method); |
||||
return expirationTime == null ? ONE_YEAR : expirationTime; |
||||
} |
||||
} |
||||
|
@ -0,0 +1,26 @@ |
||||
package org.libresonic.player.spring; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import org.libresonic.player.Logger; |
||||
import org.springframework.core.Ordered; |
||||
import org.springframework.web.servlet.HandlerExceptionResolver; |
||||
import org.springframework.web.servlet.ModelAndView; |
||||
|
||||
public class LoggingExceptionResolver implements HandlerExceptionResolver, Ordered { |
||||
|
||||
private static final Logger logger = Logger.getLogger(LoggingExceptionResolver.class); |
||||
|
||||
@Override |
||||
public ModelAndView resolveException( |
||||
HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e |
||||
) { |
||||
logger.error("Exception occurred", e); |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public int getOrder() { |
||||
return Integer.MIN_VALUE; |
||||
} |
||||
} |
@ -1,93 +0,0 @@ |
||||
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="iso-8859-1" %> |
||||
<%--@elvariable id="command" type="org.libresonic.player.command.PremiumSettingsCommand"--%> |
||||
<html> |
||||
<head> |
||||
<%@ include file="head.jsp" %> |
||||
<%@ include file="jquery.jsp" %> |
||||
</head> |
||||
<body class="mainframe bgcolor1"> |
||||
|
||||
<c:import url="settingsHeader.jsp"> |
||||
<c:param name="cat" value="premium"/> |
||||
<c:param name="restricted" value="${not command.user.adminRole}"/> |
||||
<c:param name="toast" value="${command.toast}"/> |
||||
</c:import> |
||||
|
||||
<c:if test="${not empty command.path}"> |
||||
<sub:url value="main.view" var="backUrl"> |
||||
<sub:param name="path" value="${command.path}"/> |
||||
</sub:url> |
||||
<div class="back"><a href="${backUrl}"> |
||||
<fmt:message key="common.back"/> |
||||
</a></div> |
||||
<br/> |
||||
</c:if> |
||||
|
||||
<div style="width:50em; max-width:50em"> |
||||
|
||||
<fmt:message key="premium.text"/> |
||||
<fmt:formatDate value="${command.licenseInfo.licenseExpires}" dateStyle="long" var="expirationDate"/> |
||||
|
||||
<c:if test="${command.licenseInfo.licenseValid}"> |
||||
<c:choose> |
||||
<c:when test="${empty command.licenseInfo.licenseExpires}"> |
||||
<p><b><fmt:message key="premium.licensed"/></b></p> |
||||
</c:when> |
||||
<c:otherwise> |
||||
<p><b><fmt:message key="premium.licensedexpires"><fmt:param value="${expirationDate}"/></fmt:message></b></p> |
||||
</c:otherwise> |
||||
</c:choose> |
||||
<c:if test="${not command.forceChange and not command.submissionError}"> |
||||
<p> |
||||
<fmt:message key="premium.licensedto"><fmt:param value="${command.licenseInfo.licenseEmail}"/></fmt:message> |
||||
</p> |
||||
<c:if test="${command.user.adminRole}"> |
||||
<div class="forward"><a href="premiumSettings.view?change"><fmt:message key="premium.forcechange"/></a></div> |
||||
</c:if> |
||||
</c:if> |
||||
</c:if> |
||||
|
||||
<c:if test="${not command.licenseInfo.licenseValid}"> |
||||
<c:if test="${not empty command.licenseInfo.licenseExpires}"> |
||||
<p><b><fmt:message key="premium.licensedexpired"><fmt:param value="${expirationDate}"/></fmt:message></b></p> |
||||
</c:if> |
||||
<p class="forward" style="font-size:1.2em;margin-left: 1em"><b><a href="http://libresonic.org/pages/premium.jsp" target="_blank"> |
||||
<fmt:message key="premium.getpremium"/> |
||||
<c:if test="${command.licenseInfo.trialDaysLeft gt 0}"> |
||||
– <fmt:message key="top.trialdaysleft"><fmt:param value="${command.licenseInfo.trialDaysLeft}"/></fmt:message> |
||||
</c:if> |
||||
</a></b></p> |
||||
|
||||
<p><fmt:message key="premium.register"/></p> |
||||
</c:if> |
||||
|
||||
<c:if test="${not command.licenseInfo.licenseValid or command.forceChange or command.submissionError}"> |
||||
<form:form commandName="command" method="post" action="premiumSettings.view"> |
||||
<form:hidden path="path"/> |
||||
<table> |
||||
<tr> |
||||
<td><fmt:message key="premium.register.email"/></td> |
||||
<td> |
||||
<form:input path="licenseInfo.licenseEmail" size="60"/> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><fmt:message key="premium.register.license"/></td> |
||||
<td> |
||||
<form:input path="licenseCode" size="60"/> |
||||
</td> |
||||
<td><input type="submit" value="<fmt:message key="common.ok"/>"/></td> |
||||
</tr> |
||||
<tr> |
||||
<td/> |
||||
<td class="warning"><form:errors path="licenseCode"/></td> |
||||
</tr> |
||||
</table> |
||||
</form:form> |
||||
|
||||
<p><fmt:message key="premium.resend"/></p> |
||||
</c:if> |
||||
|
||||
</div> |
||||
</body> |
||||
</html> |
After Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in new issue