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.

you are viewing a single comment's thread
view the rest of the comments
[–] [S] 1 point 3 months ago (3 children)

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
  • source
  • parent
  • hideshow 3 child comments
  • [–] 1 point 3 months ago (2 children)

    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

  • source
  • parent
  • hideshow 2 child comments
  • [–] [S] 1 point 3 months ago (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 3 months 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/

  • source
  • parent