mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-05 13:23:03 +02:00
Minor improvements to library scan code
This commit is contained in:
parent
3a5e3ade01
commit
35d97dc949
|
@ -22,17 +22,17 @@ namespace Emby.Naming.TV
|
||||||
throw new ArgumentNullException(nameof(path));
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
var isStub = false;
|
bool isStub = false;
|
||||||
string container = null;
|
string container = null;
|
||||||
string stubType = null;
|
string stubType = null;
|
||||||
|
|
||||||
if (!IsDirectory)
|
if (!IsDirectory)
|
||||||
{
|
{
|
||||||
var extension = Path.GetExtension(path) ?? string.Empty;
|
var extension = Path.GetExtension(path);
|
||||||
// Check supported extensions
|
// Check supported extensions
|
||||||
if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
|
if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var stubResult = new StubResolver(_options).ResolveFile(path);
|
var stubResult = StubResolver.ResolveFile(path, _options);
|
||||||
|
|
||||||
isStub = stubResult.IsStub;
|
isStub = stubResult.IsStub;
|
||||||
|
|
||||||
|
|
|
@ -5,21 +5,14 @@ using Emby.Naming.Common;
|
||||||
|
|
||||||
namespace Emby.Naming.Video
|
namespace Emby.Naming.Video
|
||||||
{
|
{
|
||||||
public class StubResolver
|
public static class StubResolver
|
||||||
{
|
{
|
||||||
private readonly NamingOptions _options;
|
public static StubResult ResolveFile(string path, NamingOptions options)
|
||||||
|
|
||||||
public StubResolver(NamingOptions options)
|
|
||||||
{
|
|
||||||
_options = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StubResult ResolveFile(string path)
|
|
||||||
{
|
{
|
||||||
var result = new StubResult();
|
var result = new StubResult();
|
||||||
var extension = Path.GetExtension(path) ?? string.Empty;
|
var extension = Path.GetExtension(path) ?? string.Empty;
|
||||||
|
|
||||||
if (_options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
|
if (options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
result.IsStub = true;
|
result.IsStub = true;
|
||||||
|
|
||||||
|
@ -27,12 +20,11 @@ namespace Emby.Naming.Video
|
||||||
|
|
||||||
var token = (Path.GetExtension(path) ?? string.Empty).TrimStart('.');
|
var token = (Path.GetExtension(path) ?? string.Empty).TrimStart('.');
|
||||||
|
|
||||||
foreach (var rule in _options.StubTypes)
|
foreach (var rule in options.StubTypes)
|
||||||
{
|
{
|
||||||
if (string.Equals(rule.Token, token, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(rule.Token, token, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
result.StubType = rule.StubType;
|
result.StubType = rule.StubType;
|
||||||
result.Tokens.Add(token);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Emby.Naming.Video
|
namespace Emby.Naming.Video
|
||||||
{
|
{
|
||||||
public class StubResult
|
public struct StubResult
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether this instance is stub.
|
/// Gets or sets a value indicating whether this instance is stub.
|
||||||
|
@ -14,15 +12,5 @@ namespace Emby.Naming.Video
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The type of the stub.</value>
|
/// <value>The type of the stub.</value>
|
||||||
public string StubType { get; set; }
|
public string StubType { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the tokens.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The tokens.</value>
|
|
||||||
public List<string> Tokens { get; set; }
|
|
||||||
|
|
||||||
public StubResult()
|
|
||||||
{
|
|
||||||
Tokens = new List<string>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,17 +48,17 @@ namespace Emby.Naming.Video
|
||||||
throw new ArgumentNullException(nameof(path));
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
var isStub = false;
|
bool isStub = false;
|
||||||
string container = null;
|
string container = null;
|
||||||
string stubType = null;
|
string stubType = null;
|
||||||
|
|
||||||
if (!IsDirectory)
|
if (!IsDirectory)
|
||||||
{
|
{
|
||||||
var extension = Path.GetExtension(path) ?? string.Empty;
|
var extension = Path.GetExtension(path);
|
||||||
// Check supported extensions
|
// Check supported extensions
|
||||||
if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
|
if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var stubResult = new StubResolver(_options).ResolveFile(path);
|
var stubResult = StubResolver.ResolveFile(path, _options);
|
||||||
|
|
||||||
isStub = stubResult.IsStub;
|
isStub = stubResult.IsStub;
|
||||||
|
|
||||||
|
@ -79,9 +79,9 @@ namespace Emby.Naming.Video
|
||||||
|
|
||||||
var extraResult = new ExtraResolver(_options).GetExtraInfo(path);
|
var extraResult = new ExtraResolver(_options).GetExtraInfo(path);
|
||||||
|
|
||||||
var name = !IsDirectory
|
var name = IsDirectory
|
||||||
? Path.GetFileNameWithoutExtension(path)
|
? Path.GetFileName(path)
|
||||||
: Path.GetFileName(path);
|
: Path.GetFileNameWithoutExtension(path);
|
||||||
|
|
||||||
int? year = null;
|
int? year = null;
|
||||||
|
|
||||||
|
@ -91,8 +91,7 @@ namespace Emby.Naming.Video
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(extraResult.ExtraType))
|
if (string.IsNullOrEmpty(extraResult.ExtraType))
|
||||||
{
|
{
|
||||||
name = cleanDateTimeResult.Name;
|
name = CleanString(cleanDateTimeResult.Name).Name;
|
||||||
name = CleanString(name).Name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
year = cleanDateTimeResult.Year;
|
year = cleanDateTimeResult.Year;
|
||||||
|
|
|
@ -264,7 +264,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
|
|
||||||
var responseCachePath = Path.Combine(_appPaths.CachePath, "httpclient", urlHash);
|
var responseCachePath = Path.Combine(_appPaths.CachePath, "httpclient", urlHash);
|
||||||
|
|
||||||
var response = await GetCachedResponse(responseCachePath, options.CacheLength, url).ConfigureAwait(false);
|
var response = GetCachedResponse(responseCachePath, options.CacheLength, url);
|
||||||
if (response != null)
|
if (response != null)
|
||||||
{
|
{
|
||||||
return response;
|
return response;
|
||||||
|
@ -280,30 +280,24 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<HttpResponseInfo> GetCachedResponse(string responseCachePath, TimeSpan cacheLength, string url)
|
private HttpResponseInfo GetCachedResponse(string responseCachePath, TimeSpan cacheLength, string url)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_fileSystem.GetLastWriteTimeUtc(responseCachePath).Add(cacheLength) > DateTime.UtcNow)
|
if (_fileSystem.GetLastWriteTimeUtc(responseCachePath).Add(cacheLength) > DateTime.UtcNow)
|
||||||
{
|
{
|
||||||
using (var stream = _fileSystem.GetFileStream(responseCachePath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read, true))
|
var stream = _fileSystem.GetFileStream(responseCachePath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read, true);
|
||||||
|
|
||||||
|
return new HttpResponseInfo
|
||||||
{
|
{
|
||||||
var memoryStream = new MemoryStream();
|
ResponseUrl = url,
|
||||||
|
Content = stream,
|
||||||
await stream.CopyToAsync(memoryStream).ConfigureAwait(false);
|
StatusCode = HttpStatusCode.OK,
|
||||||
memoryStream.Position = 0;
|
ContentLength = stream.Length
|
||||||
|
};
|
||||||
return new HttpResponseInfo
|
|
||||||
{
|
|
||||||
ResponseUrl = url,
|
|
||||||
Content = memoryStream,
|
|
||||||
StatusCode = HttpStatusCode.OK,
|
|
||||||
ContentLength = memoryStream.Length
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException)
|
catch (FileNotFoundException) // REVIEW: @bond Is this really faster?
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -319,19 +313,11 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
{
|
{
|
||||||
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(responseCachePath));
|
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(responseCachePath));
|
||||||
|
|
||||||
using (var responseStream = response.Content)
|
using (var fileStream = _fileSystem.GetFileStream(responseCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true))
|
||||||
{
|
{
|
||||||
var memoryStream = new MemoryStream();
|
await response.Content.CopyToAsync(fileStream).ConfigureAwait(false);
|
||||||
await responseStream.CopyToAsync(memoryStream).ConfigureAwait(false);
|
|
||||||
memoryStream.Position = 0;
|
|
||||||
|
|
||||||
using (var fileStream = _fileSystem.GetFileStream(responseCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true))
|
response.Content.Position = 0;
|
||||||
{
|
|
||||||
await memoryStream.CopyToAsync(fileStream).ConfigureAwait(false);
|
|
||||||
|
|
||||||
memoryStream.Position = 0;
|
|
||||||
response.Content = memoryStream;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -445,10 +445,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, FileOpenOptions fileOpenOptions)
|
public Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, FileOpenOptions fileOpenOptions)
|
||||||
{
|
=> new FileStream(path, GetFileMode(mode), GetFileAccess(access), GetFileShare(share), 4096, GetFileOptions(fileOpenOptions));
|
||||||
var defaultBufferSize = 4096;
|
|
||||||
return new FileStream(path, GetFileMode(mode), GetFileAccess(access), GetFileShare(share), defaultBufferSize, GetFileOptions(fileOpenOptions));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static FileOptions GetFileOptions(FileOpenOptions mode)
|
private static FileOptions GetFileOptions(FileOpenOptions mode)
|
||||||
{
|
{
|
||||||
|
@ -759,18 +756,13 @@ namespace Emby.Server.Implementations.IO
|
||||||
// Only include drives in the ready state or this method could end up being very slow, waiting for drives to timeout
|
// Only include drives in the ready state or this method could end up being very slow, waiting for drives to timeout
|
||||||
return DriveInfo.GetDrives().Where(d => d.IsReady).Select(d => new FileSystemMetadata
|
return DriveInfo.GetDrives().Where(d => d.IsReady).Select(d => new FileSystemMetadata
|
||||||
{
|
{
|
||||||
Name = GetName(d),
|
Name = d.Name,
|
||||||
FullName = d.RootDirectory.FullName,
|
FullName = d.RootDirectory.FullName,
|
||||||
IsDirectory = true
|
IsDirectory = true
|
||||||
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetName(DriveInfo drive)
|
|
||||||
{
|
|
||||||
return drive.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<FileSystemMetadata> GetDirectories(string path, bool recursive = false)
|
public IEnumerable<FileSystemMetadata> GetDirectories(string path, bool recursive = false)
|
||||||
{
|
{
|
||||||
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
|
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
|
||||||
|
@ -846,17 +838,6 @@ namespace Emby.Server.Implementations.IO
|
||||||
return File.OpenRead(path);
|
return File.OpenRead(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CopyFileUsingStreams(string source, string target, bool overwrite)
|
|
||||||
{
|
|
||||||
using (var sourceStream = OpenRead(source))
|
|
||||||
{
|
|
||||||
using (var targetStream = GetFileStream(target, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
|
||||||
{
|
|
||||||
sourceStream.CopyTo(targetStream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CopyFile(string source, string target, bool overwrite)
|
public void CopyFile(string source, string target, bool overwrite)
|
||||||
{
|
{
|
||||||
File.Copy(source, target, overwrite);
|
File.Copy(source, target, overwrite);
|
||||||
|
|
|
@ -107,7 +107,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsSeriesFolder(string path,
|
public static bool IsSeriesFolder(
|
||||||
|
string path,
|
||||||
IEnumerable<FileSystemMetadata> fileSystemChildren,
|
IEnumerable<FileSystemMetadata> fileSystemChildren,
|
||||||
IDirectoryService directoryService,
|
IDirectoryService directoryService,
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem,
|
||||||
|
@ -135,7 +136,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
{
|
{
|
||||||
if (IsSeasonFolder(child.FullName, isTvContentType, libraryManager))
|
if (IsSeasonFolder(child.FullName, isTvContentType, libraryManager))
|
||||||
{
|
{
|
||||||
//logger.LogDebug("{0} is a series because of season folder {1}.", path, child.FullName);
|
logger.LogDebug("{Path} is a series because of season folder {Dir}.", path, child.FullName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +162,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
isOptimistic = false;
|
isOptimistic = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var episodeInfo = episodeResolver.Resolve(fullName, false, isNamed, isOptimistic, null, false);
|
var episodeInfo = episodeResolver.Resolve(fullName, false, isNamed, isOptimistic, fillExtendedInfo: false);
|
||||||
if (episodeInfo != null && episodeInfo.EpisodeNumber.HasValue)
|
if (episodeInfo != null && episodeInfo.EpisodeNumber.HasValue)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -170,7 +171,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//logger.LogDebug("{0} is not a series folder.", path);
|
logger.LogDebug("{Path} is not a series folder.", path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1403,9 +1403,9 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
private async Task<bool> RefreshLocalTrailers(IHasTrailers item, MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
|
private async Task<bool> RefreshLocalTrailers(IHasTrailers item, MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var newItems = LibraryManager.FindTrailers(this, fileSystemChildren, options.DirectoryService).ToList();
|
var newItems = LibraryManager.FindTrailers(this, fileSystemChildren, options.DirectoryService);
|
||||||
|
|
||||||
var newItemIds = newItems.Select(i => i.Id).ToArray();
|
var newItemIds = newItems.Select(i => i.Id);
|
||||||
|
|
||||||
var itemsChanged = !item.LocalTrailerIds.SequenceEqual(newItemIds);
|
var itemsChanged = !item.LocalTrailerIds.SequenceEqual(newItemIds);
|
||||||
var ownerId = item.Id;
|
var ownerId = item.Id;
|
||||||
|
@ -1414,8 +1414,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
var subOptions = new MetadataRefreshOptions(options);
|
var subOptions = new MetadataRefreshOptions(options);
|
||||||
|
|
||||||
if (!i.ExtraType.HasValue ||
|
if (i.ExtraType != Model.Entities.ExtraType.Trailer ||
|
||||||
i.ExtraType.Value != Model.Entities.ExtraType.Trailer ||
|
|
||||||
i.OwnerId != ownerId ||
|
i.OwnerId != ownerId ||
|
||||||
!i.ParentId.Equals(Guid.Empty))
|
!i.ParentId.Equals(Guid.Empty))
|
||||||
{
|
{
|
||||||
|
@ -1430,7 +1429,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
|
|
||||||
item.LocalTrailerIds = newItemIds;
|
item.LocalTrailerIds = newItemIds.ToArray();
|
||||||
|
|
||||||
return itemsChanged;
|
return itemsChanged;
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,13 +177,7 @@ namespace MediaBrowser.Providers.TV
|
||||||
|
|
||||||
private async Task<MetadataResult<Series>> FetchMovieData(string tmdbId, string language, string preferredCountryCode, CancellationToken cancellationToken)
|
private async Task<MetadataResult<Series>> FetchMovieData(string tmdbId, string language, string preferredCountryCode, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
string dataFilePath = null;
|
RootObject seriesInfo = await FetchMainResult(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
||||||
RootObject seriesInfo = null;
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(tmdbId))
|
|
||||||
{
|
|
||||||
seriesInfo = await FetchMainResult(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (seriesInfo == null)
|
if (seriesInfo == null)
|
||||||
{
|
{
|
||||||
|
@ -192,7 +186,7 @@ namespace MediaBrowser.Providers.TV
|
||||||
|
|
||||||
tmdbId = seriesInfo.id.ToString(_usCulture);
|
tmdbId = seriesInfo.id.ToString(_usCulture);
|
||||||
|
|
||||||
dataFilePath = GetDataFilePath(tmdbId, language);
|
string dataFilePath = GetDataFilePath(tmdbId, language);
|
||||||
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath));
|
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath));
|
||||||
_jsonSerializer.SerializeToFile(seriesInfo, dataFilePath);
|
_jsonSerializer.SerializeToFile(seriesInfo, dataFilePath);
|
||||||
|
|
||||||
|
@ -220,7 +214,7 @@ namespace MediaBrowser.Providers.TV
|
||||||
|
|
||||||
string voteAvg = seriesInfo.vote_average.ToString(CultureInfo.InvariantCulture);
|
string voteAvg = seriesInfo.vote_average.ToString(CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
if (float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var rating))
|
if (float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out float rating))
|
||||||
{
|
{
|
||||||
series.CommunityRating = rating;
|
series.CommunityRating = rating;
|
||||||
}
|
}
|
||||||
|
@ -293,14 +287,11 @@ namespace MediaBrowser.Providers.TV
|
||||||
{
|
{
|
||||||
foreach (var video in seriesInfo.videos.results)
|
foreach (var video in seriesInfo.videos.results)
|
||||||
{
|
{
|
||||||
if (video.type.Equals("trailer", System.StringComparison.OrdinalIgnoreCase)
|
if ((video.type.Equals("trailer", StringComparison.OrdinalIgnoreCase)
|
||||||
|| video.type.Equals("clip", System.StringComparison.OrdinalIgnoreCase))
|
|| video.type.Equals("clip", StringComparison.OrdinalIgnoreCase))
|
||||||
|
&& video.site.Equals("youtube", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
if (video.site.Equals("youtube", System.StringComparison.OrdinalIgnoreCase))
|
series.AddTrailerUrl($"http://www.youtube.com/watch?v={video.key}");
|
||||||
{
|
|
||||||
var videoUrl = string.Format("http://www.youtube.com/watch?v={0}", video.key);
|
|
||||||
series.AddTrailerUrl(videoUrl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,9 +342,12 @@ namespace MediaBrowser.Providers.TV
|
||||||
|
|
||||||
internal async Task DownloadSeriesInfo(string id, string preferredMetadataLanguage, CancellationToken cancellationToken)
|
internal async Task DownloadSeriesInfo(string id, string preferredMetadataLanguage, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var mainResult = await FetchMainResult(id, preferredMetadataLanguage, cancellationToken).ConfigureAwait(false);
|
RootObject mainResult = await FetchMainResult(id, preferredMetadataLanguage, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (mainResult == null) return;
|
if (mainResult == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var dataFilePath = GetDataFilePath(id, preferredMetadataLanguage);
|
var dataFilePath = GetDataFilePath(id, preferredMetadataLanguage);
|
||||||
|
|
||||||
|
@ -368,10 +362,8 @@ namespace MediaBrowser.Providers.TV
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(language))
|
if (!string.IsNullOrEmpty(language))
|
||||||
{
|
{
|
||||||
url += string.Format("&language={0}", MovieDbProvider.NormalizeLanguage(language));
|
url += "&language=" + MovieDbProvider.NormalizeLanguage(language)
|
||||||
|
+ "&include_image_language=" + MovieDbProvider.GetImageLanguagesParam(language); // Get images in english and with no language
|
||||||
// Get images in english and with no language
|
|
||||||
url += "&include_image_language=" + MovieDbProvider.GetImageLanguagesParam(language);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
@ -405,7 +397,7 @@ namespace MediaBrowser.Providers.TV
|
||||||
!string.IsNullOrEmpty(language) &&
|
!string.IsNullOrEmpty(language) &&
|
||||||
!string.Equals(language, "en", StringComparison.OrdinalIgnoreCase))
|
!string.Equals(language, "en", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("MovieDbSeriesProvider couldn't find meta for language " + language + ". Trying English...");
|
_logger.LogInformation("MovieDbSeriesProvider couldn't find meta for language {Language}. Trying English...", language);
|
||||||
|
|
||||||
url = string.Format(GetTvInfo3, id, MovieDbProvider.ApiKey) + "&language=en";
|
url = string.Format(GetTvInfo3, id, MovieDbProvider.ApiKey) + "&language=en";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue