completely new, want to start simple

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
cyr0nk0r
Posts: 14
Joined: 15 Nov 2020, 20:23

completely new, want to start simple

Post by cyr0nk0r »

I am 100% new to automating filebot.
I have an ubuntu VM that I run transmission-daemon. I use transmission GUI.

Step 1: I download a torrent, and transmission downloads it to to
/mnt/media/downloads/incomplete

Step 2: when the file(s)/folder(s) are done, transmission moves it to
/mnt/media/downloads/complete

Step 3: After that, I would usually manually open filebot on my windows desktop, browse to the SMB file share for /mnt/media/downloads/complete/<tv show season> that I just downloaded, run filebot and it will fix the files inside just that 1 directory I just downloaded.
I use the following filebot preset to rename things:
{ny.removeAll(/[!?.:#]+$/)} - {s00e00} - {t.removeAll(/[!?.:#]+$/).replaceAll(/[`´‘’ʻ!?:;#]/, "")}.{vf.lower()}.{vc.lower()}

Step 4: I then manually move the folder and organize it in my plex media directory.


what I'm looking to do is automate ONLY step 3. I can edit the settings.json file on the transmission linux VM to have it run an SH script. But I'm at a bit of a loss on a few things.

Item 1: I want the input folder to be the folder that was just downloaded. I'm not interested in running filebot against an entire media archive on any kind of schedule. Thus, the "input" folder's name is dynamic and unknown until the torrent is actually completed. How do I account for this?

Item 2: I don't want the "output" folder being different. I want the files renamed inside the same folder they already exist in. Replicating exactly how it works with the filebot gui. I don't want filebot or transmission moving files around.

Item 3: here is my current arguments txt file using the @files method to call the filebot script via CLI that I'm using to try and test all this, but not sure what I need to modify to accomplish the above items.

Code: Select all

-script
fn:amc
--output
"/mnt/media/downloads/complete"
--log-file
"/home/user/amc.log"
--action
hardlink
--conflict
override
-non-strict
--def
music=n
artwork=n
--def
"seriesFormat={ny.removeAll(/[!?.:#]+$/)} - {s00e00} - {t.removeAll(/[!?.:#]+$/).replaceAll(/[`´‘’ʻ!?:;#]/, "")}.{vf.lower()}.{vc.>
--def
"ut_label=TV"
--def
"seriesDB=TheMovieDB::TV"
alzheimerspenguin
Posts: 2
Joined: 09 Jun 2024, 12:45

Re: completely new, want to start simplehe following filebot pr

Post by alzheimerspenguin »

I can actually help with most of this but most of the way you're doing things will create endless and needless complications for you so I thought I'd mention them first.
I have an ubuntu VM that I run transmission-daemon. I use transmission GUI.
Transmsission (while in some way is the best torrent client) frustratingly lacks the ability to have more than one default download directory.
If you don't want everything dumped in one directory, you have to set the destination per torrent, every time you add one.
Luckily, you're using the GUI anyway, so doing so is not out of your way much.

You'll massively simplify your automation project if you separate different types of media into separate directories when you download them.

For example, when you add a movie torrent to transmission, set the destination directory to:
/home/alzheimers/torrents/movies
tv show?
/home/alzheimers/torrents/tv
music?
/home/alzheimers/torrents/music
After that, I would usually manually open filebot on my windows desktop, browse to the SMB file share for /mnt/media/downloads/complete/<tv show season> that I just downloaded, run filebot and it will fix the files inside just that 1 directory I just downloaded.
Just run filebot on the same machine that manages your torrents, in this case the Ubuntu VM, this further simplifies things.
Item 1: I want the input folder to be the folder that was just downloaded. I'm not interested in running filebot against an entire media archive on any kind of schedule. Thus, the "input" folder's name is dynamic and unknown until the torrent is actually completed. How do I account for this?
simple way is just use find/fd (i like fd) to give filebot the .mkv's that showed up in your destination directory very recently, doesn't matter if the name is dynamic, it will yoink them all.

Code: Select all

fd --changed-within=1d -S +400MB -e mkv /home/alzheimers/torrents/tv -X filebot {filebot arguments}
I don't want the "output" folder being different. I want the files renamed inside the same folder they already exist in. Replicating exactly how it works with the filebot gui. I don't want filebot or transmission moving files around.
This is a super bad idea.

How will transmission seed the files if filebot renames all of the originals?
How would you ever cross-seed, reseed or even know which release you have?
What about the first few times when you or filebot make a mistake because you don't filter correctly, and then filebot automatically renames all of your originals to the wrong names?

Ideally,

You would have your destination directories for transmission that are a bit of a mess:

Code: Select all

/home/alzheimers/torrents/movies
/home/alzheimers/torrents/tv
And then mirror directories of symlinks or hardlinks to the originals, created by filebot, nicely sorted:

Code: Select all

/home/alzheimers/Movies
/home/alzheimers/TV\\ Shows
And you, as a user, just look at the latter directories when you want to browse or watch, all nicely named and sorted.

If you're using Kodi or Plex, you point those at the latter directories and everything just works.
Step 4: I then manually move the folder and organize it in my plex media directory.
Don't need this step.

A lot of the point of filebot is to name & sort for you so that plex/kodi matches correctly automatically.

You do you, but there's a lot of redunancy in your workflow.
User avatar
rednoah
The Source
Posts: 23216
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: completely new, want to start simple

Post by rednoah »

I will just give a short answer myself as well.


Item 1

Automated Media Center › [Transmission] Setup for Transmission on Linux or macOS covers everything.

:idea: Transmission will pass along the file path to the newly completed file / folder via environment variables.


Item 2

The target file path is entirely up to your custom format. If your format happens to generate file paths to the same folder where files are currently located already, then so bit it:

Format: Select all

{folder}/{ny.removeAll(/[!?.:#]+$/)} - {s00e00} - {t.removeAll(/[!?.:#]+$/).replaceAll(/[`´‘’ʻ!?:;#]/, "")}.{vf.lower()}.{vc.lower()}
:!: That said, you will definitely want to hardlink files into a new {plex.id} format structure (i.e. default behaviour) as suggested in the post above, so that you can keep both the original files at the original paths for seeding, and an extra hardlink (i.e. another original for all accounts and purposes) at a Plex-friendly file path:

Format: Select all

{ drive }/Media/{ plex.id % { '.' + vf.lower() } % { '.' + vc.lower() } }

Item 3

@file syntax is great for passing in arguments verbatim. But in this particular case we want to do so for some arguments but not others:

Shell: Select all

#!/bin/sh -xu

# Input Parameters
ARG_PATH="$TR_TORRENT_DIR/$TR_TORRENT_NAME"
ARG_NAME="$TR_TORRENT_NAME"
ARG_LABEL="$TR_TORRENT_LABELS"

/usr/local/bin/filebot @/path/to/args.txt --def ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL"
:idea: Please read the FAQ and How to Request Help.
cyr0nk0r
Posts: 14
Joined: 15 Nov 2020, 20:23

Re: completely new, want to start simplehe following filebot pr

Post by cyr0nk0r »

alzheimerspenguin wrote: 09 Jun 2024, 13:23 Transmsission (while in some way is the best torrent client) frustratingly lacks the ability to have more than one default download directory.
If you don't want everything dumped in one directory, you have to set the destination per torrent, every time you add one.
I do want everything dumped into one directory. Like I said, I want to start simple and automate just one part of my process. Not completely change it at the get go.
alzheimerspenguin wrote: 09 Jun 2024, 13:23Just run filebot on the same machine that manages your torrents, in this case the Ubuntu VM, this further simplifies things.
yes, that is the plan.
alzheimerspenguin wrote: 09 Jun 2024, 13:23
I don't want the "output" folder being different. I want the files renamed inside the same folder they already exist in. Replicating exactly how it works with the filebot gui. I don't want filebot or transmission moving files around.
This is a super bad idea.

How will transmission seed the files if filebot renames all of the originals?
How would you ever cross-seed, reseed or even know which release you have?
The first part is what I was hoping filebot would help automate. If filebot automatically changes/updates the filenames, I'd also like transmission to be aware of those changes somehow. Not sure if that is possible, but that is certainly something I'm after. When filebot changes "file-abc.mkv" to "Show (year) - S01E05 - abc.1080p.mkv" I would like it to say "hey transmission, I just changed this file name, update yourself to be aware of this."

alzheimerspenguin wrote: 09 Jun 2024, 13:23
Step 4: I then manually move the folder and organize it in my plex media directory.
Don't need this step.
Probably not, but it's my process and it's worked for me for years. I don't want to completely change everything that I'm doing at the very beginning.
alzheimerspenguin
Posts: 2
Joined: 09 Jun 2024, 12:45

Re: completely new, want to start simple

Post by alzheimerspenguin »

Not possible, torrents don't work that way.
Changing the filenames is changing the data, breaking your torrent.
You're making your copies different to those that are in the swarm.

Symlinks or hardlinks solve this problem.
cyr0nk0r
Posts: 14
Joined: 15 Nov 2020, 20:23

Re: completely new, want to start simple

Post by cyr0nk0r »

alzheimerspenguin wrote: 10 Jun 2024, 07:24 Not possible, torrents don't work that way.
Changing the filenames is changing the data, breaking your torrent.
You're making your copies different to those that are in the swarm.

Symlinks or hardlinks solve this problem.
sigh, that's just not true at all.
I solved my issue. I just switched to deluge with the filebot plugin and it accomplishes everything I set out to do.
Post Reply