From dce55c005fd70f3e2df5231ac4a069919d8ed542 Mon Sep 17 00:00:00 2001 From: Jens Georg Date: Thu, 19 Jan 2012 19:32:35 +0100 Subject: [PATCH] core: Fix suffix for PNG thumbnails --- src/rygel/rygel-http-item-uri.vala | 14 +++++++------- src/rygel/rygel-thumbnailer.vala | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/rygel/rygel-http-item-uri.vala b/src/rygel/rygel-http-item-uri.vala index 0e48b8d..e90c927 100644 --- a/src/rygel/rygel-http-item-uri.vala +++ b/src/rygel/rygel-http-item-uri.vala @@ -72,8 +72,7 @@ internal class Rygel.HTTPItemURI : Object { this.extension = "jpg"; // what now? throw an error? } - } - else if (subtitle_index > -1) { + } else if (subtitle_index > -1) { if (item is VideoItem) { var subtitles = (item as VideoItem).subtitles; @@ -87,14 +86,14 @@ internal class Rygel.HTTPItemURI : Object { // what now? throw an error? this.extension = "srt"; } - } - else if (transcode_target != null) { + } else if (transcode_target != null) { try { var tc = this.http_server.get_transcoder (transcode_target); this.extension = tc.extension; - } catch (Error err) {} + } catch (Error error) {} } + if (this.extension == "") { string uri_extension = ""; @@ -104,12 +103,13 @@ internal class Rygel.HTTPItemURI : Object { if (dot_index > -1) { uri_extension = basename.substring (dot_index + 1); + break; } } if (uri_extension == "") { - this.extension = ext_from_mime_type (item.mime_type); + this.extension = this.ext_from_mime_type (item.mime_type); } else { this.extension = uri_extension; } @@ -211,7 +211,7 @@ internal class Rygel.HTTPItemURI : Object { foreach (string video in videos) { mime_to_ext.set ("video/" + video, video); } - mime_to_ext.set("video/x-matroska", "mkv"); + mime_to_ext.set ("video/x-matroska", "mkv"); // audios mime_to_ext.set ("audio/x-wav", "wav"); diff --git a/src/rygel/rygel-thumbnailer.vala b/src/rygel/rygel-thumbnailer.vala index c93c281..6e90771 100644 --- a/src/rygel/rygel-thumbnailer.vala +++ b/src/rygel/rygel-thumbnailer.vala @@ -61,10 +61,11 @@ internal class Rygel.Thumbnailer : GLib.Object { } else { this.template.mime_type = "image/png"; this.template.dlna_profile = "PNG_TN"; + this.template.file_extension = "png"; this.template.width = 128; this.template.height = 128; this.template.depth = 32; - this.extension = ".png"; + this.extension = "." + this.template.file_extension; } } else { this.template.width = 124; -- 2.7.4