[rygel] core: Return 404 on missing thumbnail
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core: Return 404 on missing thumbnail
- Date: Fri, 16 Mar 2012 08:22:46 +0000 (UTC)
commit 1e3b36dcc18effbd2e67b2ddaa8b6a43b1ec165f
Author: Jens Georg <mail jensge org>
Date: Thu Mar 15 08:56:59 2012 +0100
core: Return 404 on missing thumbnail
https://bugzilla.gnome.org/show_bug.cgi?id=672048
src/rygel/rygel-http-get.vala | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/src/rygel/rygel-http-get.vala b/src/rygel/rygel-http-get.vala
index a7ca2ef..c98d56c 100644
--- a/src/rygel/rygel-http-get.vala
+++ b/src/rygel/rygel-http-get.vala
@@ -90,31 +90,36 @@ internal class Rygel.HTTPGet : HTTPRequest {
if (this.uri.thumbnail_index >= 0) {
if (this.item is MusicItem) {
var music = this.item as MusicItem;
-
this.thumbnail = music.album_art;
+
+ return;
} else if (this.item is VisualItem) {
var visual = this.item as VisualItem;
- if (visual.thumbnails.size >= this.uri.thumbnail_index) {
+ if (this.uri.thumbnail_index < visual.thumbnails.size) {
this.thumbnail = visual.thumbnails.get
(this.uri.thumbnail_index);
+
+ return;
}
- } else {
- throw new HTTPRequestError.NOT_FOUND
- ("No Thumbnail available for item '%s",
- this.item.id);
}
- } else if (this.uri.subtitle_index >= 0) {
- if (!(this.item is VideoItem)) {
- throw new HTTPRequestError.NOT_FOUND
- ("No subtitles available for item '%s",
+
+ throw new HTTPRequestError.NOT_FOUND
+ ("No Thumbnail available for item '%s",
this.item.id);
- }
+ }
+ if (this.uri.subtitle_index >= 0 && this.item is VideoItem) {
var video = this.item as VideoItem;
- if (this.uri.subtitle_index <= video.subtitles.size) {
+ if (this.uri.subtitle_index < video.subtitles.size) {
this.subtitle = video.subtitles.get (this.uri.subtitle_index);
+
+ return;
}
+
+ throw new HTTPRequestError.NOT_FOUND
+ ("No subtitles available for item '%s",
+ this.item.id);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]