diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-05-30 10:32:18 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-05-30 10:32:18 -0400 |
| commit | a93045c01a2a04f52fd13fff4db7c8e859bbcf25 (patch) | |
| tree | 64148e319f8091bc54d1a28e640b9a64152d9e9d /MediaBrowser.Providers | |
| parent | f12809e7857bfd7d2d5371a2b7bcc46a95b00c0e (diff) | |
fix web project
Diffstat (limited to 'MediaBrowser.Providers')
| -rw-r--r-- | MediaBrowser.Providers/Omdb/OmdbProvider.cs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/MediaBrowser.Providers/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Omdb/OmdbProvider.cs index 67aa35710..e55321bb1 100644 --- a/MediaBrowser.Providers/Omdb/OmdbProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbProvider.cs @@ -1,5 +1,6 @@ using MediaBrowser.Common.Net; using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.Serialization; using System; using System.Globalization; @@ -50,6 +51,20 @@ namespace MediaBrowser.Providers.Omdb { var result = _jsonSerializer.DeserializeFromStream<RootObject>(stream); + item.Name = result.Title; + + int year; + + if (!string.IsNullOrEmpty(result.Year) + && int.TryParse(result.Year, NumberStyles.Number, _usCulture, out year) + && year >= 0) + { + item.ProductionYear = year; + } + + item.OfficialRating = result.Rated; + + var hasCriticRating = item as IHasCriticRating; if (hasCriticRating != null) { @@ -96,6 +111,12 @@ namespace MediaBrowser.Providers.Omdb item.HomePageUrl = result.Website; } + if (!string.IsNullOrWhiteSpace(result.imdbID) + && !string.Equals(result.imdbID, "n/a", StringComparison.OrdinalIgnoreCase)) + { + item.SetProviderId(MetadataProviders.Imdb, result.imdbID); + } + ParseAdditionalMetadata(item, result); } } @@ -153,7 +174,7 @@ namespace MediaBrowser.Providers.Omdb return string.Equals(lang, "en", StringComparison.OrdinalIgnoreCase); } - public class RootObject + private class RootObject { public string Title { get; set; } public string Year { get; set; } |
