aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-11-29 17:13:11 -0800
committerScott Jackson <daneren2005@gmail.com>2014-11-29 17:13:11 -0800
commitd0fedd64b81004d5c0d9bd773f395eab4b0f7519 (patch)
treea62541f218bd51f86cb01596359dca2c7d49bc65 /src/github
parentd09912ac3943f9bceb6033a7a1a37bd0362a8a64 (diff)
downloaddsub-d0fedd64b81004d5c0d9bd773f395eab4b0f7519.tar.gz
dsub-d0fedd64b81004d5c0d9bd773f395eab4b0f7519.tar.bz2
dsub-d0fedd64b81004d5c0d9bd773f395eab4b0f7519.zip
Apply more DLNA logic
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/service/DLNAController.java39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/github/daneren2005/dsub/service/DLNAController.java b/src/github/daneren2005/dsub/service/DLNAController.java
index a5e9a8ef..2448b088 100644
--- a/src/github/daneren2005/dsub/service/DLNAController.java
+++ b/src/github/daneren2005/dsub/service/DLNAController.java
@@ -31,6 +31,7 @@ import org.teleal.cling.model.state.StateVariableValue;
import org.teleal.cling.model.types.ServiceType;
import org.teleal.cling.support.avtransport.callback.Pause;
import org.teleal.cling.support.avtransport.callback.Play;
+import org.teleal.cling.support.avtransport.callback.Seek;
import org.teleal.cling.support.avtransport.callback.SetAVTransportURI;
import org.teleal.cling.support.avtransport.callback.Stop;
import org.teleal.cling.support.avtransport.lastchange.AVTransportLastChangeParser;
@@ -38,14 +39,16 @@ import org.teleal.cling.support.avtransport.lastchange.AVTransportVariable;
import org.teleal.cling.support.contentdirectory.DIDLParser;
import org.teleal.cling.support.lastchange.LastChange;
import org.teleal.cling.support.model.DIDLContent;
-import org.teleal.cling.support.model.Res;
+import org.teleal.cling.support.model.SeekMode;
import org.teleal.cling.support.model.item.Item;
import org.teleal.cling.support.model.item.MusicTrack;
import org.teleal.cling.support.model.item.VideoItem;
-import org.teleal.common.util.MimeType;
+import org.teleal.cling.support.renderingcontrol.callback.SetVolume;
-import java.util.Iterator;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.Map;
+import java.util.TimeZone;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.DLNADevice;
@@ -117,6 +120,7 @@ public class DLNAController extends RemoteController {
boolean failed = false;
for(StateVariableValue val: m.values()) {
if(val.toString().indexOf("TransportStatus val=\"ERROR_OCCURRED\"") != -1) {
+ Log.w(TAG, "Failed to load with event: val.toString()");
failed = true;
}
}
@@ -204,32 +208,49 @@ public class DLNAController extends RemoteController {
@Override
public void updatePlaylist() {
-
+ if(downloadService.getCurrentPlaying() == null) {
+ startSong(null, false, 0);
+ }
}
@Override
public void changePosition(int seconds) {
-
+ SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");
+ df.setTimeZone(TimeZone.getTimeZone("UTC"));
+ controlPoint.execute(new Seek(device.renderer.findService(new ServiceType("schemas-upnp-org", "AVTransport")), SeekMode.REL_TIME, df.format(new Date(seconds * 1000))) {
+ @SuppressWarnings("rawtypes")
+ @Override
+ public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMessage) {
+ Log.w(TAG, "Seek failed: " + defaultMessage);
+ }
+ });
}
@Override
public void changeTrack(int index, DownloadFile song) {
-
+ startSong(song, true, 0);
}
@Override
public void setVolume(int volume) {
-
+ device.volume = volume;
+ controlPoint.execute(new SetVolume(device.renderer.findService(new ServiceType("schemas-upnp-org", "RenderingControl")), volume) {
+ @SuppressWarnings("rawtypes")
+ @Override
+ public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMessage) {
+ Log.w(TAG, "Set volume failed: " + defaultMessage);
+ }
+ });
}
@Override
public void updateVolume(boolean up) {
-
+ setVolume(device.volume + (up ? 1 : -1));
}
@Override
public double getVolume() {
- return 0;
+ return device.volume;
}
@Override