fix some easy warnings for tmdb

This commit is contained in:
dkanada 2020-05-31 15:28:01 +09:00
parent 685f8ad1f0
commit 855a2b2892
9 changed files with 19 additions and 12 deletions

View File

@ -105,6 +105,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
{
return 3;
}
if (!isLanguageEn)
{
if (string.Equals("en", i.Language, StringComparison.OrdinalIgnoreCase))
@ -112,10 +113,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
return 2;
}
}
if (string.IsNullOrEmpty(i.Language))
{
return isLanguageEn ? 3 : 2;
}
return 0;
})
.ThenByDescending(i => i.CommunityRating ?? 0)

View File

@ -78,9 +78,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
var result = new RemoteSearchResult
{
Name = info.Name,
SearchProviderName = Name,
ImageUrl = images.Count == 0 ? null : (tmdbImageUrl + images[0].File_Path)
};
@ -191,7 +189,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
Url = url,
CancellationToken = cancellationToken,
AcceptHeader = TmdbUtils.AcceptHeader
}).ConfigureAwait(false))
{
using (var json = response.Content)
@ -219,7 +216,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
Url = url,
CancellationToken = cancellationToken,
AcceptHeader = TmdbUtils.AcceptHeader
}).ConfigureAwait(false))
{
using (var json = response.Content)
@ -229,6 +225,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
}
}
}
return mainResult;
}

View File

@ -80,7 +80,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
RatingType = RatingType.Score
}));
var isLanguageEn = string.Equals(language, "en", StringComparison.OrdinalIgnoreCase);
return list.OrderByDescending(i =>
@ -89,6 +88,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
{
return 3;
}
if (!isLanguageEn)
{
if (string.Equals("en", i.Language, StringComparison.OrdinalIgnoreCase))
@ -96,15 +96,16 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
return 2;
}
}
if (string.IsNullOrEmpty(i.Language))
{
return isLanguageEn ? 3 : 2;
}
return 0;
})
.ThenByDescending(i => i.CommunityRating ?? 0)
.ThenByDescending(i => i.VoteCount ?? 0);
}
private IEnumerable<Still> GetPosters(StillImages images)
@ -112,7 +113,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
return images.Stills ?? new List<Still>();
}
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
{
return GetResponse(url, cancellationToken);

View File

@ -203,6 +203,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
{
return GetResponse(url, cancellationToken);
}
// After TheTvDb
public int Order => 1;

View File

@ -53,6 +53,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
{
throw new ArgumentNullException(nameof(tmdbId));
}
if (string.IsNullOrEmpty(language))
{
throw new ArgumentNullException(nameof(language));
@ -80,6 +81,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
{
throw new ArgumentNullException(nameof(tmdbId));
}
if (string.IsNullOrEmpty(preferredLanguage))
{
throw new ArgumentNullException(nameof(preferredLanguage));

View File

@ -145,6 +145,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
{
throw new ArgumentNullException(nameof(tmdbId));
}
if (string.IsNullOrEmpty(language))
{
throw new ArgumentNullException(nameof(language));
@ -172,6 +173,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
{
throw new ArgumentNullException(nameof(tmdbId));
}
if (string.IsNullOrEmpty(preferredLanguage))
{
throw new ArgumentNullException(nameof(preferredLanguage));
@ -216,7 +218,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
Url = url,
CancellationToken = cancellationToken,
AcceptHeader = TmdbUtils.AcceptHeader
}).ConfigureAwait(false))
{
using (var json = response.Content)

View File

@ -99,6 +99,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
{
return 3;
}
if (!isLanguageEn)
{
if (string.Equals("en", i.Language, StringComparison.OrdinalIgnoreCase))
@ -106,10 +107,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
return 2;
}
}
if (string.IsNullOrEmpty(i.Language))
{
return isLanguageEn ? 3 : 2;
}
return 0;
})
.ThenByDescending(i => i.CommunityRating ?? 0)
@ -171,6 +174,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
return null;
}
// After tvdb and fanart
public int Order => 2;

View File

@ -263,10 +263,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
{
series.SetProviderId(MetadataProviders.Imdb, ids.Imdb_Id);
}
if (ids.Tvrage_Id > 0)
{
series.SetProviderId(MetadataProviders.TvRage, ids.Tvrage_Id.ToString(_usCulture));
}
if (ids.Tvdb_Id > 0)
{
series.SetProviderId(MetadataProviders.Tvdb, ids.Tvdb_Id.ToString(_usCulture));
@ -416,7 +418,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
Url = url,
CancellationToken = cancellationToken,
AcceptHeader = TmdbUtils.AcceptHeader
}).ConfigureAwait(false))
{
using (var json = response.Content)
@ -453,7 +454,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
Url = url,
CancellationToken = cancellationToken,
AcceptHeader = TmdbUtils.AcceptHeader
}).ConfigureAwait(false))
{
using (var json = response.Content)
@ -518,7 +518,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
Url = url,
CancellationToken = cancellationToken,
AcceptHeader = TmdbUtils.AcceptHeader
}).ConfigureAwait(false))
{
using (var json = response.Content)

View File

@ -5,7 +5,7 @@ using MediaBrowser.Providers.Plugins.Tmdb.Models.General;
namespace MediaBrowser.Providers.Plugins.Tmdb
{
/// <summary>
/// Utilities for the TMDb provider
/// Utilities for the TMDb provider.
/// </summary>
public static class TmdbUtils
{