Simple script that does regex rename of seeded TV shows

Suggest, post, or discuss plugins for Deluge
Post Reply
tarruda
New User
New User
Posts: 2
Joined: Sat Dec 23, 2023 10:01 am

Simple script that does regex rename of seeded TV shows

Post by tarruda »

I just wanted to share a script I wrote to quickly rename whole seasons/shows to patterns that are recognized by Jellyfin while still seeding: https://gist.github.com/tarruda/1973d31 ... af33679cc1

Usage is pretty simple:

Code: Select all

python3 bulk-rename.py -d DELUGE_HOST -U USER -P PASSWORD TORRENT_HASH PYTHON_REGEX_WITH_CAPTURES REPLACEMENT_STRING
The script will show a preview of all the renames and ask for confirmation before proceeding. It will not rename if the number of target files is different than the number of source files .
User avatar
ambipro
Moderator
Moderator
Posts: 445
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: Simple script that does regex rename of seeded TV shows

Post by ambipro »

I would advise against this method for streamlining usage and use something like Radarr (movies) or Sonarr (TV) for library and download management in a media server and hardlinking the files. Alternatively if you do downloading manually, Filebot can hardlink/symlink files too. You end up with two references to the original file/data and no extra used space and don't modify the original torrent file structure.

If you ever lose a seed, getting it back this way would create problems.

Just a note for anyone looking for something to do this.

Edit: Not to discredit the idea, if it works then all is good, but there are other ways to accomplish the goal that don't modify state/torrent structure or require intervention. That's all.
tarruda
New User
New User
Posts: 2
Joined: Sat Dec 23, 2023 10:01 am

Re: Simple script that does regex rename of seeded TV shows

Post by tarruda »

I'm not familiar with Radarr or Sonarr. My setup is really simple, deluge daemon running on a Intel NUC, which also doubles as a streaming server. When downloads are complete, they are moved to Jellyfin media directory, which will automatically discover and populate the UI with media information.

This script is just for the cases where episode names are different from standard, to help Jellyfin discover the correct metadata.

I don't think original filename information is lost. Deluge must keep it stored somewhere, or else seeding wouldn't work. AFAICT seeding is still functional after rename
User avatar
ambipro
Moderator
Moderator
Posts: 445
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: Simple script that does regex rename of seeded TV shows

Post by ambipro »

I'd recommend you look into hardlinking or possibly symlinking. This is what Radarr and Sonarr do.

Radarr and Sonarr (along with other "arr's" such as Prowlarr - for tracker management - and Lidarr/Readarr) are all management and automation tools.

I suggest you look into the applications and https://trash-guides.info - I contribute to the guides and we have loads of tutorials on all of the basics you'd need.

Renaming the torrents in the client, in my opinion, should be a last resort. You can setup jellyfin, plex, emby, etc to hardlink (which makes a reference "file" identical to the original on the disk without consuming any extra space. Symlinks do similar, but are merely a "shortcut" to the file which something can reference - however with hardlinks until all references to the file are gone, the file will remain on disk and consume one file's worth of space. Symlinks rely on the original file being there - think of it like pointing a shortcut on your desktop to a exe that no longer exists.

The idea would essentially be, if you don't want to use an automation tool, use something like filebot and just have it sort and organize your media anyway you like and tell it to hardlink or symlink this data depending on your desire for continuing to seed or deleting seeds, and point your media server at the organized folder.

You can customize something like filebot or "arr" to name it however you like.

If this works for you, by all means do you, it's your setup not mine. I just thought that given the problem you are trying to solve a easier and more streamlined approach might be worth mentioning.

I'd recommend you check out trash's guides - which I contributed the deluge guide and any deluge-related guides - as well as other things, and check out Radarr, Sonarr, and Prowlarr.

We have a discord for the guides and set up if you have questions or need help, if you want to go down the automation route.
Post Reply