diff --git a/MediaBrowser.Api/HttpHandlers/ImageHandler.cs b/MediaBrowser.Api/HttpHandlers/ImageHandler.cs index 4a6b2a4817..39a115cefb 100644 --- a/MediaBrowser.Api/HttpHandlers/ImageHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/ImageHandler.cs @@ -25,22 +25,34 @@ namespace MediaBrowser.Api.HttpHandlers private async Task DiscoverImagePath() { - string path = QueryString["path"] ?? string.Empty; + string personName = QueryString["personname"]; - if (!string.IsNullOrEmpty(path)) + if (!string.IsNullOrEmpty(personName)) { - return path; + return (await Kernel.Instance.ItemController.GetPerson(personName)).PrimaryImagePath; } - string personName = QueryString["personname"]; + string genreName = QueryString["genre"]; - if (!string.IsNullOrEmpty(personName)) + if (!string.IsNullOrEmpty(genreName)) { - Person person = await Kernel.Instance.ItemController.GetPerson(personName); - - return person.PrimaryImagePath; + return (await Kernel.Instance.ItemController.GetGenre(genreName)).PrimaryImagePath; } + string year = QueryString["year"]; + + if (!string.IsNullOrEmpty(year)) + { + return (await Kernel.Instance.ItemController.GetYear(int.Parse(year))).PrimaryImagePath; + } + + string studio = QueryString["studio"]; + + if (!string.IsNullOrEmpty(studio)) + { + return (await Kernel.Instance.ItemController.GetStudio(studio)).PrimaryImagePath; + } + BaseItem item = ApiService.GetItemById(QueryString["id"]); string imageIndex = QueryString["index"];