mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 03:26:07 +02:00
catch disposed error in chapter task
This commit is contained in:
parent
807ec8b14e
commit
4d518e2c95
1 changed files with 27 additions and 20 deletions
|
@ -119,33 +119,40 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
|
||||||
|
|
||||||
var extract = !previouslyFailedImages.Contains(key, StringComparer.OrdinalIgnoreCase);
|
var extract = !previouslyFailedImages.Contains(key, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
var chapters = _itemRepo.GetChapters(video.Id).ToList();
|
try
|
||||||
|
|
||||||
var success = await _encodingManager.RefreshChapterImages(new ChapterImageRefreshOptions
|
|
||||||
{
|
{
|
||||||
SaveChapters = true,
|
var chapters = _itemRepo.GetChapters(video.Id).ToList();
|
||||||
ExtractImages = extract,
|
|
||||||
Video = video,
|
|
||||||
Chapters = chapters
|
|
||||||
|
|
||||||
}, CancellationToken.None);
|
var success = await _encodingManager.RefreshChapterImages(new ChapterImageRefreshOptions
|
||||||
|
{
|
||||||
|
SaveChapters = true,
|
||||||
|
ExtractImages = extract,
|
||||||
|
Video = video,
|
||||||
|
Chapters = chapters
|
||||||
|
|
||||||
if (!success)
|
}, CancellationToken.None);
|
||||||
{
|
|
||||||
previouslyFailedImages.Add(key);
|
|
||||||
|
|
||||||
var parentPath = Path.GetDirectoryName(failHistoryPath);
|
if (!success)
|
||||||
|
{
|
||||||
|
previouslyFailedImages.Add(key);
|
||||||
|
|
||||||
_fileSystem.CreateDirectory(parentPath);
|
var parentPath = Path.GetDirectoryName(failHistoryPath);
|
||||||
|
|
||||||
_fileSystem.WriteAllText(failHistoryPath, string.Join("|", previouslyFailedImages.ToArray()));
|
_fileSystem.CreateDirectory(parentPath);
|
||||||
|
|
||||||
|
_fileSystem.WriteAllText(failHistoryPath, string.Join("|", previouslyFailedImages.ToArray()));
|
||||||
|
}
|
||||||
|
|
||||||
|
numComplete++;
|
||||||
|
double percent = numComplete;
|
||||||
|
percent /= videos.Count;
|
||||||
|
|
||||||
|
progress.Report(100 * percent);
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException)
|
||||||
|
{
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
numComplete++;
|
|
||||||
double percent = numComplete;
|
|
||||||
percent /= videos.Count;
|
|
||||||
|
|
||||||
progress.Report(100 * percent);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue