[macOS] AMC to sort different type of files to different hard drives

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
WilDieteren
Posts: 30
Joined: 24 Nov 2015, 11:29

[macOS] AMC to sort different type of files to different hard drives

Post by WilDieteren »

All,

I was wondering if it is possible to construct an AMC that sorts different type of files to different hard drives. I have recently separated TV show files from movie files as there was not enough space on the hard drive they were on. So now the TV show files are on a different hard drive than the movie files and the AMC I was using until now does not work any more. Any suggestions?

Wil Dieteren
WilDieteren
Posts: 30
Joined: 24 Nov 2015, 11:29

Re: AMC to sort different type of files to different hard drives

Post by WilDieteren »

@rednaoh,

Thanks for the links, however I am unable to figure out how to change my script. I think I already set different drives for the different types of files, this worked for sorting in different folders on the same drive. Below my script:

Shell: Select all

#!/bin/bash

# Input Parameters
ARG_PATH="$1"
ARG_NAME="$2"
ARG_LABEL="$3"

/usr/local/bin/filebot -script fn:amc --output "/Volumes/Movies” --log-file "/Volumes/Movies/amc.log" --action duplicate --conflict auto -non-strict --def seriesDB="TheMovieDB::TV" --def subtitles=nl,en storeReport=y unsorted=y excludeList="/Volumes/Movies/amc.txt" "seriesFormat=/Volumes/TV Shows/TV Shows/{n}/{n} - {sxe} - {t}" "movieFormat=/Volumes/Movies/Movies/{n} {y}" "ut_dir=$ARG_PATH" "ut_kind=multi" "ut_title=$ARG_NAME"
Not sure why it does not work, any glaroing errors?
User avatar
rednoah
The Source
Posts: 23731
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC to sort different type of files to different hard drives

Post by rednoah »

:idea: Your Movie files will be organised as defined by your movieFormat parameter:

Shell: Select all

--def "movieFormat=/Volumes/Movies/Movies/{n} {y}"
:idea: Your Episode files will be organised as defined by your seriesFormat parameter:

Shell: Select all

--def "seriesFormat=/Volumes/TV Shows/TV Shows/{n}/{n} - {sxe} - {t}"

:idea: Movies are sorted into /Volumes/Movies and Episodes are sorted into /Volumes/TV Shows. Each folder in /Volumes is mapped to a shared network folder. If you map different map different servers / network drives as /Volumes/Movies or /Volumes/TV Shows. macOS will map the share into /Volumes (using some unique name) whenever you click Connect to Server... in Finder.


:?: You are evidently organising your movie / episode files into different shared network drives already. No? What do you see? What is not working as expected? What is happening instead? Did you read the --log-file "/Volumes/Movies/amc.log" log file already to check what exactly the amc script is doing?
:idea: Please read the FAQ and How to Request Help.
WilDieteren
Posts: 30
Joined: 24 Nov 2015, 11:29

Re: [macOS] AMC to sort different type of files to different hard drives

Post by WilDieteren »

I have tried some changes but I am unable to get the script to work. Because of the changes, I think, I do no longer get an amc.log file, so I am unable to see what is going wrong. For now I think I will change the script to just check for TV Shows.

I did not understand your third set of remarks, the Volumes... remarks.
User avatar
rednoah
The Source
Posts: 23731
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [macOS] AMC to sort different type of files to different hard drives

Post by rednoah »

WilDieteren wrote: 24 Jan 2025, 12:10 I have tried some changes but I am unable to get the script to work.
:?: What does the console output say when it does not work? (NOTE: your bash script above suggest that you're using something like JDownloader or Deluge but you for testing you'll want to call the script yourself from Terminal for rapid fire testing and being able to see the console output)


WilDieteren wrote: 24 Jan 2025, 12:10 I did not understand your third set of remarks, the Volumes... remarks.
:?: Where do you want your Movies to go? (think file paths)

:?: Where do you want your TV Shows to go? (think file paths)
:idea: Please read the FAQ and How to Request Help.
WilDieteren
Posts: 30
Joined: 24 Nov 2015, 11:29

Re: [macOS] AMC to sort different type of files to different hard drives

Post by WilDieteren »

I am using qBittorent, want the Movies to go to /Volumes/Movies and the TV Shows to go to /Volumes/TV Shows. I am on an iMac, but you already new that right.

The script worked fine when the seriesFormat path and the movieFormat paths were on the same disk as the—output path.
User avatar
rednoah
The Source
Posts: 23731
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [macOS] AMC to sort different type of files to different hard drives

Post by rednoah »

:?: What does the console output say when it does not work? (NOTE: If you do not know what console output is, please say so instead of ignoring the question, otherwise we will keep talking past each other.)



EDIT:

I notice that you have accidentally typed a character and not a " character, so the command-line argument sequence is going to be completely broken starting from there:

Shell: Select all

--output "/Volumes/Movies”

:!: My shell immediately flags the invalid argument sequence and prints the following error message to console output when I try to execute that command-line. filebot is not called at all as a result:

Code: Select all

bash: unexpected EOF while looking for matching `"'

:!: Avoid non-ASCII characters. You'll want to use a code editor with syntax highlighting. The code editor will not auto-complete " to “” when type and syntax highlighting will allow you spot these kinds of mistakes easily when argument values are not highlighted as expected.


e.g. GOOD

Shell: Select all

/usr/local/bin/filebot -script fn:amc --output "/Volumes/Movies" --log-file "/Volumes/Movies/amc.log" --action duplicate --conflict auto -non-strict --def seriesDB="TheMovieDB::TV" --def subtitles=nl,en storeReport=y unsorted=y excludeList="/Volumes/Movies/amc.txt" "seriesFormat=/Volumes/TV Shows/TV Shows/{n}/{n} - {sxe} - {t}" "movieFormat=/Volumes/Movies/Movies/{n} {y}" "ut_dir=$ARG_PATH" "ut_kind=multi" "ut_title=$ARG_NAME"
e.g. BAD

Shell: Select all

/usr/local/bin/filebot -script fn:amc --output "/Volumes/Movies” --log-file "/Volumes/Movies/amc.log" --action duplicate --conflict auto -non-strict --def seriesDB="TheMovieDB::TV" --def subtitles=nl,en storeReport=y unsorted=y excludeList="/Volumes/Movies/amc.txt" "seriesFormat=/Volumes/TV Shows/TV Shows/{n}/{n} - {sxe} - {t}" "movieFormat=/Volumes/Movies/Movies/{n} {y}" "ut_dir=$ARG_PATH" "ut_kind=multi" "ut_title=$ARG_NAME"
:idea: Please read the FAQ and How to Request Help.
WilDieteren
Posts: 30
Joined: 24 Nov 2015, 11:29

Re: [macOS] AMC to sort different type of files to different hard drives

Post by WilDieteren »

Changed the script to your corrected version and the script runs now. However I get a number of error messages:

Console Output: Select all

Run script [fn:amc] at [Sat Jan 25 09:02:23 CET 2025]
Parameter: seriesDB = "TheMovieDB::TV"
Bad seriesDB value: "TheMovieDB::TV"
Parameter: subtitles = nl,en
Parameter: storeReport = y
Parameter: unsorted = y
Parameter: excludeList = /Volumes/Movies/amc.txt
Parameter: seriesFormat = /Volumes/TV Shows/TV Shows/{n}/{n} - {sxe} - {t}
Parameter: movieFormat = /Volumes/Movies/Movies/{n} {y}
Parameter: ut_label = 
Parameter: ut_title = Elsbeth.S01E01.2160p.WEB.H265-SuccessfulCrab[TGx]
Parameter: ut_kind = multi
Parameter: ut_dir = /Volumes/Movies/Torrents/Elsbeth.S01E01.2160p.WEB.H265-SuccessfulCrab[TGx]
Invalid usage: input folder [/Volumes/Movies/Torrents/Elsbeth.S01E01.2160p.WEB.H265-SuccessfulCrab[TGx]] must not start with output folder [/Volumes/Movies]
Use excludes: /Volumes/Movies/amc.txt (0)
Ignore extra: /Volumes/Movies/Torrents/Elsbeth.S01E01.2160p.WEB.H265-SuccessfulCrab[TGx]/Sample
Input: /Volumes/Movies/Torrents/Elsbeth.S01E01.2160p.WEB.H265-SuccessfulCrab[TGx]/elsbeth.s01e01.2160p.web.h265-successfulcrab.mkv
Group files by movie or series
Group: {Series=Elsbeth (2024)} => [elsbeth.s01e01.2160p.web.h265-successfulcrab.mkv]
Get [Dutch] subtitles for 1 file
OpenSubtitles does not support anonymous login
Get [English] subtitles for 1 file
OpenSubtitles does not support anonymous login
Invalid --db value: '"TheMovieDB::TV"': "TheMovieDB::TV" not in [TheMovieDB, OMDb, TheTVDB, AniDB, TheMovieDB::TV, TVmaze, AcoustID, ID3, exif, xattr, file, OpenSubtitles, Shooter, AnimeLists, FanartTV]
Processing 1 unsorted files
[DUPLICATE] from [/Volumes/Movies/Torrents/Elsbeth.S01E01.2160p.WEB.H265-SuccessfulCrab[TGx]/elsbeth.s01e01.2160p.web.h265-successfulcrab.mkv] to [/Volumes/Movies/Unsorted/Elsbeth.S01E01.2160p.WEB.H265-SuccessfulCrab[TGx]/elsbeth.s01e01.2160p.web.h265-successfulcrab.mkv]
Processed 1 file
Saving HTML report to [/Volumes/Movies/y/[2025-01-25_09_02]_Elsbeth_S01E01_2160p_WEB_H265-SuccessfulCrab[TGx].html]
Done ヾ(@⌒ー⌒@)ノ
Run script [fn:amc] at [Sat Jan 25 09:12:30 CET 2025]
Parameter: seriesDB = "TheMovieDB::TV"
Bad seriesDB value: "TheMovieDB::TV"
Parameter: subtitles = nl,en
Parameter: storeReport = y
Parameter: unsorted = y
Parameter: excludeList = /Volumes/Movies/amc.txt
Parameter: seriesFormat = /Volumes/TV Shows/TV Shows/{n}/{n} - {sxe} - {t}
Parameter: movieFormat = /Volumes/Movies/Movies/{n} {y}
Parameter: ut_label = 
Parameter: ut_title = Deadpool and Wolverine 2024 2160p WEB-DL DDP5 1 Atmos DV HDR H 265-FLUX
Parameter: ut_kind = multi
Parameter: ut_dir = /Volumes/Movies/Torrents/Deadpool and Wolverine 2024 2160p WEB-DL DDP5 1 Atmos DV HDR H 265-FLUX
Invalid usage: input folder [/Volumes/Movies/Torrents/Deadpool and Wolverine 2024 2160p WEB-DL DDP5 1 Atmos DV HDR H 265-FLUX] must not start with output folder [/Volumes/Movies]
Use excludes: /Volumes/Movies/amc.txt (2)
No files selected for processing
Done ¯\_(ツ)_/¯
User avatar
rednoah
The Source
Posts: 23731
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [macOS] AMC to sort different type of files to different hard drives

Post by rednoah »

:?: Why are "..." part of the literal value that is passed along? What exactly is the command-line you're using here? (NOTE: it's not what you posted above)

Console Output: Select all

Parameter: seriesDB = "TheMovieDB::TV"
Bad seriesDB value: "TheMovieDB::TV"
...
Invalid --db value: '"TheMovieDB::TV"': "TheMovieDB::TV" not in [TheMovieDB, OMDb, TheTVDB, AniDB, TheMovieDB::TV, TVmaze, AcoustID, ID3, exif, xattr, file, OpenSubtitles, Shooter, AnimeLists, FanartTV]
...

:idea: You are somehow escaping the "..." which is most unusual to do by accident. You are effectively doing something like this:

Shell: Select all

--def seriesDB='"TheMovieDB::TV"'

Shell: Select all

--def seriesDB="\"TheMovieDB::TV\""

:idea: The correct usage looks like this:

Shell: Select all

--def seriesDB="TheMovieDB::TV"

:idea: Note the value in quotes being passed along without the quotes:

Console Output: Select all

$ filebot -script fn:amc --def seriesDB="TheMovieDB::TV"
Run script [fn:amc] at [Sat Jan 25 09:27:56 UTC 2025]
Parameter: seriesDB = TheMovieDB::TV
...
Cmdline and Argument Passing


:idea: Note that TheMovieDB::TV is used by default, so specifying --def seriesDB="TheMovieDB::TV" does nothing at best, and breaks things if you do it wrong, so I would recommend not specifying unnecessary options that don't do anything in the first place.
:idea: Please read the FAQ and How to Request Help.
WilDieteren
Posts: 30
Joined: 24 Nov 2015, 11:29

Re: [macOS] AMC to sort different type of files to different hard drives

Post by WilDieteren »

Let me start with thanking you for all your help, I have gotten, I think, to where I want to be. I have combined the default qBittorent script:

Shell: Select all

filebot -script fn:amc --output "X:/Media" --action duplicate --conflict skip -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y music=y artwork=y "ut_label=%L" "ut_title=%N" "ut_kind=multi" "ut_dir=%F"
with parts of my original script to get to:

Shell: Select all

filebot -script fn:amc --output "/Volumes/Movies" --log-file "/Volumes/Movies/amc.log" --action duplicate --conflict auto -non-strict --def subtitles=nl,en unsorted=y "excludeList=/Volumes/Movies/amc.txt" "seriesFormat=/Volumes/TV Shows/TV Shows/{n}/{n} - {sxe} - {t}" "movieFormat=/Volumes/Movies/Movies/{n} {y}" "ut_label=%L" "ut_title=%N" "ut_kind=multi" "ut_dir=%F"
which does what I want it to do, put Movies in /Volumes/Movies/Movies and TV Shows in /Volumes/TV Shows/TV Shows. However, there is something in the amc.log that looks like en error:

Console Output: Select all

Run script [fn:amc] at [Sat Jan 25 13:25:39 CET 2025]
Parameter: subtitles = nl,en
Parameter: unsorted = y
Parameter: excludeList = /Volumes/Movies/amc.txt
Parameter: seriesFormat = /Volumes/TV Shows/TV Shows/{n}/{n} - {sxe} - {t}
Parameter: movieFormat = /Volumes/Movies/Movies/{n} {y}
Parameter: ut_label = 
Parameter: ut_title = Deadpool and Wolverine 2024 2160p WEB-DL DDP5 1 Atmos DV HDR H 265-FLUX
Parameter: ut_kind = multi
Parameter: ut_dir = /Volumes/Movies/Torrents/Deadpool and Wolverine 2024 2160p WEB-DL DDP5 1 Atmos DV HDR H 265-FLUX
[b]Invalid usage: input folder [/Volumes/Movies/Torrents/Deadpool and Wolverine 2024 2160p WEB-DL DDP5 1 Atmos DV HDR H 265-FLUX] must not start with output folder [/Volumes/Movies]
[/b]Use excludes: /Volumes/Movies/amc.txt
Input: /Volumes/Movies/Torrents/Deadpool and Wolverine 2024 2160p WEB-DL DDP5 1 Atmos DV HDR H 265-FLUX/Deadpool and Wolverine 2024 2160p WEB-DL DDP5 1 Atmos DV HDR H 265-FLUX.mkv
Group files by movie or series
Group: {Movie=Deadpool & Wolverine (2024)} => [Deadpool and Wolverine 2024 2160p WEB-DL DDP5 1 Atmos DV HDR H 265-FLUX.mkv]
Get [Dutch] subtitles for 1 file
OpenSubtitles does not support anonymous login
Get [English] subtitles for 1 file
OpenSubtitles does not support anonymous login
Rename movies using [TheMovieDB]
Auto-detect movie from context [/Volumes/Movies/Torrents/Deadpool and Wolverine 2024 2160p WEB-DL DDP5 1 Atmos DV HDR H 265-FLUX/Deadpool and Wolverine 2024 2160p WEB-DL DDP5 1 Atmos DV HDR H 265-FLUX.mkv]
[DUPLICATE] from [/Volumes/Movies/Torrents/Deadpool and Wolverine 2024 2160p WEB-DL DDP5 1 Atmos DV HDR H 265-FLUX/Deadpool and Wolverine 2024 2160p WEB-DL DDP5 1 Atmos DV HDR H 265-FLUX.mkv] to [/Volumes/Movies/Movies/Deadpool & Wolverine 2024.mkv]
Processed 1 file
Done ヾ(@⌒ー⌒@)ノ
Run script [fn:amc] at [Sat Jan 25 17:32:18 CET 2025]
Parameter: subtitles = nl,en
Parameter: unsorted = y
Parameter: excludeList = /Volumes/Movies/amc.txt
Parameter: seriesFormat = /Volumes/TV Shows/TV Shows/{n}/{n} - {sxe} - {t}
Parameter: movieFormat = /Volumes/Movies/Movies/{n} {y}
Parameter: ut_label = 
Parameter: ut_title = Love and Death S01E01 The Huntress 1080p AMZN WEB-DL DDP5 1 H 264-NTb[TGx]
Parameter: ut_kind = multi
Parameter: ut_dir = /Volumes/Movies/Torrents/Love and Death S01E01 The Huntress 1080p AMZN WEB-DL DDP5 1 H 264-NTb[TGx]
[b]Invalid usage: input folder [/Volumes/Movies/Torrents/Love and Death S01E01 The Huntress 1080p AMZN WEB-DL DDP5 1 H 264-NTb[TGx]] must not start with output folder [/Volumes/Movies]
[/b]Use excludes: /Volumes/Movies/amc.txt (0)
Input: /Volumes/Movies/Torrents/Love and Death S01E01 The Huntress 1080p AMZN WEB-DL DDP5 1 H 264-NTb[TGx]/Love and Death S01E01 The Huntress 1080p AMZN WEB-DL DDP5 1 H 264-NTb.mkv
Group files by movie or series
Group: {Series=Love & Death (2023)} => [Love and Death S01E01 The Huntress 1080p AMZN WEB-DL DDP5 1 H 264-NTb.mkv]
Get [Dutch] subtitles for 1 file
OpenSubtitles does not support anonymous login
Get [English] subtitles for 1 file
OpenSubtitles does not support anonymous login
Rename episodes using [TheMovieDB] with [Airdate Order]
Lookup via [Love & Death, Loot] [Love and Death]
Fetching episode data for [Love & Death]
* Love & Death [124800] | 7 episodes | 1x01-07
Fetching episode data for [Loot]
* Love & Death [124800] | 7 episodes | 1x01-07
* Loot [197449] | 20 episodes | 1x01-10 .. 2x01-10
[DUPLICATE] from [/Volumes/Movies/Torrents/Love and Death S01E01 The Huntress 1080p AMZN WEB-DL DDP5 1 H 264-NTb[TGx]/Love and Death S01E01 The Huntress 1080p AMZN WEB-DL DDP5 1 H 264-NTb.mkv] to [/Volumes/TV Shows/TV Shows/Love & Death/Love & Death - 1x01 - The Huntress.mkv]
Processed 1 file
Done ヾ(@⌒ー⌒@)ノ
Should I worry that?
User avatar
rednoah
The Source
Posts: 23731
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [macOS] AMC to sort different type of files to different hard drives

Post by rednoah »

:idea: This message means that you're mixing input and output which can be a bad idea, thus a warning is printed to the console output:

Code: Select all

Invalid usage: input folder [/Volumes/Movies/Torrents/Love and Death S01E01 The Huntress 1080p AMZN WEB-DL DDP5 1 H 264-NTb[TGx]] must not start with output folder [/Volumes/Movies]

:arrow: The recommended usage would be cleanly separating input / output folders, i.e. the input folder should not be inside the output folder and the output folder should not be inside the input folder. That said, you can do what you want to do, as long as you know what you're doing. FileBot is printing a warning because some users have shot them themselves in the foot.

e.g.

Properties: Select all

INPUT = /Volumes/Movies/Completed Downloads
OUTPUT = /Volumes/Movies/Organised Movies
:idea: Please read the FAQ and How to Request Help.
WilDieteren
Posts: 30
Joined: 24 Nov 2015, 11:29

Re: [macOS] AMC to sort different type of files to different hard drives

Post by WilDieteren »

Thanks again, I was not aware that this could be an issue, but have fixed it. Everything works again because of all your help, greatly appreciated.
Post Reply