I use Intro Skipper to automatically skip the intros/recaps in TV shows. But I have found that the automatic intro detection is not great and often misidentifies the media segments a bit. Because of that, for some TV shows, I have put a lot of time/effort into manually setting the media segments for each episode using the Segment Editor in the Jellyfin web UI.

But recently, for whatever reason, I seem to have lost that media segment data. Now, when I watch any of those episodes that I had definitely meticulously manually set the media segments on, it just has the original automatically-generated bad segments again instead.

I definitely have backups of this server. Can I just restore a certain folder from a backup in order to restore my media segments? Searching around the filesystem, I just cannot find where media segment data is stored. Furthermore, I am concerned that the filenames and everything may no longer match. As far as I understand, shows/episodes/etc. in the Jellyfin filesystem are actually assigned a random n-character unique identifier, and I worry that identifier for each item may not be exactly the same as it was in my backups for whatever reason.

  • ragebutt@lemmy.dbzer0.com
    Aquileo | link
    Aquileo | fedilink
    English
    Aquileo | arrow-up
    1
    ·
    14 days ago

    what version and are you actually using the intro skipper plugin? After (iirc) 10.10 the plugin was upstreamed and is now media segments built into the app, though it’s technically still listed as a plugin

    Prior to 10.10 with the 3rd party plugin there should be an introskipper.db file in /config/data/introskipper (full path depends on os/install. After that it was integrated into the main Jellyfin.db in /config/data

    Note that restoring an old Jellyfin.db means any changes since the file was used (watch status, media import, metadata changes, etc) will need to be recreated. This generally isn’t a huge issue (rescan library and mark whatever as watched since backup) unless you’ve made a bunch of manual metadata overrides or custom images or something. Def the easiest option if that’s not the case

    Theoretically you could extract the “MediaSegments” table and insert it into current db but you should definitely back up the current db before you muck around with this. I certainly have had to muck with the db and it can create weirdness (there’s a bug with live tv where orphaned channels never go away so if you change iptv subscriptions every few months you can end up with like 70,000 channels, 90% of which don’t work. Only workaround I’ve found is to manually empty the tables in the db. Been present for at least 5 years but I’m pretty sure tv tuner stuff is a super low priority)

    You are also correct: media identifiers are GUID hashed from the path (including filename). Changing path to media or filename will change the identifier. You could probably remap this in the db too but this is honestly probably a fucking nightmare and it would probably be easier to just read the values from a backup and add them back manually

    • SatyrSack@quokk.auOP
      Aquileo | link
      Aquileo | fedilink
      English
      Aquileo | arrow-up
      1
      ·
      14 days ago

      it would probably be easier to just read the values from a backup and add them back manually

      Is there a way to do it… programmatically? Can I write a script or something to:

      1. Identify the GUIDs for the relevant items in the backup database
      2. Identify what the GUIDs for those same items are now in the current database
      3. Run a command to overwrite the current media segment values with the media segment values from the backup
      • ragebutt@lemmy.dbzer0.com
        Aquileo | link
        Aquileo | fedilink
        English
        Aquileo | arrow-up
        1
        ·
        13 days ago

        I’m sure that’s possible but it’s beyond my pay grade. I guess the question is is writing the code for such a thing less labor intensive than tedious data entry

        • SatyrSack@quokk.auOP
          Aquileo | link
          Aquileo | fedilink
          English
          Aquileo | arrow-up
          1
          ·
          12 days ago

          I assume the correct database file is this file in my filesystem:

          docker/jellyfin/jellyfin-config/data/jellyfin.db
          

          How can I run arbitrary SQL commands on this database file? I assume there is a simple way, similar to using SQLite to manipulate a SQLite file via the command line. I understand it is somewhat dangerous to manually manipulate the Jellyfin database, so I am prepared to restore this file from a backup in case I mess anything up.

          As for the tediousness of this process, my big worry is doing this again. I am not sure exactly what I had done to lose my media segment data the first time. If I accidentally lose it again in the future, I want to have a script on hand that provides a relatively quick way to restore them from a backup instead of having to create them manually again and again. I can also share that script here and potentially help someone else who may find themselves in this situation in the future.

          • ragebutt@lemmy.dbzer0.com
            Aquileo | link
            Aquileo | fedilink
            English
            Aquileo | arrow-up
            1
            ·
            12 days ago

            It is as you say, just sqlite3 via command line. I’m sure there are guis as well.

            For deleting live tv channels for example I use:

            sqlite3 /appdata/jellyfin/data/jellyfin.db “DELETE FROM BaseItems WHERE Type = ‘MediaBrowser.Controller.LiveTv.LiveTvChannel’;” sqlite3 /appdata/jellyfin/data/jellyfin.db “DELETE FROM BaseItems WHERE Type = ‘MediaBrowser.Controller.LiveTv.LiveTvProgram’;"

            Of course make sure Jellyfin is not running as live editing the db will likely result in corruption.

            It can also be wise to do an integrity check to make sure your edits didn’t wreck shit

            sqlite3 /appdata/jellyfin/data/jellyfin.db “PRAGMA integrity_check;"

            Alternatively you may be able to do this more safely via the swagger api but I just learned about this so im not sure: http://[jellyfin-ip]:8096/api-docs/swagger . Documentation here https://api.jellyfin.org/