Giter Club home page Giter Club logo

plex-credits-detect's People

Contributors

cjmanca avatar drkno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

plex-credits-detect's Issues

Installed on Docker/Synology and container keeps restarting

Hiya, I'm trying to figure out what is wrong but I don't think I see the culprit in the logs. Could you please give me a hand troubleshooting this?

Here's my docker-compose:

version: "3.3"
services:
    plex-credits-detect:
        container_name: plex-credits-detect
        image: cjmanca/plex-credits-detect:main
        network_mode: bridge
        restart: unless-stopped
        environment:
            - TZ=Europe/London
            - PUID=xx
            - PGID=xx
        volumes:
            - /volume1/docker/plex-credits-detect:/config
            - /volume1/docker/plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases:/PlexDB
            - /volume1/media:/media

Here are the logs:

today at 01:02:25   Container started
today at 01:02:19   at plexCreditsDetect.Database.SQLResultInfo.GetInt(String v) in /src/plex-credits-detect/Database/SQLResultInfo.cs:line 37
today at 01:02:19   at plexCreditsDetect.Database.SQLResultInfo.Get[T](String v) in /src/plex-credits-detect/Database/SQLResultInfo.cs:line 109
today at 01:02:19   at plexCreditsDetect.Database.PlexDB.GetRootDirectories() in /src/plex-credits-detect/Database/PlexDB.cs:line 630
today at 01:02:19   at plexCreditsDetect.Database.PlexDB.get_RootDirectories() in /src/plex-credits-detect/Database/PlexDB.cs:line 35
today at 01:02:19   at plexCreditsDetect.Program.Main(String[] args) in /src/plex-credits-detect/Program.cs:line 31
today at 01:02:25   Loading global config file: /config/plex-credits-detect/fingerprint.ini
today at 01:02:25   Unhandled exception. System.InvalidCastException: Specified cast is not valid.
today at 01:02:25   at System.Data.SQLite.SQLiteDataReader.VerifyType(Int32 i, DbType typ)
today at 01:02:31   Container started
today at 01:02:25   at System.Data.SQLite.SQLiteDataReader.GetInt32(Int32 i)
today at 01:02:25   at plexCreditsDetect.Database.SQLResultInfo.GetInt(String v) in /src/plex-credits-detect/Database/SQLResultInfo.cs:line 37
today at 01:02:25   at plexCreditsDetect.Database.SQLResultInfo.Get[T](String v) in /src/plex-credits-detect/Database/SQLResultInfo.cs:line 109
today at 01:02:25   at plexCreditsDetect.Database.PlexDB.GetRootDirectories() in /src/plex-credits-detect/Database/PlexDB.cs:line 630
today at 01:02:25   at plexCreditsDetect.Database.PlexDB.get_RootDirectories() in /src/plex-credits-detect/Database/PlexDB.cs:line 35
today at 01:02:25   at plexCreditsDetect.Program.Main(String[] args) in /src/plex-credits-detect/Program.cs:line 31
today at 01:02:31   Loading global config file: /config/plex-credits-detect/fingerprint.ini
today at 01:02:32   Unhandled exception. System.InvalidCastException: Specified cast is not valid.
today at 01:02:32   at System.Data.SQLite.SQLiteDataReader.VerifyType(Int32 i, DbType typ)
today at 01:02:32   at System.Data.SQLite.SQLiteDataReader.GetInt32(Int32 i)
today at 01:02:37   Container started
today at 01:02:32   at plexCreditsDetect.Database.SQLResultInfo.GetInt(String v) in /src/plex-credits-detect/Database/SQLResultInfo.cs:line 37
today at 01:02:32   at plexCreditsDetect.Database.SQLResultInfo.Get[T](String v) in /src/plex-credits-detect/Database/SQLResultInfo.cs:line 109
today at 01:02:32   at plexCreditsDetect.Database.PlexDB.GetRootDirectories() in /src/plex-credits-detect/Database/PlexDB.cs:line 630
today at 01:02:32   at plexCreditsDetect.Database.PlexDB.get_RootDirectories() in /src/plex-credits-detect/Database/PlexDB.cs:line 35
today at 01:02:32   at plexCreditsDetect.Program.Main(String[] args) in /src/plex-credits-detect/Program.cs:line 31
today at 01:02:37   Loading global config file: /config/plex-credits-detect/fingerprint.ini
today at 01:02:38   Unhandled exception. System.InvalidCastException: Specified cast is not valid.
today at 01:02:38   at System.Data.SQLite.SQLiteDataReader.VerifyType(Int32 i, DbType typ)
today at 01:02:38   at System.Data.SQLite.SQLiteDataReader.GetInt32(Int32 i)
today at 01:02:38   at plexCreditsDetect.Database.PlexDB.get_RootDirectories() in /src/plex-credits-detect/Database/PlexDB.cs:line 35
today at 01:02:38   at plexCreditsDetect.Program.Main(String[] args) in /src/plex-credits-detect/Program.cs:line 31

And here is my fingerprint.ini

[directories]
/media = C:\path\this\tool\sees\to\library

[intro]
introStart = 0
introEnd = 0.5
introMaxSearchPeriod = 900

[credits]
creditsStart = 0.75
creditsEnd = 1.0
creditsMaxSearchPeriod = 600

[matching]
useAudio = true
useVideo = false
introMatchCount = 0
creditsMatchCount = 1
quickDetectFingerprintSamples = 5
fullDetectFingerprintMaxSamples = 10
audioAccuracy = 4
stride = 512
sampleRate = 5512
minFrequency = 100
maxFrequency = 2750
videoAccuracy = 2
videoSizeDivisor = 50
frameRate = 1

[silence]
detectSilenceAfterCredits = true
silenceDecibels = -55

[blackframes]
detectBlackframes = true
blackframeOnlyMovies = true
blackframeUseMaxSearchPeriodForEpisodes = true
blackframeUseMaxSearchPeriodForMovies = false
blackframeScreenPercentage = 75
blackframePixelPercentage = 2
blackframeMovieMinimumMatchSeconds = 20

[timing]
shiftSegmentBySeconds = 2
minimumMatchSeconds = 20
PermittedGap = 3
PermittedGapWithMinimumEnclosure = 10

[redetection]
crawlDirectoriesOnStartup = false
recheckBlackframesOnStartup = false
recheckSilenceOnStartup = false
recheckUndetectedOnStartup = false
forceRedetect = false
redetectIfFileSizeChanges = true

[monitoring]
monitorPlexIntros = true
monitorDirectoryChanges = true

[paths]
databasePath = /config/plex-credits-detect/database
PlexDatabasePath = /PlexDB/com.plexapp.plugins.library.db
TempDirectoryPath = /config/plex-credits-detect/temp
ffmpegPath = ffmpeg

Feature: Support for multiple Plex servers/instances

Would be great to have one instance of PCD support multiple Plex instances for people who run multiple/backup servers. I use Docker so I am thinking of an ability to define in the ini the path to additional databases which are mounted into the container at unique paths.

Add GUI

  • Organize by library/show/season/movies
  • Searchable
  • Buttons to force re-scan at each level (library/show/season/episode/movie)
  • Change settings for each level in GUI
  • Settings stored in DB instead of ini files
  • Display existing timings
  • Interface to easily see which videos haven't had timings detected yet

Skip problem with PlexKodiConnect

I set this up a few days ago as a docker container on my NAS, and once I got the configuration files sorted out it's been working its way through my library ever since. First, I want to say thanks, because it was a surprisingly simple process, and it's been working more or less exactly as expected.

The problem I'm having is that one of my users uses PlexKodiConnect (https://github.com/croneter/PlexKodiConnect), and it seems that pressing the Skip Intro button during the intro credits will skip all the way to the end of the end credits.

It works flawlessly when using Plex web or Plex Windows. It seems to only be a problem with PlexKodiConnect. I can only assume that since PKC isn't meant to deal with multiple intro markers, it's just grabbing the endTimeOffset with the highest value. For the moment I've had them just disable Skip Intro entirely.

I realize that any fix for this would almost certainly have to be implemented in the PlexKodiConnect code, and I will be opening an issue over there as well, but I wanted to post it here on the off chance that there is some database magic that could resolve the problem on your end.

Thanks, and thanks again for all the work you've put into this!

Skip directories

Is there a way to skip specific directories? I expected with the hierarchical ini files to be able to have an ini file in one of my directories and specify an "ignore" section or similar, but didn't find any such config.

Did I miss something or is this not implemented?

The use-case here is that I only really want this to run on TV shows, not on movies, where it's less beneficial IMO.

Foreign key constraint failed error when inserting into ScannedMedia_Timings during episode import

Hi - I'm using the docker image, and I've noticed a new (to me anyway) error/crash (causes container restart).

credits | plex-credits-detect Database.ExecuteDBCommand exception: constraint failed
credits | FOREIGN KEY constraint failed while executing SQL: INSERT INTO ScannedMedia_Timings (ScannedMedia_id, is_plex_intro, time_offset, end_time_offset, isCredits, isSilence, isBlackframes) VALUES (@ScannedMedia_id, @is_plex_intro, @time_offset, @end_time_offset, @isCredits, @issilence, @isBlackframes);
credits | With data:
credits | ScannedMedia_id = /tv/show/episode.mp4
credits | is_plex_intro = False
credits | time_offset = 0
credits | end_time_offset = 599.5936337763062
credits | isCredits = True
credits | isSilence = False
credits | isBlackframes = False
credits exited with code 255

I'm using Sonarr-SMA which will transcode tv episodes during import. Plex Library settings auto-scan (filesystem change notifications or similar), and these monitoring settings (if other settings are relevant lmk):

[monitoring]
monitorPlexIntros = true
monitorDirectoryChanges = true

Seems to be a sort of orchestration "race condition" with credits running while plex is scanning and rescanning while the sonarr/sma stack does its thing.

I realize I could work around this behavior by turning off the plex auto-scan, but I like how quickly the overall system can process requests and make them available so I'd rather not. Thanks for the script, and for reading!

Just a few questions (:

Hey,

Even though I have read the README and it states this tool is only supplementary to the intro detection Plex offers natively, I have noticed a few of my episodes didn't have a "skip intro" button while some (from the same show/season) still do.

I'm honestly not sure if this was the case before running the program, but I thought I'd ask: Does this actually replace (or even remove) Plex-detected intro taggings? I can see in the Database class that there is a method to delete existing intros (refered to as "taggings") - why and when is this used?

The settings file also seems to have some options for intros. What are these for? Is this tool also supposed to replace the current Plex intro detection? Why? Is there any way to disable that and only keep the credits detection feature?

Anyway, that's a very nice utility you've made. Thanks a lot!

Not detecting changed directories

Hi @cjmanca!

First of all I want to say that this is an amazing tool! Thanks for all your work on this!

I believe I've discovered a bit of a bug related to change detection. After the initial processing, I have been adding media, but plex-credits-detect has not been detecting it. It only detects after a restart of the application. I did some troubleshooting and I found that the Plex database query was returning incorrectly.

I opened the db open in DB Browser, and you can see there is a changed directory at 9:16.

image

However, in the code, it's returning no rows after 8:55.

image

I even tweaked the code a bit to return all rows from the directories table, and result.Get<DateTime>("updated_at") still showed the old date.

I'm not sure if this is related to the fact that Plex seems to be using SQLite in WAL mode. But I tried creating the connection with sb.JournalMode = SQLiteJournalModeEnum.Wal and that didn't help.

image

The only thing that fixed this issue for me was closing and reopening the connection at the beginning of GetRecentlyModifiedDirectories. I suppose it's not the worst solution in the world since it happens at most 1/minute, but it doesn't seem right. If you have more experience with SQLite, may you'll have some idea why the queries seem to be returning stale data!

PlexDB Unhandled exception. System.InvalidCastException: Specified cast is not valid.

I ran the script for the first time against my plex server and I'm encountering this error:

plex-credit-detect | Loading global config file: /config/plex-credits-detect/fingerprint.ini
plex-credit-detect | Unhandled exception. System.InvalidCastException: Specified cast is not valid.
plex-credit-detect |    at System.Data.SQLite.SQLiteDataReader.VerifyType(Int32 i, DbType typ)
plex-credit-detect |    at System.Data.SQLite.SQLiteDataReader.GetInt32(Int32 i)
plex-credit-detect |    at plexCreditsDetect.Database.SQLResultInfo.GetInt(String v) in /src/plex-credits-detect/Database/SQLResultInfo.cs:line 37
plex-credit-detect |    at plexCreditsDetect.Database.SQLResultInfo.Get[T](String v) in /src/plex-credits-detect/Database/SQLResultInfo.cs:line 109
plex-credit-detect |    at plexCreditsDetect.Database.PlexDB.GetRootDirectories() in /src/plex-credits-detect/Database/PlexDB.cs:line 630
plex-credit-detect |    at plexCreditsDetect.Database.PlexDB.get_RootDirectories() in /src/plex-credits-detect/Database/PlexDB.cs:line 35
plex-credit-detect |    at plexCreditsDetect.Program.Main(String[] args) in /src/plex-credits-detect/Program.cs:line 31

I'm running the docker image for plex-credits-detect and the plex docker image plexinc/pms-docker
Disks are mounted to the Docker images for Plex and plex-credits-detect as: (Using docker-compose)

volumes:
      - /disk1/media/Videos/Movies:/data/movies_1
      - /disk1/media/Videos/TV Shows:/data/tv_1
      - /disk2/media/Videos/Movies:/data/movies_2
      - /disk2/media/Videos/TV Shows:/data/tv_2
      - /disk2/media/Videos_3D/Movies:/data/movies_3d
      - /disk2/media/Videos_3D/TV Shows:/data/tv_3d
      - /disk2/media/Videos_4K/Movies:/data/movies_4K
      - /disk2/media/Videos_4K/TV Shows:/data/tv_4k

The Plex media libraries are named:
Movies
Movies 3D
Movies 4K
TV Shows
TV Shows 3D
TV Shows 4K

My [directories] section is set to the following. Note that the Docker Image for Plex and plex-credits-detect are using the same directory structure

[directories]
/data/movies_1 = /data/movies_1
/data/tv_1 = /data/tv_1
/data/movies_2 = /data/movies_2
/data/tv_2 = /data/tv_2
/data/movies_3d = /data/movies_3d
/data/tv_3d = /data/tv_3d
/data/movies_4K = /data/movies_4K
/data/tv_4k = /data/tv_4k

I've attempted to repair the Plex DB using the instructions at https://support.plex.tv/articles/repair-a-corrupted-database/
No database corruption was detected in the process, I've performed all the steps outlined except the "Low-level database recovery" since I was not seeing an issue.

Plex is also setup with the plex-meta-manager docker image from linuxserver/plex-meta-manager, which may affect the DB structure.

End of Life notice

@cjmanca Following this notice:

Since I heard that Plex had been working on their own version of credit detection which will soon make it's way into the official PMS, I stopped working on this, and will no longer provide updates.

I'd just like to throw my 2 cents here and note that AFAIK Plex already has a similar thing to this (but only for opening credits), but that's only available to Plex Pass subscribers. plex-credits-detect offloads the work into your PMS. I doubt that even if they are working on improving it, it'll be available for non-Plex Pass subscribers, so I'd appreciate keeping this project alive.

unknown tokenizer: collating while executing SQL

When running plex-credits-detect.exe after creating the global ini I get the following error:

First time run detected. The first run can take a long time to build up the database from your plex database. It may appear to be frozen, but give it time.

Syncing newly added episodes from plex...

PlexDB.ExecuteDBCommand exception: SQL logic error
unknown tokenizer: collating while executing SQL: INSERT INTO tags(key, extra_data, updated_at, created_at, user_music_url, user_art_url, user_thumb_url, tag_type, tag) VALUES('', '', DATE(), DATE(), '', '', '', 12, '');

ffmpeg error on international windows

ffmpeg throws an error when windows is configured to use international comma symbol "," instead of the us version "."
Temporary fix is to change it from "," to "." manually in windows language settings.

Unhandled exception. System.ArgumentOutOfRangeException

I'm getting this error when running it now.
It scanned a bunch of episodes at first, then it just stopped.
now i get this error when starting the program.

running on windows server 2019

Syncing newly added episodes from plex...

Unhandled exception. System.ArgumentOutOfRangeException: Not a valid Win32 FileTime. (Parameter 'fileTime')
   at System.DateTime.FromFileTimeUtc(Int64 fileTime)
   at plexCreditsDetect.Episode.ParseInfoFromPath(String path) in C:\Documents\projects\plex-credits-detect\plex-credits-detect\Episode.cs:line 319
   at plexCreditsDetect.Database.PlexDB.GetRecentPlexIntroTimingsSingleQuery(DateTime since) in C:\Documents\projects\plex-credits-detect\plex-credits-detect\Database\PlexDB.cs:line 446

   at plexCreditsDetect.Scanner.CheckForNewPlexIntros() in C:\Documents\projects\plex-credits-detect\plex-credits-detect\Scanner.cs:line 1398
   at plexCreditsDetect.Program.Main(String[] args) in C:\Documents\projects\plex-credits-detect\plex-credits-detect\Program.cs:line 98

Unhandled exception. System.DllNotFoundException:

Getting a strange error when running tool on a Mac. Any ideas on this ?

Detecting: /100 Girls (2000)/100.Girls.2000.1080p.WEBRip.x265-newzNZB-xpost.mp4
Unhandled exception. System.DllNotFoundException: Unable to load DLL 'avformat.58': The specified module could not be found.
at FFmpeg.AutoGen.ffmpeg.LoadLibrary(String libraryName, Boolean throwException)
at FFmpeg.AutoGen.ffmpeg.<>c.<.cctor>b__6_0(String libraryName)
at FFmpeg.AutoGen.ffmpeg.<>c.<.cctor>b__6_318()
at FFmpeg.AutoGen.ffmpeg.avformat_alloc_context()
at plexCreditsDetect.ffmpeghelper.GetDuration(String path) in C:\Documents\projects\plex-credits-detect\plex-credits-detect\ffmpeghelper.cs:line 23
at plexCreditsDetect.Episode.get_duration() in C:\Documents\projects\plex-credits-detect\plex-credits-detect\Episode.cs:line 525
at plexCreditsDetect.Scanner.GetSearchDuration(Episode ep, Settings settings, Boolean isCredits) in C:\Documents\projects\plex-credits-detect\plex-credits-detect\Scanner.cs:line 314
at plexCreditsDetect.Scanner.GetTimings(Episode ep, Settings settings, Boolean isCredits, Segment seg) in C:\Documents\projects\plex-credits-detect\plex-credits-detect\Scanner.cs:line 201
at plexCreditsDetect.Scanner.DetectSilence(Episode ep, Settings settings) in C:\Documents\projects\plex-credits-detect\plex-credits-detect\Scanner.cs:line 1130
at plexCreditsDetect.Scanner.HandleInsert(Episode ep, Settings settings, Int32 detected) in C:\Documents\projects\plex-credits-detect\plex-credits-detect\Scanner.cs:line 967
at plexCreditsDetect.Scanner.ScanDirectory(String path, Settings settings) in C:\Documents\projects\plex-credits-detect\plex-credits-detect\Scanner.cs:line 725
at plexCreditsDetect.Program.Main(String[] args) in C:\Documents\projects\plex-credits-detect\plex-credits-detect\Program.cs:line 131
Abort trap: 6

Not getting any ini in any media folder?

Hey love the concept. I have v1.1.0, everything seems to be running smooth though when it scanned my TV Shows library it flew through it and only ever showed Detection Took 1 or whatever. Mind you I have over 3,000 TV Shows so I kinda expected it to take a while. Now it is scraping movies and taking much longer but still only 1 movie it shows...
Black frames found from 7080.71 to 7322.71. Duration 242.00.
Black frames found from 7762.71 to 7783.71. Duration 21.00.
Inserting match: from 7080.71 to 7322.71. Duration 242.00
Inserting match: from 7762.71 to 7783.71. Duration 21.00.

Detection took 1:29:32.7674252

The rest just say Detection took etc and I'm not seeing any ini files in any TV show folder, season folder or movie folder. Including the one that spat out the Inserting Match. What's wrong? And I have no Shows with the skip credits option. Yes I have plex pass. Attached is my ini. Redacted name in path with *****

[directories]


[intro]
introStart = 0
introEnd = 0.5
introMaxSearchPeriod = 900

[credits]
creditsStart = 0.75
creditsEnd = 1.0
creditsMaxSearchPeriod = 600

[matching]
useAudio = true
useVideo = false
introMatchCount = 0
creditsMatchCount = 1
quickDetectFingerprintSamples = 5
fullDetectFingerprintMaxSamples = 10
audioAccuracy = 4
stride = 512
sampleRate = 5512
minFrequency = 100
maxFrequency = 2750
videoAccuracy = 2
videoSizeDivisor = 50
frameRate = 1

[silence]
detectSilenceAfterCredits = true
silenceDecibels = -55

[blackframes]
detectBlackframes = true
blackframeOnlyMovies = true
blackframeUseMaxSearchPeriodForEpisodes = true
blackframeUseMaxSearchPeriodForMovies = false
blackframeScreenPercentage = 75
blackframePixelPercentage = 2
blackframeMovieMinimumMatchSeconds = 20

[timing]
shiftSegmentBySeconds = 2
minimumMatchSeconds = 20
PermittedGap = 3
PermittedGapWithMinimumEnclosure = 10

[redetection]
crawlDirectoriesOnStartup = false
recheckBlackframesOnStartup = false
recheckSilenceOnStartup = false
recheckUndetectedOnStartup = false
forceRedetect = false
redetectIfFileSizeChanges = true

[monitoring]
monitorPlexIntros = true
monitorDirectoryChanges = true

[paths]
databasePath = C:\Users\******\AppData\Roaming\plex-credits-detect\database
PlexDatabasePath = C:\Users\******\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db
TempDirectoryPath = C:\Users\******\AppData\Roaming\plex-credits-detect\temp
ffmpegPath = C:\Users\*****\Desktop\plex-credits-detect-1.1.0\net6.0\ffmpeg.exe

Uninstallation / Removal of inserted markers into the DB

Firstly, I wanted to say a massive thank you to you for creating this project. Like many others have experienced, this has been an amazing stop gap in the plex product offering until plex added this natively themselves, and I cannot thank you enough for that - countless hours must have gone into developing and fine tuning this for the community <3

I wanted to open a discussion around the best way to go about uninstalling plex-credits-detect, specially around how to remove the markers that were added to the DB. Im not sure if they might conflict with the new credit markers that plex will be adding in, or if they can live side by side with each other?

FWIW, I am running plex-credits-detect through your docker image, cjmanca/plex-credits-detect:main

Any guidance you can provide would be greatly appreciated!

Semantic versioning for container image releases

Hi

Would it be possible to provide semantic version releases for the container images?
I'm currently running the "main" container image, but have no idea which version this represents nor is it visible when this is updated.

Thanks for the big improvement to my plex life!

[directories] path doesn't exist: d1

Problem

The generated config/fingerprint.ini from version 1.0.4 uses the path format from 1.0.1 instead of the new format found in the README.md

Changing d1 = C:\path\to\library to a user-defined path like d1 = C:\Users\test\Videos presents this error:

[directories] path doesn't exist: d1

Solution

1.0.4 requires the path to be listed as the following:

C:\path\to\library = C:\path\to\library

or in my case

C:\Users\test\Videos = C:\Users\test\Videos

Thank you for this amazing tool!

Bad Configuration for docker

hello i get this message : A library section has invalid information: /data/movies

but i give all volumes access ....
/plex=/data
/plex2=/data2
/plex3=/data3
/plex4=/data4

can you made a better exemple of use for full docker environement ?

this is my config for docker-compose.yml

plex-server:
    container_name: plex-server
    image: plexinc/pms-docker:latest
    restart: unless-stopped
    environment:
      - TZ=${TZ} # timezone, defined in .env
    network_mode: host
    volumes:  
      - /var/run/docker.sock:/var/run/docker.sock
      - ${ROOT}/config/plex/db:/config # plex database
      - ${ROOT}/config/plex/transcode:/transcode # temp transcoded files
      - ${ROOT}/complete:/data # media library
      - ${ROOT2}/complete:/data2 # media library
      - ${ROOT3}/complete:/data3 # media library
      - ${ROOT4}/complete:/data4 # media library

  plex-credits-detect:
    container_name: plex-credits-detect
    image: cjmanca/plex-credits-detect:main
    restart: unless-stopped
    environment:
      - PUID=${PUID} # default user id, defined in .env
      - PGID=${PGID} # default group id, defined in .env
      - TZ=${TZ} # timezone, defined in .env
    network_mode: host
    volumes:  
      - /var/run/docker.sock:/var/run/docker.sock
      - ${ROOT}/config/plex-credits-detect:/config # plex-credits-detect database
      - ${ROOT}/config/plex/db/Library/Application Support/Plex Media Server/Plug-in Support/Databases/:/PlexDB # plex database
      - ${ROOT}/complete:/plex # media library
      - ${ROOT2}/complete:/plex2 # media library
      - ${ROOT3}/complete:/plex3 # media library
      - ${ROOT4}/complete:/plex4 # media library

Scheduling

Add the ability to specify a schedule for when to do processing. Also the option to exit when done.

End of file error and No such file or directory error

I'm getting the same errors on the same episodes, each time i open the program it autoscans this same shows season every time and throws these errors everytime. This show has been in my Plex server since like day 1, and I have not edited this Show/Season since when I first added it. I can verify the files are in the folders, and can play in Plex. And not understanding what the End of file error is. I've gotten it for other videos as well now. Here is output

DetectSingleEpisode Exception: System.AggregateException: One or more errors occurred. (End of file)
 ---> System.ApplicationException: End of file
   at SoundFingerprinting.Emy.FFmpeg.Common.ErrorExtensions.ThrowExceptionIfError(Int32 error)
   at SoundFingerprinting.Emy.FFmpeg.Demuxer.OpenInputFile(String file)
   at SoundFingerprinting.Emy.FFmpeg.Demuxer..ctor(String file, MediaType mediaType, CancellationToken cancellationToken)
   at SoundFingerprinting.Emy.AudioVideo.Data.FFmpegDataService.ReadAVTrack(String source, MediaType mediaType, Double seconds, Int32 count, AVTrackReadConfiguration avTrackReadConfiguration, CancellationToken cancellationToken)+MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at SoundFingerprinting.Emy.AudioVideo.Data.FFmpegDataService.ReadTrack(String file, MediaType mediaType, Double seconds, AVTrackReadConfiguration configuration)
   at SoundFingerprinting.Emy.FFmpegAudioService.ReadAVTrackFromFile(String pathToFile, AVTrackReadConfiguration configuration, Double seconds, Double startsAt, MediaType mediaType)
   at SoundFingerprinting.Emy.FFmpegAudioService.GetAudioTrack(String path, Int32 sampleRate, Double seconds)
   at SoundFingerprinting.Emy.FFmpegAudioService.ReadMonoSamplesFromFile(String path, Int32 sampleRate, Double seconds, Double startAt)
   at SoundFingerprinting.Command.FingerprintCommand.<>c__DisplayClass13_0.<From>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at SoundFingerprinting.Command.QueryCommand.Query(DateTime relativeTo)
   at SoundFingerprinting.Command.QueryCommand.Query()
   --- End of inner exception stack trace ---
   at plexCreditsDetect.Scanner.DoSingleQuery(Settings settings, Boolean isCredits, Episode ep, MediaType avtype, Segments audioSegments, Segments videoSegments)
   at plexCreditsDetect.Scanner.DetectSingleEpisode(Episode ep, Settings settings) in C:\Documents\projects\plex-credits-detect\plex-credits-detect\Scanner.cs:line 441

Detecting: /The Simpsons (1987)/Season 2/The Simpsons - S02E02 - Simpson and Delilah.mkv
DetectSingleEpisode Exception: System.AggregateException: One or more errors occurred. (No such file or directory)
 ---> System.ApplicationException: No such file or directory
   at SoundFingerprinting.Emy.FFmpeg.Common.ErrorExtensions.ThrowExceptionIfError(Int32 error)
   at SoundFingerprinting.Emy.FFmpeg.Demuxer.OpenInputFile(String file)
   at SoundFingerprinting.Emy.FFmpeg.Demuxer..ctor(String file, MediaType mediaType, CancellationToken cancellationToken)
   at SoundFingerprinting.Emy.AudioVideo.Data.FFmpegDataService.ReadAVTrack(String source, MediaType mediaType, Double seconds, Int32 count, AVTrackReadConfiguration avTrackReadConfiguration, CancellationToken cancellationToken)+MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at SoundFingerprinting.Emy.AudioVideo.Data.FFmpegDataService.ReadTrack(String file, MediaType mediaType, Double seconds, AVTrackReadConfiguration configuration)
   at SoundFingerprinting.Emy.FFmpegAudioService.ReadAVTrackFromFile(String pathToFile, AVTrackReadConfiguration configuration, Double seconds, Double startsAt, MediaType mediaType)
   at SoundFingerprinting.Emy.FFmpegAudioService.GetAudioTrack(String path, Int32 sampleRate, Double seconds)
   at SoundFingerprinting.Emy.FFmpegAudioService.ReadMonoSamplesFromFile(String path, Int32 sampleRate, Double seconds, Double startAt)
   at SoundFingerprinting.Command.FingerprintCommand.<>c__DisplayClass13_0.<From>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at SoundFingerprinting.Command.QueryCommand.Query(DateTime relativeTo)
   at SoundFingerprinting.Command.QueryCommand.Query()
   --- End of inner exception stack trace ---
   at plexCreditsDetect.Scanner.DoSingleQuery(Settings settings, Boolean isCredits, Episode ep, MediaType avtype, Segments audioSegments, Segments videoSegments)
   at plexCreditsDetect.Scanner.DetectSingleEpisode(Episode ep, Settings settings) in C:\Documents\projects\plex-credits-detect\plex-credits-detect\Scanner.cs:line 441```

`PlexDB ExecuteDBCommand SQLite error code 11: database disk image is malformed`

I just ran the script for the first time, and it seemed to be chugging along fine, but when checking the logs after an hour or so it just says PlexDB ExecuteDBCommand SQLite error code 11: database disk image is malformed repeated over and over. If I restart the Docker container I get:

log
today at 1:42:49 AM Loading global config file: /config/plex-credits-detect/fingerprint.ini
today at 1:42:49 AM 
today at 1:42:49 AM Syncing newly added episodes from plex...
today at 1:42:49 AM 
today at 1:42:49 AM Found changed directories: 0 
today at 1:42:49 AM 
today at 1:42:49 AM 
today at 1:42:49 AM Compiling list of pending seasons...
today at 1:42:49 AM 
today at 1:42:49 AM 
today at 1:42:49 AM Processing season 1 of 278: /tv/Show Name (2022)/Season 01
today at 1:42:49 AM 
today at 1:42:49 AM Fingerprinting: /Show Name (2022)/Season 01/Show Name (2022) - S01E01 - Episode Name.mkv (0:49:04.68 - 0:59:04.68)
today at 1:42:53 AM Fingerprinting: /Show Name (2022)/Season 01/Show Name (2022) - S01E02 - Episode Name.mkv (0:47:51.36 - 0:57:51.36)
today at 1:42:56 AM Fingerprinting: /Show Name (2022)/Season 01/Show Name (2022) - S01E03 - Episode Name.mkv (0:48:03.8 - 0:58:03.8)
today at 1:42:59 AM Fingerprinting: /Show Name (2022)/Season 01/Show Name (2022) - S01E04 - Episode Name.mkv (0:48:15.76 - 0:58:15.76)
today at 1:43:03 AM Fingerprinting: /Show Name (2022)/Season 01/Show Name (2022) - S01E05 - Episode Name.mkv (0:47:45.52 - 0:57:45.52)
today at 1:43:06 AM 
today at 1:43:06 AM Detecting: /Show Name (2022)/Season 01/Show Name (2022) - S01E03 - Episode Name.mkv
today at 1:43:07 AM 
today at 1:43:07 AM Detecting: /Show Name (2022)/Season 01/Show Name (2022) - S01E04 - Episode Name.mkv
today at 1:43:13 AM Audio credits match from 3456.80 to 3491.92. Duration: 35.11.
today at 1:43:14 AM Match from 3456.80 to 3491.92. Duration: 35.11.
today at 1:43:14 AM PlexDB ExecuteDBCommand SQLite error code 11: database disk image is malformed

Does this mean my Plex DB got malformed all of a sudden (everything still seems to be working fine in Plex) or is it fingerprintMedia.db that's malformed?

Persist log output to log file

Hi

Is there a way to capture the output and send it to a rolling log file (preferably configurable)?

I've been periodically monitoring the container output to check on progress while it chews through my library.
At one point I noticed an error in the output of the container (was related to a corrupt mkv, not PCD) but I'm wondering how many I may have missed.

Again, thanks for this great project, it adds what I was still missing from Plex!

[Roku] Credit skip brings to intro time point rather than end

For a specific TV series when I select skip intro at the end - instead of being taken to the end of the episode I am taken back to where the skip intro at the beginning would take me.

I have not tested yet elsewhere as I have not yet seen the skip intro option anywhere else (it is still processing)

Unable to start container - `Invalid database path`

Hi, running the docker container (on a linux machine) for the first time with an initial fingerprint.ini file (just removed the mapping directory path)

Log:

Loading global config file: /config/plex-credits-detect/fingerprint.ini
PlexDB.LoadDatabase - Invalid database path
Unhandled exception. System.ArgumentException: Invalid database path
  at plexCreditsDetect.Database.PlexDB.LoadDatabase(String path) in /src/plex-credits-detect/Database/PlexDB.cs:line 69
  at plexCreditsDetect.Program.Main(String[] args) in /src/plex-credits-detect/Program.cs:line 31

fingerprint.ini

[directories]

[intro]
introStart = 0
introEnd = 0.5
introMaxSearchPeriod = 900

[...]

[paths]
databasePath = /config/plex-credits-detect/database
PlexDatabasePath = /PlexDB/com.plexapp.plugins.library.db
TempDirectoryPath = /config/plex-credits-detect/temp
ffmpegPath = ffmpeg

Docker command:

docker run \
	-d \
	--restart=always \
	-v $DATADIR/config:/config \
	-v '/mnt/SSD2/PlexMetas/Plug-in Support/Databases':/PlexDB \
	-v /media:/media:ro \
	--name $NAME \
	$IMAGE

Any thoughts?
Thx!

I don't understand how it works

Hello,

I'm struggling to make this work.
It doesn't scan any media.
It just says

plex-credits-detect    | Syncing newly added episodes from plex...
plex-credits-detect    |
plex-credits-detect    | Found changed directories: 0

I'm quite sure everything is okay, media directory is mounted as /data both for plex and plex-credits-detect.
docker exec -it plex-credits-detect /bin/sh shows that /data is correctly mounted and not empty.

I've added subdir for Movies / Shows in [directories] just to be sure, but nothing is changed
/PlexDB is also correctly mounted.

I can confirm that the .ini is correctly read by the app, because I misstyped a directory once and it showed up in the console.

Here's my .ini

[directories]
/data = /data
/data/Films = /data/Films
/data/Films4k = /data/Films4k
/data/Séries = /data/Séries
/data/Séries4k = /data/Séries4k

[intro]
introStart = 0
introEnd = 0.5
introMaxSearchPeriod = 900

[credits]
creditsStart = 0.75
creditsEnd = 1.0
creditsMaxSearchPeriod = 600

[matching]
useAudio = true
useVideo = false
introMatchCount = 0
creditsMatchCount = 1
quickDetectFingerprintSamples = 5
fullDetectFingerprintMaxSamples = 10
audioAccuracy = 4
stride = 512
sampleRate = 5512
minFrequency = 100
maxFrequency = 2750
videoAccuracy = 2
videoSizeDivisor = 50
frameRate = 1

[silence]
detectSilenceAfterCredits = true
silenceDecibels = -55

[blackframes]
detectBlackframes = true
blackframeOnlyMovies = true
blackframeUseMaxSearchPeriodForEpisodes = true
blackframeUseMaxSearchPeriodForMovies = false
blackframeScreenPercentage = 75
blackframePixelPercentage = 2
blackframeMovieMinimumMatchSeconds = 20

[timing]
shiftSegmentBySeconds = 2
minimumMatchSeconds = 20
PermittedGap = 3
PermittedGapWithMinimumEnclosure = 10

[redetection]
crawlDirectoriesOnStartup = false
recheckBlackframesOnStartup = false
recheckSilenceOnStartup = false
recheckUndetectedOnStartup = false
forceRedetect = false
redetectIfFileSizeChanges = true

[paths]
databasePath = /config/plex-credits-detect/database
PlexDatabasePath = /PlexDB/com.plexapp.plugins.library.db
TempDirectoryPath = /config/plex-credits-detect/temp
ffmpegPath = ffmpeg

[monitoring]
monitorPlexIntros = True
monitorDirectoryChanges = True

Are problem files retried?

While monitoring the output of the tool I've encountered 2 problem cases:

Detecting: /<movie>/<movie>
Black frames found from 5621.94 to 6088.94. Duration: 467.00.
PlexDB ExecuteDBCommand Database has been locked for a long time. Attempting to re-connect.
Inserting match:  from 5621.94 to 6088.94. Duration: 467.00.
FingerprintFile Exception: System.AggregateException: One or more errors occurred. (End of file)
 ---\u003e System.ApplicationException: End of file
   at SoundFingerprinting.Emy.FFmpeg.Common.ErrorExtensions.ThrowExceptionIfError(Int32 error)
   at SoundFingerprinting.Emy.FFmpeg.Demuxer.OpenInputFile(String file)
   at SoundFingerprinting.Emy.FFmpeg.Demuxer..ctor(String file, MediaType mediaType, CancellationToken cancellationToken)
   at SoundFingerprinting.Emy.AudioVideo.Data.FFmpegDataService.ReadAVTrack(String source, MediaType mediaType, Double seconds, Int32 count, AVTrackReadConfiguration avTrackReadConfiguration, CancellationToken cancellationToken)+MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at SoundFingerprinting.Emy.AudioVideo.Data.FFmpegDataService.ReadTrack(String file, MediaType mediaType, Double seconds, AVTrackReadConfiguration configuration)
   at SoundFingerprinting.Emy.FFmpegAudioService.GetAudioTrack(String path, Int32 sampleRate, Double seconds)
   at SoundFingerprinting.Emy.FFmpegAudioService.ReadMonoSamplesFromFile(String path, Int32 sampleRate, Double seconds, Double startAt)
   at SoundFingerprinting.Command.FingerprintCommand.\u003c\u003ec__DisplayClass13_0.\u003cFrom\u003eb__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)

In these cases will the file be retried on the next run, or do I need to set recheckUndetectedOnStartup = true for this to happen?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.