Removed unused network status

Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
master
Andrew DeMaria 8 years ago
parent 8b92f2bc51
commit 0c629abd4f
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 17
      libresonic-main/src/main/java/org/libresonic/player/ajax/MultiService.java
  2. 56
      libresonic-main/src/main/java/org/libresonic/player/ajax/NetworkStatus.java
  3. 46
      libresonic-main/src/main/java/org/libresonic/player/service/NetworkService.java
  4. 1
      libresonic-main/src/main/resources/applicationContext-service.xml
  5. 1
      libresonic-main/src/main/webapp/WEB-INF/dwr.xml

@ -45,24 +45,11 @@ public class MultiService {
private static final Logger LOG = Logger.getLogger(MultiService.class); private static final Logger LOG = Logger.getLogger(MultiService.class);
private NetworkService networkService;
private MediaFileService mediaFileService; private MediaFileService mediaFileService;
private LastFmService lastFmService; private LastFmService lastFmService;
private SecurityService securityService; private SecurityService securityService;
private SettingsService settingsService; private SettingsService settingsService;
/**
* Returns status for port forwarding and URL redirection.
*/
public NetworkStatus getNetworkStatus() {
NetworkService.Status portForwardingStatus = networkService.getPortForwardingStatus();
NetworkService.Status urlRedirectionStatus = networkService.getURLRedirecionStatus();
return new NetworkStatus(portForwardingStatus.getText(),
portForwardingStatus.getDate(),
urlRedirectionStatus.getText(),
urlRedirectionStatus.getDate());
}
public ArtistInfo getArtistInfo(int mediaFileId, int maxSimilarArtists, int maxTopSongs) { public ArtistInfo getArtistInfo(int mediaFileId, int maxSimilarArtists, int maxTopSongs) {
MediaFile mediaFile = mediaFileService.getMediaFile(mediaFileId); MediaFile mediaFile = mediaFileService.getMediaFile(mediaFileId);
List<SimilarArtist> similarArtists = getSimilarArtists(mediaFileId, maxSimilarArtists); List<SimilarArtist> similarArtists = getSimilarArtists(mediaFileId, maxSimilarArtists);
@ -111,10 +98,6 @@ public class MultiService {
settingsService.updateUserSettings(userSettings); settingsService.updateUserSettings(userSettings);
} }
public void setNetworkService(NetworkService networkService) {
this.networkService = networkService;
}
public void setMediaFileService(MediaFileService mediaFileService) { public void setMediaFileService(MediaFileService mediaFileService) {
this.mediaFileService = mediaFileService; this.mediaFileService = mediaFileService;
} }

@ -1,56 +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.ajax;
import java.util.Date;
/**
* @author Sindre Mehus
*/
public class NetworkStatus {
private final String portForwardingStatusText;
private final Date portForwardingStatusDate;
private final String urlRedirectionStatusText;
private final Date urlRedirectionStatusDate;
public NetworkStatus(String portForwardingStatusText, Date portForwardingStatusDate,
String urlRedirectionStatusText, Date urlRedirectionStatusDate) {
this.portForwardingStatusText = portForwardingStatusText;
this.portForwardingStatusDate = portForwardingStatusDate;
this.urlRedirectionStatusText = urlRedirectionStatusText;
this.urlRedirectionStatusDate = urlRedirectionStatusDate;
}
public String getPortForwardingStatusText() {
return portForwardingStatusText;
}
public Date getPortForwardingStatusDate() {
return portForwardingStatusDate;
}
public String getUrlRedirectionStatusText() {
return urlRedirectionStatusText;
}
public Date getUrlRedirectionStatusDate() {
return urlRedirectionStatusDate;
}
}

@ -27,55 +27,9 @@ import java.net.MalformedURLException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.util.Date;
/**
* Provides network-related services, including port forwarding on UPnP routers and
* URL redirection from http://xxxx.libresonic.org.
*
* @author Sindre Mehus
*/
public class NetworkService { public class NetworkService {
public static final String NOT_SUPPORTED = "NOT SUPPORTED";
private final static Status portForwardingStatus;
private final static Status urlRedirectionStatus;
static {
portForwardingStatus = new Status();
portForwardingStatus.setText(NOT_SUPPORTED);
urlRedirectionStatus = new Status();
urlRedirectionStatus.setText(NOT_SUPPORTED);
}
public Status getPortForwardingStatus() {
return portForwardingStatus;
}
public Status getURLRedirecionStatus() {
return urlRedirectionStatus;
}
public static class Status {
private String text;
private Date date;
public void setText(String text) {
this.text = text;
date = new Date();
}
public String getText() {
return text;
}
public Date getDate() {
return date;
}
}
public static String getBaseUrl(HttpServletRequest request) { public static String getBaseUrl(HttpServletRequest request) {
try { try {
UrlPathHelper urlPathHelper = new UrlPathHelper(); UrlPathHelper urlPathHelper = new UrlPathHelper();

@ -235,7 +235,6 @@
<!-- AJAX services --> <!-- AJAX services -->
<bean id="ajaxMultiService" class="org.libresonic.player.ajax.MultiService"> <bean id="ajaxMultiService" class="org.libresonic.player.ajax.MultiService">
<property name="networkService" ref="networkService"/>
<property name="mediaFileService" ref="mediaFileService"/> <property name="mediaFileService" ref="mediaFileService"/>
<property name="settingsService" ref="settingsService"/> <property name="settingsService" ref="settingsService"/>
<property name="securityService" ref="securityService"/> <property name="securityService" ref="securityService"/>

@ -40,7 +40,6 @@
<param name="beanName" value="ajaxTransferService"/> <param name="beanName" value="ajaxTransferService"/>
</create> </create>
<convert converter="bean" match="org.libresonic.player.ajax.NetworkStatus"/>
<convert converter="bean" match="org.libresonic.player.ajax.NowPlayingInfo"/> <convert converter="bean" match="org.libresonic.player.ajax.NowPlayingInfo"/>
<convert converter="bean" match="org.libresonic.player.ajax.ScanInfo"/> <convert converter="bean" match="org.libresonic.player.ajax.ScanInfo"/>
<convert converter="bean" match="org.libresonic.player.ajax.PlayQueueInfo"/> <convert converter="bean" match="org.libresonic.player.ajax.PlayQueueInfo"/>

Loading…
Cancel
Save