Skip to content

Jellyfin Plugin Example

This example shows how to setup a plugin.

Configuration

let
  fromRepo = nixflix.lib.jellyfinPlugins.fromRepo;
in {
  nixflix.jellyfin.plugins."Intro Skipper" = {
    package = fromRepo {
      version = "1.10.11.17";
      hash = "sha256-<unpacked-plugin-hash>";
    };
    config = {
      ExcludeSeries = "";
      AutoDetectIntros = true;
      AnalyzeSeasonZero = false;
      PreferChromaprint = false;
      CacheFingerprints = true;
      UseAlternativeBlackFrameAnalyzer = false;
      UpdateMediaSegments = true;
      RebuildMediaSegments = true;
      ScanIntroduction = true;
      ScanCredits = true;
      ScanRecap = true;
      ScanPreview = true;
      ScanCommercial = false;
      AnalysisPercent = "25";
      AnalysisLengthLimit = "10";
      FullLengthChapters = false;
      SkipFirstEpisode = false;
      SkipFirstEpisodeAnime = false;
      MinimumIntroDuration = "15";
      MaximumIntroDuration = "120";
      MinimumCreditsDuration = "15";
      MaximumCreditsDuration = "450";
      MaximumMovieCreditsDuration = "900";
      MinimumRecapDuration = "15";
      MaximumRecapDuration = "120";
      MinimumPreviewDuration = "15";
      MaximumPreviewDuration = "120";
      MinimumCommercialDuration = "15";
      MaximumCommercialDuration = "120";
      BlackFrameMinimumPercentage = "85";
      BlackFrameThreshold = "28";
      UseChapterMarkersBlackFrame = true;
      AdjustIntroBasedOnChapters = true;
      AdjustIntroBasedOnSilence = true;
      SnapToKeyframe = true;
      EndSnapThreshold = "2";
      AdjustWindowInward = "5";
      AdjustWindowOutward = "2";
      ChapterAnalyzerIntroductionPattern = "(^|\\s)(Intro|Introduction|OP|Opening)(?!\\sEnd)(\\s|$)";
      ChapterAnalyzerEndCreditsPattern = "(^|\\s)(Credits?|ED|Ending|Outro)(?!\\sEnd)(\\s|$)";
      ChapterAnalyzerPreviewPattern = "(^|\\s)(Preview|PV|Sneak\\s?Peek|Coming\\s?(Up|Soon)|Next\\s+(time|on|episode)|Extra|Teaser|Trailer)(?!\\sEnd)(\\s|:|$)";
      ChapterAnalyzerRecapPattern = "(^|\\s)(Re?cap|Sum{1,2}ary|Prev(ious(ly)?)?|(Last|Earlier)(\\s\\w+)?|Catch[ -]up)(?!\\sEnd)(\\s|:|$)";
      ChapterAnalyzerCommercialPattern = "(^|\\s)(Ad(vert(isement)?)?|Commercial)(?!\\sEnd)(\\s|$)";
      IntroEndOffset = "0";
      IntroStartOffset = "0";
      MaximumFingerprintPointDifferences = 6;
      MaximumTimeSkip = 3.5;
      InvertedIndexShift = 2;
      SilenceDetectionMaximumNoise = "-50";
      SilenceDetectionMinimumDuration = "0.33";
      MaxParallelism = "2";
      ProcessThreads = "0";
      ProcessPriority = "BelowNormal";
      UseFileTransformationPlugin = false;
      SkipbuttonHideDelay = "8";
      EnableMainMenu = true;
      FileTransformationPluginEnabled = false;
    };
  };
}

Most plugins are already available as nixflix.jellyfin.plugins.<name> options out of the box. If the plugin you want isn't one of them, you will need to configure its manifest url like so.

{
  nixflix.jellyfin.system.pluginRepositories = {
    "Intro Skipper" = {
      url = "https://raw.githubusercontent.com/intro-skipper/manifest/main/10.11/manifest.json";
      hash = "sha256-<manifest-hash>";
      enabled = true;
    };
  };
}

Settings

Individual plugin settings vary greatly and there is no way I could enumerate them all.

I usually configure them first via the UI, then declare them in Nix Here are the steps that I follow:

  1. Configure the manifest in nixflix.jellyfin.system.pluginRepositories, then rebuild (optional)
  2. Install the desired plugin in the UI
  3. Take note of the version of the plugin
  4. Restart Jellyfin
  5. With the network tab of developer tools open, configure the settings of the desired plugin in the UI
  6. Copy the data of the API call
  7. Convert it to a nix attribute set
  8. Uninstall the application
  9. Restart Jellyfin
  10. Add the attribute set to nixflix.jellyfin.plugins.<name>.config = { ... }
  11. Add package = fromRepo { version = ...; hash = ...; };
  12. Rebuild

Get the hash with:

nix flake prefetch --json "https://example.com/plugin.zip" | jq -r .hash

Pin the manifest with:

nix store prefetch-file --json "https://example.com/manifest.json" | jq -r .hash

Secrets

All attributes of nixflix.jellyfin.plugins.<name>.config support the { _secret = "/path/to/secret"; } syntax.