AMC Script - Clean=y not working (when using default script for qbittorent for unraid)

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
tronder
Posts: 13
Joined: 03 Jun 2024, 22:45

AMC Script - Clean=y not working (when using default script for qbittorent for unraid)

Post by tronder »

Hi All,

Trying to edit my script to make filebot delete and left over files and folders after the move is renamed and moved, however it doesn't seem to be doing so. Any Ideas?

Code: Select all

Parameter: excludeList = /data/filebot/amc-exlude-list.txt
Parameter: clean = y
Parameter: unsorted = y
Parameter: music = y
Parameter: musicFormat = /media/{plex}
Parameter: artwork = /media/y
Parameter: movieFormat = /media/{plex}
Parameter: seriesFormat = /media/{plex}
Parameter: animeFormat = /media/animes/{n}/{e.pad(3)} - {t}
Parameter: ut_dir = /downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]
Parameter: ut_title = House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY
Parameter: ut_label = 
Use excludes: /data/filebot/amc-exlude-list.txt (1)
Input: /downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY.mkv
Group files by movie or series
Group: {Series=House of the Dragon (2022)} => [House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY.mkv]
Rename episodes using [TheMovieDB] with [Airdate Order]
Lookup via [House of the Dragon, House] [House of the Dragon]
Fetching episode data for [House of the Dragon]
* House of the Dragon [94997] | 18 episodes | 1x01-10 .. 2x01-08
Fetching episode data for [House]
* House [1408] | 176 episodes | 1x01-22 .. 2x01-24 .. 3x01-24 .. 4x01-16 .. 5x01-24 .. 6x01-21 .. 7x01-23 .. 8x01-22
* House of the Dragon [94997] | 18 episodes | 1x01-10 .. 2x01-08
[MOVE] from [/downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY.mkv] to [/media/TV Shows/House of the Dragon/Season 02/House of the Dragon - S02E08 - The Queen Who Ever Was.mkv]
Processed 1 file
Done ヾ(@⌒ー⌒@)ノ
User avatar
rednoah
The Source
Posts: 23931
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Script - Clean=y not working

Post by rednoah »

:?: What does ls say?

Shell: Select all

ls -l "/downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]"
NOTE: --def clean=y will not delete folders / files where the folder seem to contain important files, e.g. large files, video files, files of unknown type, etc.




:?: What does /media/y do?

Code: Select all

Parameter: artwork = /media/y
YES: --def artwork=y
NO: --def artwork=/media/y




:!: If you're using a docker container, then you will want to read Notes on --action MOVE and --action HARDLINK because you seem to be using different mount points for input / output folders, so if those two mount points actually map to the same host file system, then you'll definitely want to rethink your docker bind mounts.
:idea: Please read the FAQ and How to Request Help.
tronder
Posts: 13
Joined: 03 Jun 2024, 22:45

Re: AMC Script - Clean=y not working

Post by tronder »

rednoah wrote: 15 Aug 2024, 03:34 :?: What does ls say?

Shell: Select all

ls -l "/downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]"
NOTE: --def clean=y will not delete folders / files where the folder seem to contain important files, e.g. large files, video files, files of unknown type, etc.
The Folder contains .txt files of 1KB hence not important etc


rednoah wrote: 15 Aug 2024, 03:34 :?: What does /media/y do?

Code: Select all

Parameter: artwork = /media/y
YES: --def artwork=y
NO: --def artwork=/media/y
I dunno, it was in the default script for qbittorent for unraid


rednoah wrote: 15 Aug 2024, 03:34 :!: If you're using a docker container, then you will want to read Notes on --action MOVE and --action HARDLINK because you seem to be using different mount points for input / output folders, so if those two mount points actually map to the same host file system, then you'll definitely want to rethink your docker bind mounts.
I have no issues with moving files, just the deleting section
User avatar
rednoah
The Source
Posts: 23931
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Script - Clean=y not working

Post by rednoah »

tronder wrote: 15 Aug 2024, 03:45 The Folder contains .txt files of 1KB hence not important etc
Please run ls -l in the console and copy & paste the output so that we can check and verify:

Shell: Select all

ls -l "/downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]"
:idea: Please read the FAQ and How to Request Help.
tronder
Posts: 13
Joined: 03 Jun 2024, 22:45

Re: AMC Script - Clean=y not working

Post by tronder »

rednoah wrote: 15 Aug 2024, 03:48
tronder wrote: 15 Aug 2024, 03:45 The Folder contains .txt files of 1KB hence not important etc
Please run ls -l in the console and copy & paste the output so that we can check and verify:

Shell: Select all

ls -l "/downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]"

Console Output: Select all

root@f33ece8124f:/# ls -l "/downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]"
total 15
-rw-r--r-- 1 abc abc  71 Aug 15 11:36 'NEW upcoming releases by Xclusive.txt'
-rw-r--r-- 1 abc abc 479 Aug 15 11:36 '[TGx]Downloaded from torrentgalaxy.to .txt'
-rw-r--r-- 1 abc abc  48 Aug 15 11:36  source.txt
root@f33ece8124f:/# ^C
User avatar
rednoah
The Source
Posts: 23931
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Script - Clean=y not working

Post by rednoah »

:!: I cannot reproduce the issue with the sample file paths given above. Looks good to me:

Console Output: Select all

$ filebot -script fn:amc downloads --output output -non-strict --def clean=y
...
Parameter: clean = y
...
Input: downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY.mkv
...
[MOVE] from [downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY.mkv] to [output/TV Shows/House of the Dragon {tmdb-94997}/Season 02/House of the Dragon - S02E08 - The Queen Who Ever Was.mkv]
Processed 1 file
Clean clutter files and empty folders
Delete downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/[TGx]Downloaded from torrentgalaxy.to .txt
Delete downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/NEW upcoming releases by Xclusive.txt
Delete downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/source.txt
Delete downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]
...

:?: Can you reliably reproduce the issue? Can you run test commands to see what works and what doesn't, to systematically narrow down why the command you're using doesn't work? You'll want to start with a test command like mine above to confirm that it fundamentally works, and then modify that command step by step to do what you're doing, and perhaps find out which specific step makes things not work. That would give us a clue.



tronder wrote: 15 Aug 2024, 03:45
rednoah wrote: 15 Aug 2024, 03:34 :?: What does /media/y do?

Code: Select all

Parameter: artwork = /media/y
YES: --def artwork=y
NO: --def artwork=/media/y
I dunno, it was in the default script for qbittorent for unraid
You'll want to report the issue to the developer / maintainer of the default script you are using. It is simply incorrect and does not do what one might think it does. It must be --def artwork=y or --def artwork=n to enable / disable the artwork option. --def artwork=/media/y is an illegal value and thus equivalent to not specifying --def artwork or specifying --def artwork=n, i.e. disabling the feature as opposed to enabling the feature.



tronder wrote: 15 Aug 2024, 03:45 I have no issues with moving files, just the deleting section
Can I confirm that you clicked (or not?) on the link and read the notes? Because Notes on --action MOVE and --action HARDLINK is trying to explain to you that although --action move may appear to work even if your bind mounts are conceptually wrong, it's doing so in a (likely unnecessary) extremely inefficient way, i.e. you're accidentally doing a physical copy + delete operation (where your disk will read 1GB and write 1GB when you move a 1 GB file) and not an atomic move operation (where your disk will do nothing except for a tiny little bit of file system bookkeeping).
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23931
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Script - Clean=y not working

Post by rednoah »

:!: I have reviewed the code and it seem that the author of the script you're using did not follow the Setup for qBittorrent on Windows, Linux and macOS guide. --def ut_kind=multi and --def ut_dir=%F must be specified in tandem. Your script specifies --def ut_dir but not --def ut_kind and thus inadvertently breaks things, notably the --def clean=y behaviour. You'll want to report this issue to the developer / maintainer of the container / script / etc that you are using.



:arrow: YES:

Console Output: Select all

$ filebot -script fn:amc --output output -non-strict --def clean=y --def ut_kind="multi" ut_dir="$PWD/downloads"
...
Parameter: clean = y
Parameter: ut_kind = multi
Parameter: ut_dir = downloads
...
[MOVE] from [downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY.mkv] to [output/TV Shows/House of the Dragon {tmdb-94997}/Season 02/House of the Dragon - S02E08 - The Queen Who Ever Was.mkv]
...
Clean clutter files and empty folders
Delete downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/[TGx]Downloaded from torrentgalaxy.to .txt
Delete downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/NEW upcoming releases by Xclusive.txt
Delete downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/source.txt
Delete downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]
Delete downloads
...


:arrow: NO:

Console Output: Select all

$ filebot -script fn:amc --output output -non-strict --def clean=y --def ut_dir="$PWD/downloads"
...
Parameter: clean = y
Parameter: ut_dir = downloads
...
[MOVE] from [downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY.mkv] to [output/TV Shows/House of the Dragon {tmdb-94997}/Season 02/House of the Dragon - S02E08 - The Queen Who Ever Was.mkv]
...
:idea: Please read the FAQ and How to Request Help.
tronder
Posts: 13
Joined: 03 Jun 2024, 22:45

Re: AMC Script - Clean=y not working

Post by tronder »

rednoah wrote: 15 Aug 2024, 04:21 :!: I cannot reproduce the issue with the sample file paths given above. Looks good to me:

Console Output: Select all

$ filebot -script fn:amc downloads --output output -non-strict --def clean=y
...
Parameter: clean = y
...
Input: downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY.mkv
...
[MOVE] from [downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY.mkv] to [output/TV Shows/House of the Dragon {tmdb-94997}/Season 02/House of the Dragon - S02E08 - The Queen Who Ever Was.mkv]
Processed 1 file
Clean clutter files and empty folders
Delete downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/[TGx]Downloaded from torrentgalaxy.to .txt
Delete downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/NEW upcoming releases by Xclusive.txt
Delete downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/source.txt
Delete downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]
...

:?: Can you reliably reproduce the issue? Can you run test commands to see what works and what doesn't, to systematically narrow down why the command you're using doesn't work? You'll want to start with a test command like mine above to confirm that it fundamentally works, and then modify that command step by step to do what you're doing, and perhaps find out which specific step makes things not work. That would give us a clue.
I can't seem to understand what I'm doing wrong here...

Console Output: Select all

root@f33ece81243f:/# /data/filebot/fb.sh -script fn:amc /downloads --output output -non-strict --def clean=y
Run script [fn:amc] at [Thu Aug 15 14:52:47 AEST 2024]

[PSA] Important Discussion of Changes effective as of 28 Apr 2023:
https://www.filebot.net/forums/viewtopic.php?t=13406

Parameter: excludeList = /data/filebot/amc-exlude-list.txt
Parameter: clean = y
Parameter: unsorted = y
Parameter: music = y
Parameter: musicFormat = /media/{plex}
Parameter: artwork = /media/y
Parameter: movieFormat = /media/{plex}
Parameter: seriesFormat = /media/{plex}
Parameter: animeFormat = /media/animes/{n}/{e.pad(3)} - {t}
Parameter: ut_dir = -script
Parameter: ut_title = fn:amc
Parameter: ut_label = /downloads
Use excludes: /data/filebot/amc-exlude-list.txt (1)
File does not exist: /-script
No files selected for processing
Done ¯\_(ツ)_/¯
User avatar
rednoah
The Source
Posts: 23931
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Script - Clean=y not working (when using default script for qbittorent for unraid)

Post by rednoah »

:idea: I have identified the issue in my previous reply. You'll need to fix your fb.sh script (notably not one of ours) by adding --def ut_kind=multi to the filebot command. See Setup for qBittorrent on Windows, Linux and macOS for filebot / amc script usage examples.



:arrow: If your script is not written by you and you thus cannot understand / modify your fb.sh script, then you'll need to talk to the developer / maintainer of that script. It's not one of ours. I don't know where you got it from. I don't know what your script is, does, is supposed to do, etc, so you really need to talk to whoever wrote your script to fix your script.


:arrow: If you could link where you got your script from here, that would be appreciated. We might be able to warn the next guy about known issues and limitations of this particular 3rd party solution.
:idea: Please read the FAQ and How to Request Help.
tronder
Posts: 13
Joined: 03 Jun 2024, 22:45

Re: AMC Script - Clean=y not working (when using default script for qbittorent for unraid)

Post by tronder »

rednoah wrote: 15 Aug 2024, 05:16 :idea: I have identified the issue in my previous reply. You'll need to fix your fb.sh script (notably not one of ours) by adding --def ut_kind=multi to the filebot command. See Setup for qBittorrent on Windows, Linux and macOS for filebot / amc script usage examples.

Do I add this in the Qbittorent section where it says run external program?


:arrow: If your script is not written by you and you thus cannot understand / modify your fb.sh script, then you'll need to talk to the developer / maintainer of that script. It's not one of ours. I don't know where you got it from. I don't know what your script is, does, is supposed to do, etc, so you really need to talk to whoever wrote your script to fix your script.


:arrow: If you could link where you got your script from here, that would be appreciated. We might be able to warn the next guy about known issues and limitations of this particular 3rd party solution.
https://github.com/imTHAI/docker-qbittorrent-filebot


So I reworked it, now it runs .... but still doesn't clean up the files?

Console Output: Select all

root@f33ece81243f:/# /data/filebot/fb.sh /downloads --output output -non-strict --def clean=y
Run script [fn:amc] at [Thu Aug 15 15:26:26 AEST 2024]

[PSA] Important Discussion of Changes effective as of 28 Apr 2023:
https://www.filebot.net/forums/viewtopic.php?t=13406

Parameter: excludeList = /data/filebot/amc-exlude-list.txt
Parameter: clean = y
Parameter: unsorted = y
Parameter: music = y
Parameter: musicFormat = /media/{plex}
Parameter: artwork = /media/y
Parameter: movieFormat = /media/{plex}
Parameter: seriesFormat = /media/{plex}
Parameter: animeFormat = /media/animes/{n}/{e.pad(3)} - {t}
Parameter: ut_dir = /downloads
Parameter: ut_title = --output
Parameter: ut_label = output
Use excludes: /data/filebot/amc-exlude-list.txt (0)
Input: /downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/House of the Dragon - S02E08 - The Queen Who Ever Was.mkv
       └─ Metadata: House of the Dragon - 2x08 - The Queen Who Ever Was
Group files by movie or series
Group: {Series=House of the Dragon} => [House of the Dragon - S02E08 - The Queen Who Ever Was.mkv]
Rename episodes using [TheMovieDB] with [Airdate Order]
[XATTR] House of the Dragon - 2x08 - The Queen Who Ever Was (/downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/House of the Dragon - S02E08 - The Queen Who Ever Was.mkv)
Lookup via [House of the Dragon] []
Fetching episode data for [House of the Dragon]
* House of the Dragon [94997] | 18 episodes | 1x01-10 .. 2x01-08
[MOVE] from [/downloads/House.of.the.Dragon.S02E08.WEB.x264-TORRENTGALAXY[TGx]/House of the Dragon - S02E08 - The Queen Who Ever Was.mkv] to [/media/TV Shows/House of the Dragon/Season 02/House of the Dragon - S02E08 - The Queen Who Ever Was.mkv]
Processed 1 file
Done ヾ(@⌒ー⌒@)ノ
User avatar
rednoah
The Source
Posts: 23931
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Script - Clean=y not working (when using default script for qbittorent for unraid)

Post by rednoah »

:?: What is this?

Code: Select all

Parameter: ut_title = --output

:idea: The log tells us that you're not specifying --def ut_kind=multi which is the root cause of the problem at hand as explained above.



EDIT:

You seem to not understand that the filebot command-line tool and your fb.sh script are not the same. Your fb.sh script presumably calls filebot at somehow at some point, but that doesn't mean that you can just pass filebot command-line options into your fb.sh script and expect that to work.
:idea: Please read the FAQ and How to Request Help.
tronder
Posts: 13
Joined: 03 Jun 2024, 22:45

Re: AMC Script - Clean=y not working (when using default script for qbittorent for unraid)

Post by tronder »

rednoah wrote: 15 Aug 2024, 05:35 :?: What is this?

Code: Select all

Parameter: ut_title = --output
dunno


So like this?

Shell: Select all

# Set this to 1 if you want to customize the fb.sh script. So it won't be reset at restart.
custom=1

/filebot/filebot.sh \
--def ut_kind=multi \
-script fn:amc \
--output /media \
--lang "$FILEBOT_LANG" \
--action "$FILEBOT_ACTION" \
--conflict "$FILEBOT_CONFLICT" \
--log-file /data/filebot/filebot.log \
--def excludeList=/data/filebot/amc-exlude-list.txt \
--def clean=y \
-non-strict \
--def \
unsorted=y \
music="$FILEBOT_PROCESS_MUSIC" \
musicFormat=/media/"$MUSIC_FORMAT" \
artwork=/media/"$FILEBOT_ARTWORK" \
movieFormat=/media/"$MOVIE_FORMAT" \
seriesFormat=/media/"$SERIE_FORMAT" \
animeFormat=/media/"$ANIME_FORMAT" \
ut_dir="$1" \
ut_title="$2" \
ut_label="$3"
User avatar
rednoah
The Source
Posts: 23931
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Script - Clean=y not working (when using default script for qbittorent for unraid)

Post by rednoah »

:?: What does the console output say when you do a test run?



:idea: Keep in mind that when you do a test run, then you must pass positional arguments $1, $2 and $3 along when you do the fb.sh call, because that's what your fb.sh expects you to do:

Code: Select all

ut_dir="$1" \
ut_title="$2" \
ut_label="$3"
:idea: Please read the FAQ and How to Request Help.
tronder
Posts: 13
Joined: 03 Jun 2024, 22:45

Re: AMC Script - Clean=y not working (when using default script for qbittorent for unraid)

Post by tronder »

rednoah wrote: 15 Aug 2024, 05:41 :?: What does the console output say when you do a test run?
WORKS! FINALLY THANK YOU!!!!
Post Reply