aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-03-03 18:03:09 -0800
committerScott Jackson <daneren2005@gmail.com>2015-03-03 18:03:09 -0800
commite4cb076390ecdd2c60ceb3c8ea0f80ce836f0859 (patch)
tree1177d5bcc7a5ac4688210171e642453abd59a0ee /src/github/daneren2005
parent246e354775354329a6c4544d3f31be0f054c640b (diff)
downloaddsub-e4cb076390ecdd2c60ceb3c8ea0f80ce836f0859.tar.gz
dsub-e4cb076390ecdd2c60ceb3c8ea0f80ce836f0859.tar.bz2
dsub-e4cb076390ecdd2c60ceb3c8ea0f80ce836f0859.zip
Try to keep DLNA connection alive by running search every 10 minutes
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r--src/github/daneren2005/dsub/service/DLNAController.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/service/DLNAController.java b/src/github/daneren2005/dsub/service/DLNAController.java
index cdff990b..d4777428 100644
--- a/src/github/daneren2005/dsub/service/DLNAController.java
+++ b/src/github/daneren2005/dsub/service/DLNAController.java
@@ -70,6 +70,7 @@ import github.daneren2005.serverproxy.FileProxy;
public class DLNAController extends RemoteController {
private static final String TAG = DLNAController.class.getSimpleName();
+ private static final long SEARCH_UPDATE_INTERVAL_SECONDS = 10L * 60L * 1000L;
private static final long STATUS_UPDATE_INTERVAL_SECONDS = 3000L;
DLNADevice device;
@@ -86,6 +87,17 @@ public class DLNAController extends RemoteController {
String currentPlayingURI;
boolean running = true;
boolean hasDuration = false;
+ Runnable searchDLNA = new Runnable() {
+ @Override
+ public void run() {
+ if(controlPoint == null || !running) {
+ return;
+ }
+
+ controlPoint.search();
+ downloadService.postDelayed(searchDLNA, SEARCH_UPDATE_INTERVAL_SECONDS);
+ }
+ };
public DLNAController(DownloadService downloadService, ControlPoint controlPoint, DLNADevice device) {
this.downloadService = downloadService;
@@ -119,6 +131,7 @@ public class DLNAController extends RemoteController {
}
startSong(downloadService.getCurrentPlaying(), playing, seconds);
+ downloadService.postDelayed(searchDLNA, SEARCH_UPDATE_INTERVAL_SECONDS);
}
@Override