A collection of python scripts and helper classes to interface with Jellyfin and qBittorrent APIs
README.md

Hopefully one person can find these helpful for their personal examples. These likely aren't useful to anyone in their current form as they're set up for my environment, but sharing's caring, right? #

countedRequests.py just contains a class that can help to measure # of calls to a function, and how long that takes to execute. It's intended to be used for API requests, but can be used for anything, really. It also keeps track of what and where that's called from.

customApiLibrary.py inherits countedRequests and sets up some basic methods for interacting with the API

jellyfinCustomApiLibrary.py and qbittorrentCustomLibrary.py are meant to be used directly by scripts, providing a jellyfin and qbittorrent object respectively to interface with. In particular I like jellyfinCustomApiLibrary's "modifyItem" method who tries to efficiently modify Jellyfin items in a way that requires minimal programmatic effort from any implementation of modifying items.

pre-download.py runs as a torrent's added to qbittorrent. It's intended to fix the name of the file within the torrent to match btn's own formatting. This is to help standardize how episodes are referred to, and hopefully contain something akin to 'S00E00' formatting. It also moves the torrent into a qbittorrent category based on the name from btn, removes files from folders if they're in a 'Season' category, and renames files within to match identical files that were renamed in the folder, then delete those files and recheck this torrent. It does quite a bit.

pause_public_trackers-neo.py runs after a torrent finishes. It checks torrent trackers off a list of private trackers so that anything that's not listed gets trackers deleted and paused. It has the ability to auto-tag torrents, and rename movies in the Movie category so their filename contains a bunch of information about aspect ratio and subtitles.

Both these run mergeAndLabelJellyfinEpisodes.py which was created to merge duplicate entries of videos in Jellyfin. The plugin for Jellyfin didn't work for me so this was my solution. Additionally, it's had the functionality added that it adds a "Fullscreen" or "Widescreen" genre to every Jellyfin episode.

manipulateqbt.py is a command-line script to help me rename files in qbittorrent by regex, including doing math on the files, for when tvdb's metadata disagrees with how the torrent's listed.

redownload.py gives me the ability to redownload 'Season's from qbittorrent whom I've deleted / paused the download of to save space. I mainly use this to perform that action with my phone.