[rygel] server: add albumArtUri to VideoItem



commit 37cf8798b5c6388a0af7a8bfa30ed123e039e393
Author: Jens Georg <mail jensge org>
Date:   Mon Oct 12 17:20:56 2020 +0200

    server: add albumArtUri to VideoItem
    
    Fixes #151

 src/librygel-server/rygel-video-item.vala | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/src/librygel-server/rygel-video-item.vala b/src/librygel-server/rygel-video-item.vala
index 78248225..dc82bd15 100644
--- a/src/librygel-server/rygel-video-item.vala
+++ b/src/librygel-server/rygel-video-item.vala
@@ -182,6 +182,7 @@ public class Rygel.VideoItem : AudioItem, VisualItem {
                     subtitle.add_didl_node (didl_item);
                 }
             }
+
             if (main_subtitle != null) {
                 // Add resource-level subtitle metadata to all streamable
                 // video resources Note: All resources have already been
@@ -201,6 +202,25 @@ public class Rygel.VideoItem : AudioItem, VisualItem {
                 }
             }
 
+            // Also add upnp:albumArtURI for thumbnails. Some players need this apparently
+            // even for videos instead of using the JPEG_TN/PNG_TN resource
+            if (this.thumbnails.size != 0) {
+                var protocol = this.get_protocol_for_uri (this.thumbnails[0].uri);
+                if (http_server.is_local () || protocol != "internal") {
+                    didl_item.album_art = this.thumbnails[0].uri;
+                } else {
+                    // Create a http uri for the album art that our server can process
+                    string http_uri = http_server.create_uri_for_object (this,
+                            0,
+                            -1,
+                            null);
+                    didl_item.album_art = MediaFileItem.address_regex.replace_literal
+                        (http_uri,
+                         -1,
+                         0,
+                         http_server.context.host_ip);
+                }
+            }
         }
 
         return didl_item;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]