mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 21:37:10 -04:00
Merge pull request #5985 from Bond-009/minor11
This commit is contained in:
commit
95b1cf532b
@ -11,6 +11,12 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||||||
public abstract class ItemResolver<T> : IItemResolver
|
public abstract class ItemResolver<T> : IItemResolver
|
||||||
where T : BaseItem, new()
|
where T : BaseItem, new()
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the priority.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The priority.</value>
|
||||||
|
public virtual ResolverPriority Priority => ResolverPriority.First;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resolves the specified args.
|
/// Resolves the specified args.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -21,12 +27,6 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the priority.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The priority.</value>
|
|
||||||
public virtual ResolverPriority Priority => ResolverPriority.First;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets initial values on the newly resolved item.
|
/// Sets initial values on the newly resolved item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -376,7 +376,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
|||||||
{
|
{
|
||||||
var multiDiscFolders = new List<FileSystemMetadata>();
|
var multiDiscFolders = new List<FileSystemMetadata>();
|
||||||
|
|
||||||
var libraryOptions = args.GetLibraryOptions();
|
var libraryOptions = args.LibraryOptions;
|
||||||
var supportPhotos = string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && libraryOptions.EnablePhotos;
|
var supportPhotos = string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && libraryOptions.EnablePhotos;
|
||||||
var photos = new List<FileSystemMetadata>();
|
var photos = new List<FileSystemMetadata>();
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||||||
public class PhotoAlbumResolver : FolderResolver<PhotoAlbum>
|
public class PhotoAlbumResolver : FolderResolver<PhotoAlbum>
|
||||||
{
|
{
|
||||||
private readonly IImageProcessor _imageProcessor;
|
private readonly IImageProcessor _imageProcessor;
|
||||||
private ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="PhotoAlbumResolver"/> class.
|
/// Initializes a new instance of the <see cref="PhotoAlbumResolver"/> class.
|
||||||
@ -26,6 +26,9 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override ResolverPriority Priority => ResolverPriority.Second;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resolves the specified args.
|
/// Resolves the specified args.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -39,8 +42,8 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||||||
// Must be an image file within a photo collection
|
// Must be an image file within a photo collection
|
||||||
var collectionType = args.GetCollectionType();
|
var collectionType = args.GetCollectionType();
|
||||||
|
|
||||||
if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase) ||
|
if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase)
|
||||||
(string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && args.GetLibraryOptions().EnablePhotos))
|
|| (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && args.LibraryOptions.EnablePhotos))
|
||||||
{
|
{
|
||||||
if (HasPhotos(args))
|
if (HasPhotos(args))
|
||||||
{
|
{
|
||||||
@ -84,8 +87,5 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override ResolverPriority Priority => ResolverPriority.Second;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||||||
var collectionType = args.CollectionType;
|
var collectionType = args.CollectionType;
|
||||||
|
|
||||||
if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase)
|
if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase)
|
||||||
|| (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && args.GetLibraryOptions().EnablePhotos))
|
|| (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && args.LibraryOptions.EnablePhotos))
|
||||||
{
|
{
|
||||||
if (IsImageFile(args.Path, _imageProcessor))
|
if (IsImageFile(args.Path, _imageProcessor))
|
||||||
{
|
{
|
||||||
|
@ -88,7 +88,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||||||
CultureInfo.InvariantCulture,
|
CultureInfo.InvariantCulture,
|
||||||
_localization.GetLocalizedString("NameSeasonNumber"),
|
_localization.GetLocalizedString("NameSeasonNumber"),
|
||||||
seasonNumber,
|
seasonNumber,
|
||||||
args.GetLibraryOptions().PreferredMetadataLanguage);
|
args.LibraryOptions.PreferredMetadataLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
return season;
|
return season;
|
||||||
|
@ -19,19 +19,16 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class SeriesResolver : FolderResolver<Series>
|
public class SeriesResolver : FolderResolver<Series>
|
||||||
{
|
{
|
||||||
private readonly IFileSystem _fileSystem;
|
|
||||||
private readonly ILogger<SeriesResolver> _logger;
|
private readonly ILogger<SeriesResolver> _logger;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SeriesResolver"/> class.
|
/// Initializes a new instance of the <see cref="SeriesResolver"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="fileSystem">The file system.</param>
|
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
/// <param name="libraryManager">The library manager.</param>
|
||||||
public SeriesResolver(IFileSystem fileSystem, ILogger<SeriesResolver> logger, ILibraryManager libraryManager)
|
public SeriesResolver(ILogger<SeriesResolver> logger, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_fileSystem = fileSystem;
|
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
@ -59,15 +56,6 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||||||
var collectionType = args.GetCollectionType();
|
var collectionType = args.GetCollectionType();
|
||||||
if (string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
// if (args.ContainsFileSystemEntryByName("tvshow.nfo"))
|
|
||||||
//{
|
|
||||||
// return new Series
|
|
||||||
// {
|
|
||||||
// Path = args.Path,
|
|
||||||
// Name = Path.GetFileName(args.Path)
|
|
||||||
// };
|
|
||||||
//}
|
|
||||||
|
|
||||||
var configuredContentType = _libraryManager.GetConfiguredContentType(args.Path);
|
var configuredContentType = _libraryManager.GetConfiguredContentType(args.Path);
|
||||||
if (!string.Equals(configuredContentType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(configuredContentType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
@ -100,7 +88,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsSeriesFolder(args.Path, args.FileSystemChildren, args.DirectoryService, _fileSystem, _logger, _libraryManager, false))
|
if (IsSeriesFolder(args.Path, args.FileSystemChildren, _logger, _libraryManager, false))
|
||||||
{
|
{
|
||||||
return new Series
|
return new Series
|
||||||
{
|
{
|
||||||
@ -117,8 +105,6 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||||||
public static bool IsSeriesFolder(
|
public static bool IsSeriesFolder(
|
||||||
string path,
|
string path,
|
||||||
IEnumerable<FileSystemMetadata> fileSystemChildren,
|
IEnumerable<FileSystemMetadata> fileSystemChildren,
|
||||||
IDirectoryService directoryService,
|
|
||||||
IFileSystem fileSystem,
|
|
||||||
ILogger<SeriesResolver> logger,
|
ILogger<SeriesResolver> logger,
|
||||||
ILibraryManager libraryManager,
|
ILibraryManager libraryManager,
|
||||||
bool isTvContentType)
|
bool isTvContentType)
|
||||||
|
@ -61,7 +61,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = XmlSerializer.DeserializeFromFile(typeof(LibraryOptions), GetLibraryOptionsPath(path)) as LibraryOptions;
|
var result = XmlSerializer.DeserializeFromFile(typeof(LibraryOptions), GetLibraryOptionsPath(path)) as LibraryOptions;
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
return new LibraryOptions();
|
return new LibraryOptions();
|
||||||
|
@ -100,23 +100,5 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
existing.SetProviderId(id.Key, id.Value);
|
existing.SetProviderId(id.Key, id.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ContainsPerson(List<PersonInfo> people, string name)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(name))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var i in people)
|
|
||||||
{
|
|
||||||
if (string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,14 +14,14 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// These are arguments relating to the file system that are collected once and then referred to
|
/// These are arguments relating to the file system that are collected once and then referred to
|
||||||
/// whenever needed. Primarily for entity resolution.
|
/// whenever needed. Primarily for entity resolution.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ItemResolveArgs : EventArgs
|
public class ItemResolveArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _app paths.
|
/// The _app paths.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly IServerApplicationPaths _appPaths;
|
private readonly IServerApplicationPaths _appPaths;
|
||||||
|
|
||||||
public IDirectoryService DirectoryService { get; private set; }
|
private LibraryOptions _libraryOptions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ItemResolveArgs" /> class.
|
/// Initializes a new instance of the <see cref="ItemResolveArgs" /> class.
|
||||||
@ -34,17 +34,18 @@ namespace MediaBrowser.Controller.Library
|
|||||||
DirectoryService = directoryService;
|
DirectoryService = directoryService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IDirectoryService DirectoryService { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the file system children.
|
/// Gets the file system children.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The file system children.</value>
|
/// <value>The file system children.</value>
|
||||||
public FileSystemMetadata[] FileSystemChildren { get; set; }
|
public FileSystemMetadata[] FileSystemChildren { get; set; }
|
||||||
|
|
||||||
public LibraryOptions LibraryOptions { get; set; }
|
public LibraryOptions LibraryOptions
|
||||||
|
|
||||||
public LibraryOptions GetLibraryOptions()
|
|
||||||
{
|
{
|
||||||
return LibraryOptions ?? (LibraryOptions = Parent == null ? new LibraryOptions() : BaseItem.LibraryManager.GetLibraryOptions(Parent));
|
get => _libraryOptions ??= Parent == null ? new LibraryOptions() : BaseItem.LibraryManager.GetLibraryOptions(Parent);
|
||||||
|
set => _libraryOptions = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -139,7 +140,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// Adds the additional location.
|
/// Adds the additional location.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <exception cref="ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <c>null</c> or empty.</exception>
|
||||||
public void AddAdditionalLocation(string path)
|
public void AddAdditionalLocation(string path)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
@ -148,7 +149,6 @@ namespace MediaBrowser.Controller.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
AdditionalLocations ??= new List<string>();
|
AdditionalLocations ??= new List<string>();
|
||||||
|
|
||||||
AdditionalLocations.Add(path);
|
AdditionalLocations.Add(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The name.</param>
|
/// <param name="name">The name.</param>
|
||||||
/// <returns>FileSystemInfo.</returns>
|
/// <returns>FileSystemInfo.</returns>
|
||||||
/// <exception cref="ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"><paramref name="name"/> is <c>null</c> or empty.</exception>
|
||||||
public FileSystemMetadata GetFileSystemEntryByName(string name)
|
public FileSystemMetadata GetFileSystemEntryByName(string name)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(name))
|
if (string.IsNullOrEmpty(name))
|
||||||
|
@ -10,6 +10,12 @@ namespace MediaBrowser.Controller.Resolvers
|
|||||||
public abstract class ItemResolver<T> : IItemResolver
|
public abstract class ItemResolver<T> : IItemResolver
|
||||||
where T : BaseItem, new()
|
where T : BaseItem, new()
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the priority.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The priority.</value>
|
||||||
|
public virtual ResolverPriority Priority => ResolverPriority.First;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resolves the specified args.
|
/// Resolves the specified args.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -20,12 +26,6 @@ namespace MediaBrowser.Controller.Resolvers
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the priority.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The priority.</value>
|
|
||||||
public virtual ResolverPriority Priority => ResolverPriority.First;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets initial values on the newly resolved item.
|
/// Sets initial values on the newly resolved item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -29,7 +29,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
|
|
||||||
private List<string> _splitWhiteList = null;
|
private string[] _splitWhiteList;
|
||||||
|
|
||||||
public ProbeResultNormalizer(ILogger logger, ILocalizationManager localization)
|
public ProbeResultNormalizer(ILogger logger, ILocalizationManager localization)
|
||||||
{
|
{
|
||||||
@ -37,6 +37,8 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||||||
_localization = localization;
|
_localization = localization;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IReadOnlyList<string> SplitWhitelist => _splitWhiteList ??= new string[] { "AC/DC" };
|
||||||
|
|
||||||
public MediaInfo GetMediaInfo(InternalMediaInfoResult data, VideoType? videoType, bool isAudio, string path, MediaProtocol protocol)
|
public MediaInfo GetMediaInfo(InternalMediaInfoResult data, VideoType? videoType, bool isAudio, string path, MediaProtocol protocol)
|
||||||
{
|
{
|
||||||
var info = new MediaInfo
|
var info = new MediaInfo
|
||||||
@ -1254,7 +1256,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||||||
|
|
||||||
var artistsFound = new List<string>();
|
var artistsFound = new List<string>();
|
||||||
|
|
||||||
foreach (var whitelistArtist in GetSplitWhitelist())
|
foreach (var whitelistArtist in SplitWhitelist)
|
||||||
{
|
{
|
||||||
var originalVal = val;
|
var originalVal = val;
|
||||||
val = val.Replace(whitelistArtist, "|", StringComparison.OrdinalIgnoreCase);
|
val = val.Replace(whitelistArtist, "|", StringComparison.OrdinalIgnoreCase);
|
||||||
@ -1273,11 +1275,6 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||||||
return artistsFound;
|
return artistsFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<string> GetSplitWhitelist()
|
|
||||||
{
|
|
||||||
return _splitWhiteList ??= new List<string> { "AC/DC" };
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the studios from the tags collection.
|
/// Gets the studios from the tags collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -163,7 +163,7 @@ namespace MediaBrowser.Model.Entities
|
|||||||
foreach (var tag in attributes)
|
foreach (var tag in attributes)
|
||||||
{
|
{
|
||||||
// Keep Tags that are not already in Title.
|
// Keep Tags that are not already in Title.
|
||||||
if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
|
if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
result.Append(" - ").Append(tag);
|
result.Append(" - ").Append(tag);
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ namespace MediaBrowser.Model.Entities
|
|||||||
foreach (var tag in attributes)
|
foreach (var tag in attributes)
|
||||||
{
|
{
|
||||||
// Keep Tags that are not already in Title.
|
// Keep Tags that are not already in Title.
|
||||||
if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
|
if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
result.Append(" - ").Append(tag);
|
result.Append(" - ").Append(tag);
|
||||||
}
|
}
|
||||||
@ -522,9 +522,9 @@ namespace MediaBrowser.Model.Entities
|
|||||||
|
|
||||||
// sub = external .sub file
|
// sub = external .sub file
|
||||||
|
|
||||||
return codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) == -1 &&
|
return !codec.Contains("pgs", StringComparison.OrdinalIgnoreCase) &&
|
||||||
codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) == -1 &&
|
!codec.Contains("dvd", StringComparison.OrdinalIgnoreCase) &&
|
||||||
codec.IndexOf("dvbsub", StringComparison.OrdinalIgnoreCase) == -1 &&
|
!codec.Contains("dvbsub", StringComparison.OrdinalIgnoreCase) &&
|
||||||
!string.Equals(codec, "sub", StringComparison.OrdinalIgnoreCase) &&
|
!string.Equals(codec, "sub", StringComparison.OrdinalIgnoreCase) &&
|
||||||
!string.Equals(codec, "dvb_subtitle", StringComparison.OrdinalIgnoreCase);
|
!string.Equals(codec, "dvb_subtitle", StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ namespace MediaBrowser.Providers.Subtitles
|
|||||||
{
|
{
|
||||||
var mediaFolderPath = Path.GetFullPath(Path.Combine(video.ContainingFolderPath, saveFileName));
|
var mediaFolderPath = Path.GetFullPath(Path.Combine(video.ContainingFolderPath, saveFileName));
|
||||||
// TODO: Add some error handling to the API user: return BadRequest("Could not save subtitle, bad path.");
|
// TODO: Add some error handling to the API user: return BadRequest("Could not save subtitle, bad path.");
|
||||||
if (mediaFolderPath.StartsWith(video.ContainingFolderPath))
|
if (mediaFolderPath.StartsWith(video.ContainingFolderPath, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
savePaths.Add(mediaFolderPath);
|
savePaths.Add(mediaFolderPath);
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ namespace MediaBrowser.Providers.Subtitles
|
|||||||
var internalPath = Path.GetFullPath(Path.Combine(video.GetInternalMetadataPath(), saveFileName));
|
var internalPath = Path.GetFullPath(Path.Combine(video.GetInternalMetadataPath(), saveFileName));
|
||||||
|
|
||||||
// TODO: Add some error to the user: return BadRequest("Could not save subtitle, bad path.");
|
// TODO: Add some error to the user: return BadRequest("Could not save subtitle, bad path.");
|
||||||
if (internalPath.StartsWith(video.GetInternalMetadataPath()))
|
if (internalPath.StartsWith(video.GetInternalMetadataPath(), StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
savePaths.Add(internalPath);
|
savePaths.Add(internalPath);
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ namespace MediaBrowser.Providers.Subtitles
|
|||||||
|
|
||||||
private async Task TrySaveToFiles(Stream stream, List<string> savePaths)
|
private async Task TrySaveToFiles(Stream stream, List<string> savePaths)
|
||||||
{
|
{
|
||||||
Exception exceptionToThrow = null;
|
List<Exception> exs = null;
|
||||||
|
|
||||||
foreach (var savePath in savePaths)
|
foreach (var savePath in savePaths)
|
||||||
{
|
{
|
||||||
@ -256,7 +256,7 @@ namespace MediaBrowser.Providers.Subtitles
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
exceptionToThrow ??= ex;
|
(exs ??= new List<Exception>()).Add(ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -266,9 +266,9 @@ namespace MediaBrowser.Providers.Subtitles
|
|||||||
stream.Position = 0;
|
stream.Position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exceptionToThrow != null)
|
if (exs != null)
|
||||||
{
|
{
|
||||||
throw exceptionToThrow;
|
throw new AggregateException(exs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user