aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005/dsub/service/DLNAController.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/github/daneren2005/dsub/service/DLNAController.java')
-rw-r--r--src/github/daneren2005/dsub/service/DLNAController.java29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/service/DLNAController.java b/src/github/daneren2005/dsub/service/DLNAController.java
index cdff990b..a2894a23 100644
--- a/src/github/daneren2005/dsub/service/DLNAController.java
+++ b/src/github/daneren2005/dsub/service/DLNAController.java
@@ -67,6 +67,8 @@ import github.daneren2005.dsub.util.Constants;
import github.daneren2005.dsub.util.FileUtil;
import github.daneren2005.dsub.util.Util;
import github.daneren2005.serverproxy.FileProxy;
+import github.daneren2005.serverproxy.ServerProxy;
+import github.daneren2005.serverproxy.WebProxy;
public class DLNAController extends RemoteController {
private static final String TAG = DLNAController.class.getSimpleName();
@@ -77,7 +79,7 @@ public class DLNAController extends RemoteController {
SubscriptionCallback callback;
boolean supportsSeek = false;
- private FileProxy proxy;
+ private ServerProxy proxy;
String rootLocation = "";
boolean error = false;
@@ -388,7 +390,18 @@ public class DLNAController extends RemoteController {
url = proxy.getPublicAddress(currentPlaying.getCompleteFile().getPath());
}
} else {
- if(proxy != null) {
+ // Check if we want a proxy going still
+ if(Util.isCastProxy(downloadService)) {
+ if(proxy instanceof FileProxy) {
+ proxy.stop();
+ proxy = null;
+ }
+
+ if(proxy == null) {
+ proxy = new WebProxy(downloadService);
+ proxy.start();
+ }
+ } else if(proxy != null) {
proxy.stop();
proxy = null;
}
@@ -398,6 +411,11 @@ public class DLNAController extends RemoteController {
} else {
url = musicService.getMusicUrl(downloadService, song, currentPlaying.getBitRate());
}
+
+ // If proxy is going, it is a WebProxy
+ if(proxy != null) {
+ url = proxy.getPublicAddress(url);
+ }
}
// Create metadata for entry
@@ -434,8 +452,13 @@ public class DLNAController extends RemoteController {
if(song.getCoverArt() != null) {
String coverArt = null;
- if(proxy == null) {
+ if(proxy == null || proxy instanceof WebProxy) {
coverArt = musicService.getCoverArtUrl(downloadService, song);
+
+ // If proxy is going, it is a web proxy
+ if(proxy != null) {
+ coverArt = proxy.getPublicAddress(coverArt);
+ }
} else {
File coverArtFile = FileUtil.getAlbumArtFile(downloadService, song);
if(coverArtFile != null && coverArtFile.exists()) {