diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-01-19 19:52:14 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-01-19 19:52:14 -0800 |
commit | eadc4a0b703c259c0d2ca61c1c1d8e0cb26cab70 (patch) | |
tree | 8f3f057ea826d99d93c9bc997662300c50747856 /src/github | |
parent | e4bfbeab9bf2c41f957d9152eac6f80e18d0073b (diff) | |
download | dsub-eadc4a0b703c259c0d2ca61c1c1d8e0cb26cab70.tar.gz dsub-eadc4a0b703c259c0d2ca61c1c1d8e0cb26cab70.tar.bz2 dsub-eadc4a0b703c259c0d2ca61c1c1d8e0cb26cab70.zip |
Add cover art to metadata
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/service/DLNAController.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/service/DLNAController.java b/src/github/daneren2005/dsub/service/DLNAController.java index fc19b6a1..7e4f9ce7 100644 --- a/src/github/daneren2005/dsub/service/DLNAController.java +++ b/src/github/daneren2005/dsub/service/DLNAController.java @@ -43,6 +43,7 @@ import org.fourthline.cling.support.connectionmanager.callback.PrepareForConnect import org.fourthline.cling.support.contentdirectory.DIDLParser;
import org.fourthline.cling.support.lastchange.LastChange;
import org.fourthline.cling.support.model.DIDLContent;
+import org.fourthline.cling.support.model.DIDLObject;
import org.fourthline.cling.support.model.PersonWithRole;
import org.fourthline.cling.support.model.PositionInfo;
import org.fourthline.cling.support.model.Res;
@@ -53,6 +54,7 @@ import org.fourthline.cling.support.model.item.VideoItem; import org.fourthline.cling.support.renderingcontrol.callback.SetVolume;
import org.seamless.util.MimeType;
+import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
@@ -360,6 +362,14 @@ public class DLNAController extends RemoteController { MusicTrack musicTrack = new MusicTrack(song.getId(), song.getParent(), song.getTitle(), song.getArtist(), song.getAlbum(), song.getArtist(), res);
musicTrack.setOriginalTrackNumber(song.getTrack());
+
+ if(song.getCoverArt() != null) {
+ String coverArt = musicService.getCoverArtUrl(downloadService, song);
+ coverArt = Util.replaceInternalUrl(downloadService, coverArt);
+ DIDLObject.Property.UPNP.ALBUM_ART_URI albumArtUri = new DIDLObject.Property.UPNP.ALBUM_ART_URI(URI.create(coverArt));
+ musicTrack.addProperty(albumArtUri);
+ }
+
track = musicTrack;
}
@@ -369,7 +379,6 @@ public class DLNAController extends RemoteController { String metadata = "";
try {
- // <s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><CurrentURI>http://192.168.1.3:57645/external/audio/media/39883.mp3</CurrentURI><CurrentURIMetaData><DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:sec="http://www.sec.co.kr/"><item id="/external/audio/albums/484/39883" parentID="/external/audio/albums/484" restricted="1"><upnp:class>object.item.audioItem.musicTrack</upnp:class><dc:title>03-Miss Murder.complete</dc:title><dc:creator>AFI</dc:creator><upnp:artist>AFI</upnp:artist><upnp:albumArtURI>http://192.168.1.3:57645/external/audio/albums/484.jpg</upnp:albumArtURI><upnp:genre>Rock</upnp:genre><dc:date>2006-01-01</dc:date><upnp:album>&lt;unknown&gt;</upnp:album><upnp:originalTrackNumber>3</upnp:originalTrackNumber><res protocolInfo="http-get:*:audio/mpeg:*" bitrate="24000" size="4961736" duration="0:03:26.000">http://192.168.1.3:57645/external/audio/media/39883.mp3</res></item></DIDL-Lite></CurrentURIMetaData></u:SetAVTransportURI></s:Body></s:Envelope>
metadata = parser.generate(didl);
} catch(Exception e) {
Log.w(TAG, "Metadata generation failed", e);
|