diff options
| author | softworkz <softworkz@hotmail.com> | 2015-10-03 01:08:01 +0200 |
|---|---|---|
| committer | softworkz <softworkz@hotmail.com> | 2015-10-04 04:02:50 +0200 |
| commit | 073f7ac1aba72e37c383214b5999f339302ade14 (patch) | |
| tree | bdf958987edd648cd114c354da44e0d75096a3bc | |
| parent | 63b218be44656a7ff81b22441941611178d26847 (diff) | |
Auto-Organize: PathTooLongException on source file should not break auto-organize task
PathTooLongException can not only occur with long destination paths but
also with too long file names of files contained in a watch folder.
Previously this condition caused the auto-organize task to break.
With this change, we still log the exception, but auto-organize
processing will continue to handle all other files.
Conflicts:
MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs
| -rw-r--r-- | MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs index 12cf86c17..a017f88ac 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs @@ -35,7 +35,22 @@ namespace MediaBrowser.Server.Implementations.FileOrganization _providerManager = providerManager; } - public async Task Organize(TvFileOrganizationOptions options, CancellationToken cancellationToken, IProgress<double> progress) + private bool IsValidVideoFile(FileInfo fileInfo) + { + try + { + var fullName = fileInfo.FullName; + return _libraryManager.IsVideoFile(fileInfo.FullName); + } + catch (Exception ex) + { + _logger.ErrorException("Error organizing file {0}", ex, fileInfo.Name); + } + + return false; + } + + public async Task Organize(AutoOrganizeOptions options, CancellationToken cancellationToken, IProgress<double> progress) { var minFileBytes = options.MinFileSizeMb * 1024 * 1024; @@ -43,7 +58,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization var eligibleFiles = watchLocations.SelectMany(GetFilesToOrganize) .OrderBy(_fileSystem.GetCreationTimeUtc) - .Where(i => _libraryManager.IsVideoFile(i.FullName) && i.Length >= minFileBytes) + .Where(i => IsValidVideoFile(i) && i.Length >= minFileBytes) .ToList(); var processedFolders = new HashSet<string>(); |
