make chapter images a per-library setting
This commit is contained in:
parent
4cafe5c493
commit
2bdaba633c
|
@ -106,7 +106,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
LibraryOptions[path] = options;
|
LibraryOptions[path] = options;
|
||||||
|
|
||||||
options.SchemaVersion = 1;
|
options.SchemaVersion = 2;
|
||||||
XmlSerializer.SerializeToFile(options, GetLibraryOptionsPath(path));
|
XmlSerializer.SerializeToFile(options, GetLibraryOptionsPath(path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
public bool EnablePhotos { get; set; }
|
public bool EnablePhotos { get; set; }
|
||||||
public bool EnableRealtimeMonitor { get; set; }
|
public bool EnableRealtimeMonitor { get; set; }
|
||||||
public int SchemaVersion { get; set; }
|
public int SchemaVersion { get; set; }
|
||||||
|
public bool EnableChapterImageExtraction { get; set; }
|
||||||
|
public bool ExtractChapterImagesDuringLibraryScan { get; set; }
|
||||||
|
|
||||||
public LibraryOptions()
|
public LibraryOptions()
|
||||||
{
|
{
|
||||||
|
|
|
@ -261,11 +261,18 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
|
|
||||||
NormalizeChapterNames(chapters);
|
NormalizeChapterNames(chapters);
|
||||||
|
|
||||||
|
var libraryOptions = _libraryManager.GetLibraryOptions(video);
|
||||||
|
var extractDuringScan = chapterOptions.ExtractDuringLibraryScan;
|
||||||
|
if (libraryOptions != null && libraryOptions.SchemaVersion >= 2)
|
||||||
|
{
|
||||||
|
extractDuringScan = libraryOptions.ExtractChapterImagesDuringLibraryScan;
|
||||||
|
}
|
||||||
|
|
||||||
await _encodingManager.RefreshChapterImages(new ChapterImageRefreshOptions
|
await _encodingManager.RefreshChapterImages(new ChapterImageRefreshOptions
|
||||||
{
|
{
|
||||||
Chapters = chapters,
|
Chapters = chapters,
|
||||||
Video = video,
|
Video = video,
|
||||||
ExtractImages = chapterOptions.ExtractDuringLibraryScan,
|
ExtractImages = extractDuringScan,
|
||||||
SaveChapters = false
|
SaveChapters = false
|
||||||
|
|
||||||
}, cancellationToken).ConfigureAwait(false);
|
}, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
|
@ -14,6 +14,7 @@ using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommonIO;
|
using CommonIO;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.MediaEncoder
|
namespace MediaBrowser.Server.Implementations.MediaEncoder
|
||||||
{
|
{
|
||||||
|
@ -24,6 +25,7 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IMediaEncoder _encoder;
|
private readonly IMediaEncoder _encoder;
|
||||||
private readonly IChapterManager _chapterManager;
|
private readonly IChapterManager _chapterManager;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public EncodingManager(IFileSystem fileSystem,
|
public EncodingManager(IFileSystem fileSystem,
|
||||||
ILogger logger,
|
ILogger logger,
|
||||||
|
@ -57,27 +59,38 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = _chapterManager.GetConfiguration();
|
var libraryOptions = _libraryManager.GetLibraryOptions(video);
|
||||||
|
if (libraryOptions != null && libraryOptions.SchemaVersion >= 2)
|
||||||
if (video is Movie)
|
|
||||||
{
|
{
|
||||||
if (!options.EnableMovieChapterImageExtraction)
|
if (!libraryOptions.EnableChapterImageExtraction)
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (video is Episode)
|
|
||||||
{
|
|
||||||
if (!options.EnableEpisodeChapterImageExtraction)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!options.EnableOtherVideoChapterImageExtraction)
|
var options = _chapterManager.GetConfiguration();
|
||||||
|
|
||||||
|
if (video is Movie)
|
||||||
{
|
{
|
||||||
return false;
|
if (!options.EnableMovieChapterImageExtraction)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (video is Episode)
|
||||||
|
{
|
||||||
|
if (!options.EnableEpisodeChapterImageExtraction)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!options.EnableOtherVideoChapterImageExtraction)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user