We should be referencing media_sources by their ID on programs,
external_ids, etc. This enables us to use proper foreign keys for
referential integrity at the DB level, not worry about unique names for
media sources, and simplifies a lot of the code relating to media source
deletion and the cleanup thereafter.
This change also introduces the DBContext, which should allow for
arbitrarily calling other DB accessor functions when within transactions
and not deadlocking the connection to the DB.
* refactor: massive backend refactoring
I've been putting off this refactor for a while, but now that the
mikro-orm removal and ffmpeg builder PRs are in, it is time.
* refactor: use ts import paths on server
Jellyfin item IDs are not stable. When the underlying file changes in
Jellyfin, apparently even if this file has the same path, Jellyfin will
regenerate the ID. An example of this is when an upgrade occurs to a
file from an *arr suite program. We can use existing IMDB/TMDB/TVDB IDs
we found when initially saving the item to search Jellyfin and find its
replacement. This is done on-the-fly when attempting to stream an item
that is subsequently not found.