2024-10-25 14:31:50 -04:00
// Copyright (C) 2024 Intro-Skipper contributors <intro-skipper.org>
// SPDX-License-Identifier: GPL-3.0-only.
2024-10-25 14:15:12 -04:00
2024-11-21 15:42:55 +01:00
using System.Collections.Generic ;
2024-03-02 22:19:51 -05:00
using System.Diagnostics ;
2024-10-19 23:50:41 +02:00
using IntroSkipper.Data ;
2019-02-21 01:57:43 -08:00
using MediaBrowser.Model.Plugins ;
2019-03-10 08:53:30 +09:00
2024-10-19 23:50:41 +02:00
namespace IntroSkipper.Configuration ;
2021-12-13 16:58:05 -07:00
/// <summary>
/// Plugin configuration.
/// </summary>
public class PluginConfiguration : BasePluginConfiguration
{
/// <summary>
/// Initializes a new instance of the <see cref="PluginConfiguration"/> class.
/// </summary>
public PluginConfiguration ( )
2019-02-21 01:57:43 -08:00
{
}
2021-12-13 16:58:05 -07:00
2022-06-26 22:54:47 -05:00
// ===== Analysis settings =====
2022-06-27 00:21:30 -05:00
/// <summary>
2024-09-17 08:41:56 +02:00
/// Gets or sets the comma separated list of library names to analyze.
2022-06-27 00:21:30 -05:00
/// </summary>
public string SelectedLibraries { get ; set ; } = string . Empty ;
2024-09-17 08:41:56 +02:00
/// <summary>
/// Gets or sets a value indicating whether all libraries should be analyzed.
/// </summary>
2024-10-05 18:15:48 +02:00
public bool SelectAllLibraries { get ; set ; } = true ;
2024-09-17 08:41:56 +02:00
2024-10-18 14:15:09 +02:00
/// <summary>
/// Gets or sets a value indicating whether movies should be analyzed.
/// </summary>
public bool AnalyzeMovies { get ; set ; }
2024-09-09 20:52:54 +02:00
/// <summary>
/// Gets or sets the list of client to auto skip for.
/// </summary>
2024-10-12 06:35:46 -04:00
public string ClientList { get ; set ; } = string . Empty ;
2024-09-09 20:52:54 +02:00
2024-03-30 19:02:18 +01:00
/// <summary>
2024-11-21 15:42:55 +01:00
/// Gets or sets a value indicating whether to automatically scan newly added items.
2024-03-30 19:02:18 +01:00
/// </summary>
2024-10-12 06:35:46 -04:00
public bool AutoDetectIntros { get ; set ; } = true ;
2024-03-30 19:02:18 +01:00
2022-09-27 21:42:51 -05:00
/// <summary>
/// Gets or sets a value indicating whether to analyze season 0.
/// </summary>
2024-10-05 18:15:48 +02:00
public bool AnalyzeSeasonZero { get ; set ; }
2022-09-27 21:42:51 -05:00
2024-03-04 17:50:12 -05:00
/// <summary>
/// Gets or sets a value indicating whether the episode's fingerprint should be cached to the filesystem.
/// </summary>
public bool CacheFingerprints { get ; set ; } = true ;
/// <summary>
/// Gets or sets a value indicating whether analysis will use Chromaprint to determine fingerprints.
/// </summary>
2024-10-10 11:38:47 -04:00
public bool WithChromaprint { get ; set ; } = true ;
2024-03-04 17:50:12 -05:00
2024-10-19 22:49:47 +02:00
// ===== Media Segment handling =====
/// <summary>
/// Gets or sets a value indicating whether to update Media Segments.
/// </summary>
public bool UpdateMediaSegments { get ; set ; } = true ;
/// <summary>
2024-10-21 09:19:51 +02:00
/// 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.
2024-10-19 22:49:47 +02:00
/// </summary>
2024-11-17 21:59:54 +01:00
public bool RebuildMediaSegments { get ; set ; } = true ;
2024-10-19 22:49:47 +02:00
2022-07-08 00:57:12 -05:00
// ===== Custom analysis settings =====
2024-11-21 15:42:55 +01:00
/// <summary>
/// Gets or sets a value indicating whether Introductions should be analyzed.
/// </summary>
public bool ScanIntroduction { get ; set ; } = true ;
/// <summary>
/// Gets or sets a value indicating whether Credits should be analyzed.
/// </summary>
public bool ScanCredits { get ; set ; } = true ;
/// <summary>
/// Gets or sets a value indicating whether Recaps should be analyzed.
/// </summary>
public bool ScanRecap { get ; set ; } = true ;
/// <summary>
/// Gets or sets a value indicating whether Previews should be analyzed.
/// </summary>
public bool ScanPreview { get ; set ; } = true ;
2022-06-26 22:54:47 -05:00
/// <summary>
/// Gets or sets the percentage of each episode's audio track to analyze.
/// </summary>
public int AnalysisPercent { get ; set ; } = 25 ;
/// <summary>
/// Gets or sets the upper limit (in minutes) on the length of each episode's audio track that will be analyzed.
/// </summary>
public int AnalysisLengthLimit { get ; set ; } = 10 ;
2022-07-03 01:59:16 -05:00
/// <summary>
/// Gets or sets the minimum length of similar audio that will be considered an introduction.
/// </summary>
public int MinimumIntroDuration { get ; set ; } = 15 ;
2022-09-03 00:39:35 -05:00
/// <summary>
/// Gets or sets the maximum length of similar audio that will be considered an introduction.
/// </summary>
public int MaximumIntroDuration { get ; set ; } = 120 ;
2022-11-29 20:11:22 -06:00
/// <summary>
/// Gets or sets the minimum length of similar audio that will be considered ending credits.
/// </summary>
public int MinimumCreditsDuration { get ; set ; } = 15 ;
2022-10-31 01:00:39 -05:00
/// <summary>
2022-11-24 00:43:23 -06:00
/// 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.
2022-10-31 01:00:39 -05:00
/// </summary>
2024-10-18 14:15:09 +02:00
public int MaximumCreditsDuration { get ; set ; } = 450 ;
/// <summary>
/// Gets or sets the upper limit (in seconds) on the length of a movie segment that will be analyzed when searching for ending credits.
/// </summary>
public int MaximumMovieCreditsDuration { get ; set ; } = 900 ;
2022-10-31 01:00:39 -05:00
2022-11-01 00:53:56 -05:00
/// <summary>
/// Gets or sets the minimum percentage of a frame that must consist of black pixels before it is considered a black frame.
/// </summary>
public int BlackFrameMinimumPercentage { get ; set ; } = 85 ;
2022-11-24 00:43:23 -06:00
/// <summary>
/// Gets or sets the regular expression used to detect introduction chapters.
/// </summary>
public string ChapterAnalyzerIntroductionPattern { get ; set ; } =
2024-11-21 15:42:55 +01:00
@"(^|\s)(Intro|Introduction|OP|Opening)(?!\sEnd)(\s|$)" ;
2022-11-24 00:43:23 -06:00
/// <summary>
/// Gets or sets the regular expression used to detect ending credit chapters.
/// </summary>
public string ChapterAnalyzerEndCreditsPattern { get ; set ; } =
2024-11-21 15:42:55 +01:00
@"(^|\s)(Credits?|ED|Ending|Outro)(?!\sEnd)(\s|$)" ;
/// <summary>
/// Gets or sets the regular expression used to detect Preview chapters.
/// </summary>
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|:|$)" ;
/// <summary>
/// Gets or sets the regular expression used to detect Recap chapters.
/// </summary>
public string ChapterAnalyzerRecapPattern { get ; set ; } =
@"(^|\s)(Re?cap|Sum{1,2}ary|Prev(ious(ly)?)?|(Last|Earlier)(\s\w+)?|Catch[ -]up)(?!\sEnd)(\s|:|$)" ;
2022-11-24 00:43:23 -06:00
2022-06-26 22:54:47 -05:00
// ===== Playback settings =====
2022-11-06 21:20:52 -06:00
/// <summary>
/// Gets or sets a value indicating whether to show the skip intro button.
/// </summary>
2024-11-21 15:42:55 +01:00
public bool SkipButtonEnabled { get ; set ; }
2022-11-06 21:20:52 -06:00
2024-09-29 20:35:46 +02:00
/// <summary>
/// Gets a value indicating whether to show the skip intro warning.
/// </summary>
public bool SkipButtonWarning { get = > WarningManager . HasFlag ( PluginWarning . UnableToAddSkipButton ) ; }
2024-11-21 14:20:53 -05:00
/// <summary>
/// Gets or sets a value indicating whether plugin options are presented to the user.
/// </summary>
public bool PluginSkip { get ; set ; }
2022-06-07 18:33:59 -05:00
/// <summary>
/// Gets or sets a value indicating whether introductions should be automatically skipped.
/// </summary>
public bool AutoSkip { get ; set ; }
2024-11-21 15:42:55 +01:00
/// <summary>
/// Gets or sets the list of segment types to auto skip.
/// </summary>
public string TypeList { get ; set ; } = string . Empty ;
2024-05-13 14:25:52 +02:00
/// <summary>
/// Gets or sets a value indicating whether credits should be automatically skipped.
/// </summary>
public bool AutoSkipCredits { get ; set ; }
2024-11-21 15:42:55 +01:00
/// <summary>
/// Gets or sets a value indicating whether recap should be automatically skipped.
/// </summary>
public bool AutoSkipRecap { get ; set ; }
/// <summary>
/// Gets or sets a value indicating whether preview should be automatically skipped.
/// </summary>
public bool AutoSkipPreview { get ; set ; }
2022-05-05 18:26:02 -05:00
/// <summary>
2022-05-09 22:50:41 -05:00
/// Gets or sets the seconds before the intro starts to show the skip prompt at.
2022-05-05 18:26:02 -05:00
/// </summary>
public int ShowPromptAdjustment { get ; set ; } = 5 ;
/// <summary>
2022-05-09 22:50:41 -05:00
/// Gets or sets the seconds after the intro starts to hide the skip prompt at.
2022-05-05 18:26:02 -05:00
/// </summary>
public int HidePromptAdjustment { get ; set ; } = 10 ;
2022-09-02 01:54:49 -05:00
/// <summary>
2024-03-01 09:19:12 -05:00
/// Gets or sets a value indicating whether the introduction in the first episode of a season should be ignored.
2022-09-02 01:54:49 -05:00
/// </summary>
public bool SkipFirstEpisode { get ; set ; } = true ;
2022-09-24 22:49:17 -05:00
2024-03-01 09:19:12 -05:00
/// <summary>
/// Gets or sets a value indicating whether the skip button should be displayed for the duration of the intro.
/// </summary>
public bool PersistSkipButton { get ; set ; } = true ;
2022-08-28 22:25:27 -05:00
/// <summary>
/// Gets or sets the amount of intro to play (in seconds).
/// </summary>
2024-08-02 13:41:03 +00:00
public int RemainingSecondsOfIntro { get ; set ; } = 2 ;
/// <summary>
/// Gets or sets the amount of intro at start to play (in seconds).
/// </summary>
2024-10-05 18:15:48 +02:00
public int SecondsOfIntroStartToPlay { get ; set ; }
2024-08-02 13:41:03 +00:00
2022-09-02 01:27:49 -05:00
// ===== Internal algorithm settings =====
/// <summary>
/// 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).
/// </summary>
public int MaximumFingerprintPointDifferences { get ; set ; } = 6 ;
/// <summary>
/// Gets or sets the maximum number of seconds that can pass between two similar fingerprint points before a new time range is started.
/// </summary>
public double MaximumTimeSkip { get ; set ; } = 3.5 ;
/// <summary>
/// Gets or sets the amount to shift inverted indexes by.
/// </summary>
public int InvertedIndexShift { get ; set ; } = 2 ;
/// <summary>
/// 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.
/// </summary>
public int SilenceDetectionMaximumNoise { get ; set ; } = - 50 ;
/// <summary>
/// Gets or sets the minimum duration of audio (in seconds) that is considered silent.
/// </summary>
public double SilenceDetectionMinimumDuration { get ; set ; } = 0.33 ;
2022-11-06 21:20:52 -06:00
// ===== Localization support =====
/// <summary>
2023-03-04 00:15:26 -06:00
/// Gets or sets the text to display in the skip button in introduction mode.
2022-11-06 21:20:52 -06:00
/// </summary>
2023-03-04 00:15:26 -06:00
public string SkipButtonIntroText { get ; set ; } = "Skip Intro" ;
/// <summary>
/// Gets or sets the text to display in the skip button in end credits mode.
/// </summary>
public string SkipButtonEndCreditsText { get ; set ; } = "Next" ;
2022-11-06 21:20:52 -06:00
/// <summary>
/// Gets or sets the notification text sent after automatically skipping an introduction.
/// </summary>
2024-11-21 15:42:55 +01:00
public string AutoSkipNotificationText { get ; set ; } = "Segment skipped" ;
2024-03-02 22:19:51 -05:00
2024-05-13 14:25:52 +02:00
/// <summary>
2024-11-21 15:42:55 +01:00
/// Gets or sets the max degree of parallelism used when analyzing episodes.
2024-05-13 14:25:52 +02:00
/// </summary>
2024-11-21 15:42:55 +01:00
public int MaxParallelism { get ; set ; } = 2 ;
2024-05-13 14:25:52 +02:00
2024-03-02 22:19:51 -05:00
/// <summary>
2024-10-27 22:38:46 +01:00
/// Gets or sets the number of threads for a ffmpeg process.
2024-03-02 22:19:51 -05:00
/// </summary>
2024-09-10 18:08:42 +02:00
public int ProcessThreads { get ; set ; }
2024-03-02 22:19:51 -05:00
/// <summary>
2024-10-27 22:38:46 +01:00
/// Gets or sets the relative priority for a ffmpeg process.
2024-03-02 22:19:51 -05:00
/// </summary>
public ProcessPriorityClass ProcessPriority { get ; set ; } = ProcessPriorityClass . BelowNormal ;
2024-10-27 22:38:46 +01:00
/// <summary>
/// Gets or sets a value indicating whether the ManifestUrl is self-managed, e.g. for mainland China.
/// </summary>
public bool OverrideManifestUrl { get ; set ; }
2019-03-10 08:53:30 +09:00
}