// Copyright (C) 2024 Intro-Skipper contributors // SPDX-License-Identifier: GPL-3.0-only. using System.Collections.Generic; using System.Diagnostics; using IntroSkipper.Data; using MediaBrowser.Model.Plugins; namespace IntroSkipper.Configuration; /// /// Plugin configuration. /// public class PluginConfiguration : BasePluginConfiguration { /// /// Initializes a new instance of the class. /// public PluginConfiguration() { } // ===== Analysis settings ===== /// /// Gets or sets the comma separated list of library names to analyze. /// public string SelectedLibraries { get; set; } = string.Empty; /// /// Gets or sets a value indicating whether all libraries should be analyzed. /// public bool SelectAllLibraries { get; set; } = true; /// /// Gets or sets a value indicating whether movies should be analyzed. /// public bool AnalyzeMovies { get; set; } /// /// Gets or sets the list of client to auto skip for. /// public string ClientList { get; set; } = string.Empty; /// /// Gets or sets a value indicating whether to automatically scan newly added items. /// public bool AutoDetectIntros { get; set; } = true; /// /// Gets or sets a value indicating whether to analyze season 0. /// public bool AnalyzeSeasonZero { get; set; } /// /// Gets or sets a value indicating whether the episode's fingerprint should be cached to the filesystem. /// public bool CacheFingerprints { get; set; } = true; /// /// Gets or sets a value indicating whether analysis will use Chromaprint to determine fingerprints. /// public bool WithChromaprint { get; set; } = true; // ===== Media Segment handling ===== /// /// Gets or sets a value indicating whether to update Media Segments. /// public bool UpdateMediaSegments { get; set; } = true; /// /// Gets or sets a value indicating whether to regenerate all Media Segments during the next scan. /// By default, Media Segments are only written for a season if the season had at least one newly analyzed episode. /// If this is set, all Media Segments will be regenerated and overwrite any existing Media Segemnts. /// public bool RebuildMediaSegments { get; set; } = true; // ===== Custom analysis settings ===== /// /// Gets or sets a value indicating whether Introductions should be analyzed. /// public bool ScanIntroduction { get; set; } = true; /// /// Gets or sets a value indicating whether Credits should be analyzed. /// public bool ScanCredits { get; set; } = true; /// /// Gets or sets a value indicating whether Recaps should be analyzed. /// public bool ScanRecap { get; set; } = true; /// /// Gets or sets a value indicating whether Previews should be analyzed. /// public bool ScanPreview { get; set; } = true; /// /// Gets or sets the percentage of each episode's audio track to analyze. /// public int AnalysisPercent { get; set; } = 25; /// /// Gets or sets the upper limit (in minutes) on the length of each episode's audio track that will be analyzed. /// public int AnalysisLengthLimit { get; set; } = 10; /// /// Gets or sets the minimum length of similar audio that will be considered an introduction. /// public int MinimumIntroDuration { get; set; } = 15; /// /// Gets or sets the maximum length of similar audio that will be considered an introduction. /// public int MaximumIntroDuration { get; set; } = 120; /// /// Gets or sets the minimum length of similar audio that will be considered ending credits. /// public int MinimumCreditsDuration { get; set; } = 15; /// /// Gets or sets the upper limit (in seconds) on the length of each episode's audio track that will be analyzed when searching for ending credits. /// public int MaximumCreditsDuration { get; set; } = 450; /// /// Gets or sets the upper limit (in seconds) on the length of a movie segment that will be analyzed when searching for ending credits. /// public int MaximumMovieCreditsDuration { get; set; } = 900; /// /// Gets or sets the minimum percentage of a frame that must consist of black pixels before it is considered a black frame. /// public int BlackFrameMinimumPercentage { get; set; } = 85; /// /// Gets or sets the regular expression used to detect introduction chapters. /// public string ChapterAnalyzerIntroductionPattern { get; set; } = @"(^|\s)(Intro|Introduction|OP|Opening)(?!\sEnd)(\s|$)"; /// /// Gets or sets the regular expression used to detect ending credit chapters. /// public string ChapterAnalyzerEndCreditsPattern { get; set; } = @"(^|\s)(Credits?|ED|Ending|Outro)(?!\sEnd)(\s|$)"; /// /// Gets or sets the regular expression used to detect Preview chapters. /// public string ChapterAnalyzerPreviewPattern { get; set; } = @"(^|\s)(Preview|PV|Sneak\s?Peek|Coming\s?(Up|Soon)|Next\s+(time|on|episode)|Extra|Teaser|Trailer)(?!\sEnd)(\s|:|$)"; /// /// Gets or sets the regular expression used to detect Recap chapters. /// public string ChapterAnalyzerRecapPattern { get; set; } = @"(^|\s)(Re?cap|Sum{1,2}ary|Prev(ious(ly)?)?|(Last|Earlier)(\s\w+)?|Catch[ -]up)(?!\sEnd)(\s|:|$)"; // ===== Playback settings ===== /// /// Gets or sets a value indicating whether to show the skip intro button. /// public bool SkipButtonEnabled { get; set; } /// /// Gets a value indicating whether to show the skip intro warning. /// public bool SkipButtonWarning { get => WarningManager.HasFlag(PluginWarning.UnableToAddSkipButton); } /// /// Gets or sets a value indicating whether plugin options are presented to the user. /// public bool PluginSkip { get; set; } /// /// Gets or sets a value indicating whether introductions should be automatically skipped. /// public bool AutoSkip { get; set; } /// /// Gets or sets the list of segment types to auto skip. /// public string TypeList { get; set; } = string.Empty; /// /// Gets or sets a value indicating whether credits should be automatically skipped. /// public bool AutoSkipCredits { get; set; } /// /// Gets or sets a value indicating whether recap should be automatically skipped. /// public bool AutoSkipRecap { get; set; } /// /// Gets or sets a value indicating whether preview should be automatically skipped. /// public bool AutoSkipPreview { get; set; } /// /// Gets or sets the seconds before the intro starts to show the skip prompt at. /// public int ShowPromptAdjustment { get; set; } = 5; /// /// Gets or sets the seconds after the intro starts to hide the skip prompt at. /// public int HidePromptAdjustment { get; set; } = 10; /// /// Gets or sets a value indicating whether the introduction in the first episode of a season should be ignored. /// public bool SkipFirstEpisode { get; set; } = true; /// /// Gets or sets a value indicating whether the skip button should be displayed for the duration of the intro. /// public bool PersistSkipButton { get; set; } = true; /// /// Gets or sets the amount of intro to play (in seconds). /// public int RemainingSecondsOfIntro { get; set; } = 2; /// /// Gets or sets the amount of intro at start to play (in seconds). /// public int SecondsOfIntroStartToPlay { get; set; } // ===== Internal algorithm settings ===== /// /// Gets or sets the maximum number of bits (out of 32 total) that can be different between two Chromaprint points before they are considered dissimilar. /// Defaults to 6 (81% similar). /// public int MaximumFingerprintPointDifferences { get; set; } = 6; /// /// Gets or sets the maximum number of seconds that can pass between two similar fingerprint points before a new time range is started. /// public double MaximumTimeSkip { get; set; } = 3.5; /// /// Gets or sets the amount to shift inverted indexes by. /// public int InvertedIndexShift { get; set; } = 2; /// /// Gets or sets the maximum amount of noise (in dB) that is considered silent. /// Lowering this number will increase the filter's sensitivity to noise. /// public int SilenceDetectionMaximumNoise { get; set; } = -50; /// /// Gets or sets the minimum duration of audio (in seconds) that is considered silent. /// public double SilenceDetectionMinimumDuration { get; set; } = 0.33; // ===== Localization support ===== /// /// Gets or sets the text to display in the skip button in introduction mode. /// public string SkipButtonIntroText { get; set; } = "Skip Intro"; /// /// Gets or sets the text to display in the skip button in end credits mode. /// public string SkipButtonEndCreditsText { get; set; } = "Next"; /// /// Gets or sets the notification text sent after automatically skipping an introduction. /// public string AutoSkipNotificationText { get; set; } = "Segment skipped"; /// /// Gets or sets the max degree of parallelism used when analyzing episodes. /// public int MaxParallelism { get; set; } = 2; /// /// Gets or sets the number of threads for a ffmpeg process. /// public int ProcessThreads { get; set; } /// /// Gets or sets the relative priority for a ffmpeg process. /// public ProcessPriorityClass ProcessPriority { get; set; } = ProcessPriorityClass.BelowNormal; /// /// Gets or sets a value indicating whether the ManifestUrl is self-managed, e.g. for mainland China. /// public bool OverrideManifestUrl { get; set; } }