aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005/dsub/service/DownloadService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/github/daneren2005/dsub/service/DownloadService.java')
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java
index e8829aa6..5e02641a 100644
--- a/src/github/daneren2005/dsub/service/DownloadService.java
+++ b/src/github/daneren2005/dsub/service/DownloadService.java
@@ -43,6 +43,7 @@ import github.daneren2005.dsub.util.ShufflePlayBuffer;
import github.daneren2005.dsub.util.SimpleServiceBinder;
import github.daneren2005.dsub.util.Util;
import github.daneren2005.dsub.util.compat.RemoteControlClientHelper;
+import github.daneren2005.serverproxy.BufferProxy;
import java.io.File;
import java.util.ArrayList;
@@ -133,7 +134,7 @@ public class DownloadService extends Service {
private boolean showVisualization;
private RemoteControlState remoteState = RemoteControlState.LOCAL;
private PositionCache positionCache;
- private StreamProxy proxy;
+ private BufferProxy proxy;
private Timer sleepTimer;
private int timerDuration;
@@ -274,6 +275,10 @@ public class DownloadService extends Service {
remoteController.stop();
remoteController.shutdown();
}
+ if(proxy != null) {
+ proxy.stop();
+ proxy = null;
+ }
mediaRouter.destroy();
Util.hidePlayingNotification(this, this, handler);
Util.hideDownloadingNotification(this);
@@ -552,6 +557,10 @@ public class DownloadService extends Service {
}
updateJukeboxPlaylist();
setNextPlaying();
+ if(proxy != null) {
+ proxy.stop();
+ proxy = null;
+ }
}
public synchronized void remove(int which) {
@@ -1206,10 +1215,11 @@ public class DownloadService extends Service {
String dataSource = file.getPath();
if(isPartial) {
if (proxy == null) {
- proxy = new StreamProxy(this);
+ proxy = new BufferProxy(this);
proxy.start();
}
- dataSource = String.format("http://127.0.0.1:%d/%s", proxy.getPort(), URLEncoder.encode(dataSource, Constants.UTF_8));
+ proxy.setBufferFile(downloadFile);
+ dataSource = proxy.getPrivateAddress(dataSource);
Log.i(TAG, "Data Source: " + dataSource);
} else if(proxy != null) {
proxy.stop();