mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge pull request #9103 from DarrenRuane/darrenruane_fix_chapter_images_deletion
This commit is contained in:
commit
9ccfe3121f
@ -15,6 +15,7 @@ using MediaBrowser.Controller.Entities;
|
|||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
|
using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
@ -62,23 +63,16 @@ namespace Emby.Server.Implementations.MediaEncoder
|
|||||||
/// Determines whether [is eligible for chapter image extraction] [the specified video].
|
/// Determines whether [is eligible for chapter image extraction] [the specified video].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="video">The video.</param>
|
/// <param name="video">The video.</param>
|
||||||
|
/// <param name="libraryOptions">The library options for the video.</param>
|
||||||
/// <returns><c>true</c> if [is eligible for chapter image extraction] [the specified video]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is eligible for chapter image extraction] [the specified video]; otherwise, <c>false</c>.</returns>
|
||||||
private bool IsEligibleForChapterImageExtraction(Video video)
|
private bool IsEligibleForChapterImageExtraction(Video video, LibraryOptions libraryOptions)
|
||||||
{
|
{
|
||||||
if (video.IsPlaceHolder)
|
if (video.IsPlaceHolder)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var libraryOptions = _libraryManager.GetLibraryOptions(video);
|
if (libraryOptions is null || !libraryOptions.EnableChapterImageExtraction)
|
||||||
if (libraryOptions is not null)
|
|
||||||
{
|
|
||||||
if (!libraryOptions.EnableChapterImageExtraction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -99,7 +93,9 @@ namespace Emby.Server.Implementations.MediaEncoder
|
|||||||
|
|
||||||
public async Task<bool> RefreshChapterImages(Video video, IDirectoryService directoryService, IReadOnlyList<ChapterInfo> chapters, bool extractImages, bool saveChapters, CancellationToken cancellationToken)
|
public async Task<bool> RefreshChapterImages(Video video, IDirectoryService directoryService, IReadOnlyList<ChapterInfo> chapters, bool extractImages, bool saveChapters, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (!IsEligibleForChapterImageExtraction(video))
|
var libraryOptions = _libraryManager.GetLibraryOptions(video);
|
||||||
|
|
||||||
|
if (!IsEligibleForChapterImageExtraction(video, libraryOptions))
|
||||||
{
|
{
|
||||||
extractImages = false;
|
extractImages = false;
|
||||||
}
|
}
|
||||||
@ -179,6 +175,12 @@ namespace Emby.Server.Implementations.MediaEncoder
|
|||||||
chapter.ImageDateModified = _fileSystem.GetLastWriteTimeUtc(path);
|
chapter.ImageDateModified = _fileSystem.GetLastWriteTimeUtc(path);
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
|
else if (libraryOptions?.EnableChapterImageExtraction != true)
|
||||||
|
{
|
||||||
|
// We have an image for the current chapter but the user has disabled chapter image extraction -> delete this chapter's image
|
||||||
|
chapter.ImagePath = null;
|
||||||
|
changesMade = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saveChapters && changesMade)
|
if (saveChapters && changesMade)
|
||||||
|
@ -100,7 +100,6 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
EnableImages = false
|
EnableImages = false
|
||||||
},
|
},
|
||||||
SourceTypes = new SourceType[] { SourceType.Library },
|
SourceTypes = new SourceType[] { SourceType.Library },
|
||||||
HasChapterImages = false,
|
|
||||||
IsVirtualItem = false
|
IsVirtualItem = false
|
||||||
})
|
})
|
||||||
.OfType<Video>()
|
.OfType<Video>()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user