jumoog / intro-skipper

Fingerprint audio to automatically detect and skip intro/credit sequences in Jellyfin
https://discord.gg/AYZ7RJ3BuA
GNU General Public License v3.0
571 stars 33 forks source link

[Bug]: Detection job fails if same folder is used multiple times in different libraries #146

Closed Baine closed 3 months ago

Baine commented 3 months ago

Describe the bug

I've got a library, that's combing the folders of 3 others (I've removed library scan enqueues of unrelated libraries) "Anime-Gesamt" has the folders of "Anime-GerDub", "Anime-GerSub" and "Anime-Other" When "Anime-Gesamt" is set up as library the detection fails after enqueuing the items, complaining that a job with that ID has already been added. I've removed "Anime-Gesamt" as Library, and the detection job is processing as it should.

2 Support Bundles are attached First with "Anime-Gesamt" not present, 2nd with "Anime-Gesamt" present.

Jellyfin installation method

Docker

Container image and tag

ghcr.io/hotio/jellyfin

Operating System

Ubuntu 22.04.4 LTS

IMDb ID of that TV Series

No response

Support Bundle

Combined Library removed

* Jellyfin version: 10.8.13
* Plugin version: 0.1.17+c2727ea4e482
* Queue contents: 46470 episodes, 4458 seasons
* Warnings: `None`
* FFmpeg: `okay`

FFmpeg version:

ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-opencl --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libsvtav1 --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-vaapi --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
libavutil      58.  2.100 / 58.  2.100
libavcodec     60.  3.100 / 60.  3.100
libavformat    60.  3.100 / 60.  3.100
libavdevice    60.  1.100 / 60.  1.100
libavfilter     9.  3.100 /  9.  3.100
libswscale      7.  1.100 /  7.  1.100
libswresample   4. 10.100 /  4. 10.100
libpostproc    57.  1.100 / 57.  1.100
Combined Library recreated

* Jellyfin version: 10.8.13
* Plugin version: 0.1.17+c2727ea4e482
* Queue contents: 87721 episodes, 3439 seasons
* Warnings: `None`
* FFmpeg: `okay`

FFmpeg version:

ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-opencl --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libsvtav1 --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-vaapi --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
libavutil      58.  2.100 / 58.  2.100
libavcodec     60.  3.100 / 60.  3.100
libavformat    60.  3.100 / 60.  3.100
libavdevice    60.  1.100 / 60.  1.100
libavfilter     9.  3.100 /  9.  3.100
libswscale      7.  1.100 /  7.  1.100
libswresample   4. 10.100 /  4. 10.100
libpostproc    57.  1.100 / 57.  1.100

Jellyfin logs

[2024-05-08 06:57:05.125 +02:00] [INF] [28] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Detect Credits" Failed after 0 minute(s) and 4 seconds
[2024-05-08 06:57:05.125 +02:00] [INF] [28] Emby.Server.Implementations.ScheduledTasks.TaskManager: ExecuteQueuedTasks
[2024-05-08 06:57:08.838 +02:00] [INF] [20] Emby.Server.Implementations.ScheduledTasks.TaskManager: Executing "Detect Introductions"
[2024-05-08 06:57:09.009 +02:00] [INF] [20] ConfusedPolarBear.Plugin.IntroSkipper.QueueManager: Running enqueue of items in library "Anime-Gesamt"
[2024-05-08 06:57:11.002 +02:00] [INF] [20] ConfusedPolarBear.Plugin.IntroSkipper.QueueManager: Running enqueue of items in library "Anime-Other"
[2024-05-08 06:57:11.204 +02:00] [INF] [20] ConfusedPolarBear.Plugin.IntroSkipper.QueueManager: Running enqueue of items in library "Anime-GerSub"
[2024-05-08 06:57:12.292 +02:00] [INF] [20] ConfusedPolarBear.Plugin.IntroSkipper.QueueManager: Running enqueue of items in library "Anime-GerDub"
[2024-05-08 06:57:13.358 +02:00] [INF] [20] ConfusedPolarBear.Plugin.IntroSkipper.DetectIntroductionsTask: Analyzing 6 files from "Anime1" season 1
[2024-05-08 06:57:13.358 +02:00] [INF] [24] ConfusedPolarBear.Plugin.IntroSkipper.DetectIntroductionsTask: Analyzing 6 files from "Anime2" season 1
[2024-05-08 06:57:13.360 +02:00] [ERR] [20] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error
System.AggregateException: One or more errors occurred. (An item with the same key has already been added. Key: 6b6e65b7-7b01-3e57-72b5-c2c9388a8029) (An item with the same key has already been added. Key: c04c8e52-6db7-fddc-7f5d-6c057e6be7fc)
 ---> System.ArgumentException: An item with the same key has already been added. Key: 6b6e65b7-7b01-3e57-72b5-c2c9388a8029
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at ConfusedPolarBear.Plugin.IntroSkipper.ChapterAnalyzer.AnalyzeMediaFiles(ReadOnlyCollection`1 analysisQueue, AnalysisMode mode, CancellationToken cancellationToken)
   at ConfusedPolarBear.Plugin.IntroSkipper.BaseItemAnalyzerTask.AnalyzeItems(ReadOnlyCollection`1 items, CancellationToken cancellationToken)
   at ConfusedPolarBear.Plugin.IntroSkipper.BaseItemAnalyzerTask.<>c__DisplayClass5_0.<AnalyzeItems>b__0(KeyValuePair`2 season)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass44_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Parallel.<>c__DisplayClass44_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
   at System.Threading.Tasks.TaskReplicator.Replica`1.ExecuteAction(Boolean& yieldedBeforeCompletion)
   at System.Threading.Tasks.TaskReplicator.Replica.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure)
   at System.Threading.Tasks.Parallel.PartitionerForEachWorker[TSource,TLocal](Partitioner`1 source, ParallelOptions parallelOptions, Action`1 simpleBody, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException)
   at System.Threading.Tasks.Parallel.PartitionerForEachWorker[TSource,TLocal](Partitioner`1 source, ParallelOptions parallelOptions, Action`1 simpleBody, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body)
   at ConfusedPolarBear.Plugin.IntroSkipper.BaseItemAnalyzerTask.AnalyzeItems(IProgress`1 progress, CancellationToken cancellationToken)
   at ConfusedPolarBear.Plugin.IntroSkipper.DetectIntroductionsTask.ExecuteAsync(IProgress`1 progress, CancellationToken cancellationToken)
   at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
 ---> (Inner Exception #1) System.ArgumentException: An item with the same key has already been added. Key: c04c8e52-6db7-fddc-7f5d-6c057e6be7fc
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at ConfusedPolarBear.Plugin.IntroSkipper.ChapterAnalyzer.AnalyzeMediaFiles(ReadOnlyCollection`1 analysisQueue, AnalysisMode mode, CancellationToken cancellationToken)
   at ConfusedPolarBear.Plugin.IntroSkipper.BaseItemAnalyzerTask.AnalyzeItems(ReadOnlyCollection`1 items, CancellationToken cancellationToken)
   at ConfusedPolarBear.Plugin.IntroSkipper.BaseItemAnalyzerTask.<>c__DisplayClass5_0.<AnalyzeItems>b__0(KeyValuePair`2 season)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass44_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Parallel.<>c__DisplayClass44_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
   at System.Threading.Tasks.TaskReplicator.Replica`1.ExecuteAction(Boolean& yieldedBeforeCompletion)
   at System.Threading.Tasks.TaskReplicator.Replica.Execute()<---
jumoog commented 3 months ago

How did you create your "Combined Library"? Because you have the same episode 6b6e65b7-7b01-3e57-72b5-c2c9388a8029 twice in your library.

Baine commented 3 months ago

see below for the combined library image

and this is for one of the others using the folder image (apologies for the german in that snips; "Verzeichnisse" = "Directories"; hope it's understandable)

iirc jellyfin assigns the episode ids based on the folder they are in, and not based on the library

rlauuzo commented 3 months ago

Could you please test if this https://github.com/jumoog/intro-skipper/actions/runs/9000490094?pr=147 resolves the issue for you? Simply replace the DLL in the plugin folder, then restart Jellyfin to apply the update.

Baine commented 3 months ago

yep, that did resolve this issue.

thank you!

jumoog commented 3 months ago

see below for the combined library image

and this is for one of the others using the folder image (apologies for the german in that snips; "Verzeichnisse" = "Directories"; hope it's understandable)

iirc jellyfin assigns the episode ids based on the folder they are in, and not based on the library

don't worry i'm from germany

Baine commented 3 months ago

thanks for the fix and your help on this. I'll close this one now :)