• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support Troubleshooting SOLVED: Subtitle extraction

     
    • 1 Vote(s) - 5 Average

    SOLVED: Subtitle extraction

    subtitle extraction help
    sjorge
    Offline

    Junior Member

    Posts: 22
    Threads: 0
    Joined: 2023 Nov
    Reputation: 0
    Country:Belgium
    #14
    2024-08-10, 12:52 PM (This post was last modified: 2024-08-11, 10:28 AM by sjorge. Edited 6 times in total.)
    (2024-05-03, 12:35 PM)TheDreadPirate Wrote: Yes and yes.  Though if deleted in file explorer Jellyfin won't delete the subtitles until the next scan or if real time monitoring is enabled.

    Sadly it doesn't look like they ever get cleaned up.

    Code:
    Aug 09 07:32:59 fqdn jellyfin[398659]: [07:32:59] [INF] ffmpeg subtitle extraction completed for /mm/Series/Rick and Morty (2013)/Rick and Morty - S07E05 - Unmortricken.mkv to /var/lib/jellyfin/data/subtitles/0/0e230db0-1f4f-93f3-f642-8b95ce07cb12.srt
    ...
    Aug 10 14:43:23 fqdn jellyfin[398659]: [14:43:23] [INF] Removing item, Type: Series, Name: Rick and Morty, Path: /mm/Series/Rick and Morty (2013), Id: 2c6787f7-72aa-ef8d-588a-2ac214b2d1a0

    One would expect the subtitles to be removed in this case. But it's still there.

    Code:
    root@node:~# ls -l /var/lib/jellyfin/data/subtitles/0/0e230db0-1f4f-93f3-f642-8b95ce07cb12.srt
    -rw-r--r-- 1 jellyfin jellyfin 22685 Aug  9 07:32 /var/lib/jellyfin/data/subtitles/0/0e230db0-1f4f-93f3-f642-8b95ce07cb12.srt

    Even after 2 additional 'Scan All Libraries' and the scheduled tasks Subtitle Extract (would not expect this to clean it up looking at the code) and Clean Cache Directory (Most likely candidated) have run.

    I can also not find any reference in the code to where this gets cleaned up, just the Subtitle Extract task will call the function to extract subtitles, which will check they exist already first. And playback of an item requiring subs will also trigger the same call. But there is no delete happening everywhere, as far as I can see, there is also no reference to this in the database. I would have perhaps expected library.db -> mediastreams to have been updated with a complete Path field pointing to the cache, but this is also not the case.

    If I do every find a way to cleanup old files here, I'll edit this post but for now it seems to be very hard to do. Aside from nuking everything in that dir and running Subtitle Extract again which will then obviously not extract subtitles for the media that got removed.

    Edit: writing a script to do it is not going to be easy Slightly-frowning-face I tried something in python and typescript (the two languages I know but their date functions lack the required persision that C# has)

    Edit 2:

    Very much as-is as this is the first C# code I have written in over 10 years ...
    https://gist.github.com/sjorge/db3661f5d...6cdc85eb4e

    I made sure subtitle extract ran, dropped a .ignore, ran a scan all libraries.
    Then ran the little program above, I'm not very happy with the code quality but it gets the job done.

    Code:
    sjorge@node:~$ sudo -u jellyfin /var/lib/jellyfin/.cron/jf_subtitle_cache_cleaner
    Opening /var/lib/jellyfin/data/library.db ...
    Looking up subtitle mediastreams ...
    Detected 35085 valid subtitle cache paths.
    Subtitle cache: purged=88, kept=35085

    I guess this could be cleaned up and turned into a seperate scheduled task... not sure that would be acceptable though.

    Edit 3: I filed an issue https://github.com/jellyfin/jellyfin-plu.../issues/35
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)


    Messages In This Thread
    Subtitle extraction - by RxCarmen - 2023-06-22, 04:28 PM
    RE: Subtitle extraction - by crobibero - 2023-06-22, 05:25 PM
    RE: Subtitle extraction - by RxCarmen - 2023-06-22, 05:59 PM
    RE: Subtitle extraction - by crobibero - 2023-06-23, 12:15 AM
    RE: Subtitle extraction - by RxCarmen - 2023-06-23, 06:50 AM
    RE: Subtitle extraction - by RxCarmen - 2023-06-25, 10:29 AM
    RE: Subtitle extraction - by thornbill - 2023-06-25, 09:48 PM
    RE: Subtitle extraction - by Shadowghost - 2023-06-26, 03:07 PM
    RE: Subtitle extraction - by wolfrumble4398 - 2024-05-03, 06:47 AM
    RE: Subtitle extraction - by TheDreadPirate - 2024-05-03, 12:35 PM
    RE: Subtitle extraction - by wolfrumble4398 - 2024-05-04, 03:29 PM
    RE: Subtitle extraction - by sjorge - 2024-08-10, 12:52 PM
    RE: Subtitle extraction - by seseau1 - 2024-05-15, 04:52 PM
    RE: Subtitle extraction - by TheDreadPirate - 2024-05-15, 04:58 PM

    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode