aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Providers/Plugins/Omdb/Configuration/PluginConfiguration.cs9
-rw-r--r--MediaBrowser.Providers/Plugins/Omdb/Configuration/config.html49
-rw-r--r--MediaBrowser.Providers/Plugins/Omdb/OmdbImageProvider.cs1
-rw-r--r--MediaBrowser.Providers/Plugins/Omdb/OmdbItemProvider.cs2
-rw-r--r--MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs139
-rw-r--r--MediaBrowser.Providers/Plugins/Omdb/Plugin.cs35
-rw-r--r--MediaBrowser.Providers/Plugins/TheTvdb/Configuration/PluginConfiguration.cs8
-rw-r--r--MediaBrowser.Providers/Plugins/TheTvdb/Plugin.cs24
-rw-r--r--MediaBrowser.Providers/Plugins/TheTvdb/TvdbClientManager.cs3
-rw-r--r--MediaBrowser.Providers/Plugins/TheTvdb/TvdbEpisodeProvider.cs4
-rw-r--r--MediaBrowser.Providers/Plugins/TheTvdb/TvdbPersonImageProvider.cs1
-rw-r--r--MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeasonImageProvider.cs4
-rw-r--r--MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesImageProvider.cs3
-rw-r--r--MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesProvider.cs10
14 files changed, 230 insertions, 62 deletions
diff --git a/MediaBrowser.Providers/Plugins/Omdb/Configuration/PluginConfiguration.cs b/MediaBrowser.Providers/Plugins/Omdb/Configuration/PluginConfiguration.cs
new file mode 100644
index 000000000..a9eecdd9e
--- /dev/null
+++ b/MediaBrowser.Providers/Plugins/Omdb/Configuration/PluginConfiguration.cs
@@ -0,0 +1,9 @@
+using MediaBrowser.Model.Plugins;
+
+namespace MediaBrowser.Providers.Plugins.Omdb
+{
+ public class PluginConfiguration : BasePluginConfiguration
+ {
+ public bool CastAndCrew { get; set; }
+ }
+}
diff --git a/MediaBrowser.Providers/Plugins/Omdb/Configuration/config.html b/MediaBrowser.Providers/Plugins/Omdb/Configuration/config.html
new file mode 100644
index 000000000..8b117ec8d
--- /dev/null
+++ b/MediaBrowser.Providers/Plugins/Omdb/Configuration/config.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>OMDb</title>
+</head>
+<body>
+ <div data-role="page" class="page type-interior pluginConfigurationPage configPage" data-require="emby-input,emby-button,emby-checkbox">
+ <div data-role="content">
+ <div class="content-primary">
+ <form class="configForm">
+ <label class="checkboxContainer">
+ <input is="emby-checkbox" type="checkbox" id="castAndCrew" />
+ <span>Collect information about the cast and other crew members from OMDb.</span>
+ </label>
+ <br />
+ <div>
+ <button is="emby-button" type="submit" class="raised button-submit block"><span>Save</span></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <script type="text/javascript">
+ var PluginConfig = {
+ pluginId: "a628c0da-fac5-4c7e-9d1a-7134223f14c8"
+ };
+
+ $('.configPage').on('pageshow', function () {
+ Dashboard.showLoadingMsg();
+ ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
+ $('#castAndCrew').checked = config.CastAndCrew;
+ Dashboard.hideLoadingMsg();
+ });
+ });
+
+ $('.configForm').on('submit', function (e) {
+ Dashboard.showLoadingMsg();
+
+ var form = this;
+ ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
+ config.CastAndCrew = $('#castAndCrew', form).checked;
+ ApiClient.updatePluginConfiguration(PluginConfig.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
+ });
+
+ return false;
+ });
+ </script>
+ </div>
+</body>
+</html>
diff --git a/MediaBrowser.Providers/Plugins/Omdb/OmdbImageProvider.cs b/MediaBrowser.Providers/Plugins/Omdb/OmdbImageProvider.cs
index a450c2a6d..3cf4c3d50 100644
--- a/MediaBrowser.Providers/Plugins/Omdb/OmdbImageProvider.cs
+++ b/MediaBrowser.Providers/Plugins/Omdb/OmdbImageProvider.cs
@@ -92,6 +92,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
{
return item is Movie || item is Trailer || item is Episode;
}
+
// After other internet providers, because they're better
// But before fallback providers like screengrab
public int Order => 90;
diff --git a/MediaBrowser.Providers/Plugins/Omdb/OmdbItemProvider.cs b/MediaBrowser.Providers/Plugins/Omdb/OmdbItemProvider.cs
index 64a75955a..35a840f00 100644
--- a/MediaBrowser.Providers/Plugins/Omdb/OmdbItemProvider.cs
+++ b/MediaBrowser.Providers/Plugins/Omdb/OmdbItemProvider.cs
@@ -103,6 +103,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
{
urlQuery += "&t=" + WebUtility.UrlEncode(name);
}
+
urlQuery += "&type=" + type;
}
else
@@ -117,6 +118,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
{
urlQuery += string.Format(CultureInfo.InvariantCulture, "&Episode={0}", searchInfo.IndexNumber);
}
+
if (searchInfo.ParentIndexNumber.HasValue)
{
urlQuery += string.Format(CultureInfo.InvariantCulture, "&Season={0}", searchInfo.ParentIndexNumber);
diff --git a/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs
index fbdd293ed..dcc003dca 100644
--- a/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs
+++ b/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs
@@ -87,10 +87,10 @@ namespace MediaBrowser.Providers.Plugins.Omdb
item.CommunityRating = imdbRating;
}
- //if (!string.IsNullOrEmpty(result.Website))
- //{
- // item.HomePageUrl = result.Website;
- //}
+ if (!string.IsNullOrEmpty(result.Website))
+ {
+ item.HomePageUrl = result.Website;
+ }
if (!string.IsNullOrWhiteSpace(result.imdbID))
{
@@ -121,7 +121,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
if (!string.IsNullOrWhiteSpace(episodeImdbId))
{
- foreach (var episode in (seasonResult.Episodes ?? new RootObject[] { }))
+ foreach (var episode in seasonResult.Episodes)
{
if (string.Equals(episodeImdbId, episode.imdbID, StringComparison.OrdinalIgnoreCase))
{
@@ -134,7 +134,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
// finally, search by numbers
if (result == null)
{
- foreach (var episode in (seasonResult.Episodes ?? new RootObject[] { }))
+ foreach (var episode in seasonResult.Episodes)
{
if (episode.Episode == episodeNumber)
{
@@ -188,10 +188,10 @@ namespace MediaBrowser.Providers.Plugins.Omdb
item.CommunityRating = imdbRating;
}
- //if (!string.IsNullOrEmpty(result.Website))
- //{
- // item.HomePageUrl = result.Website;
- //}
+ if (!string.IsNullOrEmpty(result.Website))
+ {
+ item.HomePageUrl = result.Website;
+ }
if (!string.IsNullOrWhiteSpace(result.imdbID))
{
@@ -263,6 +263,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
{
return url;
}
+
return url + "&" + query;
}
@@ -386,7 +387,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
var isConfiguredForEnglish = IsConfiguredForEnglish(item) || _configurationManager.Configuration.EnableNewOmdbSupport;
- // Grab series genres because imdb data is better than tvdb. Leave movies alone
+ // Grab series genres because IMDb data is better than TVDB. Leave movies alone
// But only do it if english is the preferred language because this data will not be localized
if (isConfiguredForEnglish && !string.IsNullOrWhiteSpace(result.Genre))
{
@@ -407,45 +408,50 @@ namespace MediaBrowser.Providers.Plugins.Omdb
item.Overview = result.Plot;
}
- //if (!string.IsNullOrWhiteSpace(result.Director))
- //{
- // var person = new PersonInfo
- // {
- // Name = result.Director.Trim(),
- // Type = PersonType.Director
- // };
-
- // itemResult.AddPerson(person);
- //}
-
- //if (!string.IsNullOrWhiteSpace(result.Writer))
- //{
- // var person = new PersonInfo
- // {
- // Name = result.Director.Trim(),
- // Type = PersonType.Writer
- // };
-
- // itemResult.AddPerson(person);
- //}
-
- //if (!string.IsNullOrWhiteSpace(result.Actors))
- //{
- // var actorList = result.Actors.Split(',');
- // foreach (var actor in actorList)
- // {
- // if (!string.IsNullOrWhiteSpace(actor))
- // {
- // var person = new PersonInfo
- // {
- // Name = actor.Trim(),
- // Type = PersonType.Actor
- // };
-
- // itemResult.AddPerson(person);
- // }
- // }
- //}
+ if (!Plugin.Instance.Configuration.CastAndCrew)
+ {
+ return;
+ }
+
+ if (!string.IsNullOrWhiteSpace(result.Director))
+ {
+ var person = new PersonInfo
+ {
+ Name = result.Director.Trim(),
+ Type = PersonType.Director
+ };
+
+ itemResult.AddPerson(person);
+ }
+
+ if (!string.IsNullOrWhiteSpace(result.Writer))
+ {
+ var person = new PersonInfo
+ {
+ Name = result.Director.Trim(),
+ Type = PersonType.Writer
+ };
+
+ itemResult.AddPerson(person);
+ }
+
+ if (!string.IsNullOrWhiteSpace(result.Actors))
+ {
+ var actorList = result.Actors.Split(',');
+ foreach (var actor in actorList)
+ {
+ if (!string.IsNullOrWhiteSpace(actor))
+ {
+ var person = new PersonInfo
+ {
+ Name = actor.Trim(),
+ Type = PersonType.Actor
+ };
+
+ itemResult.AddPerson(person);
+ }
+ }
+ }
}
private bool IsConfiguredForEnglish(BaseItem item)
@@ -459,40 +465,70 @@ namespace MediaBrowser.Providers.Plugins.Omdb
internal class SeasonRootObject
{
public string Title { get; set; }
+
public string seriesID { get; set; }
+
public int Season { get; set; }
+
public int? totalSeasons { get; set; }
+
public RootObject[] Episodes { get; set; }
+
public string Response { get; set; }
}
internal class RootObject
{
public string Title { get; set; }
+
public string Year { get; set; }
+
public string Rated { get; set; }
+
public string Released { get; set; }
+
public string Runtime { get; set; }
+
public string Genre { get; set; }
+
public string Director { get; set; }
+
public string Writer { get; set; }
+
public string Actors { get; set; }
+
public string Plot { get; set; }
+
public string Language { get; set; }
+
public string Country { get; set; }
+
public string Awards { get; set; }
+
public string Poster { get; set; }
+
public List<OmdbRating> Ratings { get; set; }
+
public string Metascore { get; set; }
+
public string imdbRating { get; set; }
+
public string imdbVotes { get; set; }
+
public string imdbID { get; set; }
+
public string Type { get; set; }
+
public string DVD { get; set; }
+
public string BoxOffice { get; set; }
+
public string Production { get; set; }
+
public string Website { get; set; }
+
public string Response { get; set; }
+
public int Episode { get; set; }
public float? GetRottenTomatoScore()
@@ -509,12 +545,15 @@ namespace MediaBrowser.Providers.Plugins.Omdb
}
}
}
+
return null;
}
}
+
public class OmdbRating
{
public string Source { get; set; }
+
public string Value { get; set; }
}
}
diff --git a/MediaBrowser.Providers/Plugins/Omdb/Plugin.cs b/MediaBrowser.Providers/Plugins/Omdb/Plugin.cs
new file mode 100644
index 000000000..6ce2333e0
--- /dev/null
+++ b/MediaBrowser.Providers/Plugins/Omdb/Plugin.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Plugins;
+using MediaBrowser.Model.Plugins;
+using MediaBrowser.Model.Serialization;
+
+namespace MediaBrowser.Providers.Plugins.Omdb
+{
+ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
+ {
+ public static Plugin Instance { get; private set; }
+
+ public override Guid Id => new Guid("a628c0da-fac5-4c7e-9d1a-7134223f14c8");
+
+ public override string Name => "OMDb";
+
+ public override string Description => "Get metadata for movies and other video content from OMDb.";
+
+ public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)
+ : base(applicationPaths, xmlSerializer)
+ {
+ Instance = this;
+ }
+
+ public IEnumerable<PluginPageInfo> GetPages()
+ {
+ yield return new PluginPageInfo
+ {
+ Name = Name,
+ EmbeddedResourcePath = GetType().Namespace + ".Configuration.config.html"
+ };
+ }
+ }
+}
diff --git a/MediaBrowser.Providers/Plugins/TheTvdb/Configuration/PluginConfiguration.cs b/MediaBrowser.Providers/Plugins/TheTvdb/Configuration/PluginConfiguration.cs
new file mode 100644
index 000000000..0a73634dc
--- /dev/null
+++ b/MediaBrowser.Providers/Plugins/TheTvdb/Configuration/PluginConfiguration.cs
@@ -0,0 +1,8 @@
+using MediaBrowser.Model.Plugins;
+
+namespace MediaBrowser.Providers.Plugins.TheTvdb
+{
+ public class PluginConfiguration : BasePluginConfiguration
+ {
+ }
+}
diff --git a/MediaBrowser.Providers/Plugins/TheTvdb/Plugin.cs b/MediaBrowser.Providers/Plugins/TheTvdb/Plugin.cs
new file mode 100644
index 000000000..2e6f548ca
--- /dev/null
+++ b/MediaBrowser.Providers/Plugins/TheTvdb/Plugin.cs
@@ -0,0 +1,24 @@
+using System;
+using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Plugins;
+using MediaBrowser.Model.Serialization;
+
+namespace MediaBrowser.Providers.Plugins.TheTvdb
+{
+ public class Plugin : BasePlugin<PluginConfiguration>
+ {
+ public static Plugin Instance { get; private set; }
+
+ public override Guid Id => new Guid("a677c0da-fac5-4cde-941a-7134223f14c8");
+
+ public override string Name => "TheTVDB";
+
+ public override string Description => "Get metadata for movies and other video content from TheTVDB.";
+
+ public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)
+ : base(applicationPaths, xmlSerializer)
+ {
+ Instance = this;
+ }
+ }
+}
diff --git a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbClientManager.cs b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbClientManager.cs
index b73834155..24d60deb9 100644
--- a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbClientManager.cs
+++ b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbClientManager.cs
@@ -120,6 +120,7 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
var cacheKey = GenerateKey("series", zap2ItId, language);
return TryGetValue(cacheKey, language, () => TvDbClient.Search.SearchSeriesByZap2ItIdAsync(zap2ItId, cancellationToken));
}
+
public Task<TvDbResponse<Actor[]>> GetActorsAsync(
int tvdbId,
string language,
@@ -190,7 +191,7 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
episodeQuery.AbsoluteNumber = searchInfo.IndexNumber.Value;
break;
default:
- //aired order
+ // aired order
episodeQuery.AiredEpisode = searchInfo.IndexNumber.Value;
episodeQuery.AiredSeason = searchInfo.ParentIndexNumber.Value;
break;
diff --git a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbEpisodeProvider.cs
index 08c2a74d2..5a4827d2f 100644
--- a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbEpisodeProvider.cs
+++ b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbEpisodeProvider.cs
@@ -14,9 +14,8 @@ using TvDbSharper.Dto;
namespace MediaBrowser.Providers.Plugins.TheTvdb
{
-
/// <summary>
- /// Class RemoteEpisodeProvider
+ /// Class RemoteEpisodeProvider.
/// </summary>
public class TvdbEpisodeProvider : IRemoteMetadataProvider<Episode, EpisodeInfo>, IHasOrder
{
@@ -139,7 +138,6 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
Name = episode.EpisodeName,
Overview = episode.Overview,
CommunityRating = (float?)episode.SiteRating,
-
}
};
result.ResetPeople();
diff --git a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbPersonImageProvider.cs b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbPersonImageProvider.cs
index c1cdc90e9..77425f1d2 100644
--- a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbPersonImageProvider.cs
+++ b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbPersonImageProvider.cs
@@ -57,7 +57,6 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
{
EnableImages = false
}
-
}).Cast<Series>()
.Where(i => TvdbSeriesProvider.IsValidSeries(i.ProviderIds))
.ToList();
diff --git a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeasonImageProvider.cs b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeasonImageProvider.cs
index a5d183df7..7abcd29ec 100644
--- a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeasonImageProvider.cs
+++ b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeasonImageProvider.cs
@@ -55,7 +55,7 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
if (series == null || !season.IndexNumber.HasValue || !TvdbSeriesProvider.IsValidSeries(series.ProviderIds))
{
- return new RemoteImageInfo[] { };
+ return Array.Empty<RemoteImageInfo>();
}
var tvdbId = Convert.ToInt32(series.GetProviderId(MetadataProviders.Tvdb));
@@ -113,8 +113,8 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
imageInfo.Type = TvdbUtils.GetImageTypeFromKeyType(image.KeyType);
list.Add(imageInfo);
}
- var isLanguageEn = string.Equals(preferredLanguage, "en", StringComparison.OrdinalIgnoreCase);
+ var isLanguageEn = string.Equals(preferredLanguage, "en", StringComparison.OrdinalIgnoreCase);
return list.OrderByDescending(i =>
{
if (string.Equals(preferredLanguage, i.Language, StringComparison.OrdinalIgnoreCase))
diff --git a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesImageProvider.cs b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesImageProvider.cs
index 1bad60756..f65707291 100644
--- a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesImageProvider.cs
+++ b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesImageProvider.cs
@@ -79,6 +79,7 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
tvdbId);
}
}
+
return remoteImages;
}
@@ -110,8 +111,8 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
imageInfo.Type = TvdbUtils.GetImageTypeFromKeyType(image.KeyType);
list.Add(imageInfo);
}
- var isLanguageEn = string.Equals(preferredLanguage, "en", StringComparison.OrdinalIgnoreCase);
+ var isLanguageEn = string.Equals(preferredLanguage, "en", StringComparison.OrdinalIgnoreCase);
return list.OrderByDescending(i =>
{
if (string.Equals(preferredLanguage, i.Language, StringComparison.OrdinalIgnoreCase))
diff --git a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesProvider.cs b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesProvider.cs
index f6cd249f5..d4fcad643 100644
--- a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesProvider.cs
+++ b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesProvider.cs
@@ -22,6 +22,7 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
public class TvdbSeriesProvider : IRemoteMetadataProvider<Series, SeriesInfo>, IHasOrder
{
internal static TvdbSeriesProvider Current { get; private set; }
+
private readonly IHttpClient _httpClient;
private readonly ILogger _logger;
private readonly ILibraryManager _libraryManager;
@@ -145,7 +146,6 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
private async Task<string> GetSeriesByRemoteId(string id, string idType, string language, CancellationToken cancellationToken)
{
-
TvDbResponse<SeriesSearchResult[]> result = null;
try
@@ -249,6 +249,7 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
ImageUrl = TvdbUtils.BannerUrl + seriesSearchResult.Banner
};
+
try
{
var seriesSesult =
@@ -274,11 +275,12 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
}
/// <summary>
- /// The remove
+ /// The remove.
/// </summary>
const string remove = "\"'!`?";
+
/// <summary>
- /// The spacers
+ /// The spacers.
/// </summary>
const string spacers = "/,.:;\\(){}[]+-_=–*"; // (there are two types of dashes, short and long)
@@ -315,8 +317,8 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
sb.Append(c);
}
}
- sb.Replace(", the", string.Empty).Replace("the ", " ").Replace(" the ", " ");
+ sb.Replace(", the", string.Empty).Replace("the ", " ").Replace(" the ", " ");
return Regex.Replace(sb.ToString().Trim(), @"\s+", " ");
}