Custom --action /bin/mv in combination with --output not working since update to 5.1.1

All your suggestions, requests and ideas for future development
Post Reply
LightningRider
Posts: 10
Joined: 08 Aug 2019, 09:40

Custom --action /bin/mv in combination with --output not working since update to 5.1.1

Post by LightningRider »

Problem as per title: had an AMC script which used to work now fails with every file, either says "Skipped ... because ... already exists" or "Failed due to I/O error".
My issue isn't with the skipped files (that is as expected) I only include them to show that the output path is set as intended.
N.B. I have removed the actual device name, IP addresses, and storage space in the below snippets.

cmd:

Code: Select all

filebot -script fn:amc --output "/volume2/TV Shows" --log-file amc.log --action /bin/mv -non-strict "/volume2/downloads/" --def seriesFormat="/volume2/TV Shows/{n}/{'Season '+s}/{s00e00} - {t}" seriesDB="TheTVDB" kodi="X.X.X.X:X"
output (extracted from log):

Code: Select all

[SKIP] Skipped [/volume2/downloads/the.blacklist.s10e16.proper.multi.1080p.web.x264-higgsboson[eztv.re].mkv] because [/volume2/TV Shows/The Blacklist/Season 10/S10E16 - Blair Foster.mkv] already exists
[/bin/mv] from [/volume2/downloads/The.Wheel.of.Time.S02E04.Daughter.of.the.Night.1080p.AMZN.WEB-DL.DDP5.1.Atmos.H.264-FLUX[eztv.re].mkv] to [/volume2/TV Shows/The Wheel of Time/Season 2/S02E04 - Daughter of the Night.mkv]
[/bin/mv] from [/volume2/downloads/The.Wheel.of.Time.S02E04.Daughter.of.the.Night.1080p.AMZN.WEB-DL.DDP5.1.Atmos.H.264-FLUX[eztv.re].mkv] to [/volume2/TV Shows/The Wheel of Time/Season 2/S02E04 - Daughter of the Night.mkv] failed due to I/O error [[/bin/mv, /volume2/downloads/The.Wheel.of.Time.S02E04.Daughter.of.the.Night.1080p.AMZN.WEB-DL.DDP5.1.Atmos.H.264-FLUX[eztv.re].mkv, The Wheel of Time/Season 2/S02E04 - Daughter of the Night.mkv] failed (1)]
sysinfo output

Code: Select all

FileBot 5.1.1 (r9982)
JNA Native: 6.1.4
MediaInfo: 19.04
Tools: 7z/16.02 unrar/5.70
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2023-09-05 (r935)
Groovy: 4.0.14
JRE: OpenJDK Runtime Environment 17.0.8
JVM: OpenJDK 64-Bit Server VM
CPU/MEM: 8 Core / 3.1 GB Max Memory / 85 MB Used Memory
OS: Linux (amd64)
HW: Linux SYNO-NAS 4.4.302+ #64570 SMP Thu Jul 20 00:06:39 CST 2023 x86_64 GNU/Linux synology_v1000_1821+
CPU/MEM: : AMD Ryzen Embedded V1500B / MemTotal: 12 GB / MemFree: 6 GB / MemAvailable: 10 GB / SwapCached: 46 MB / SwapTotal: 9 GB / SwapFree: 9 GB
STORAGE: ext4 [/] @ XX MB | btrfs [/volume1] @ XX TB | btrfs [/volume2] @ XX TB
UID/GID: uid=1026(user) gid=100(users) groups=100(users)
DATA: /var/packages/filebot/var/data/1026
Package: SPK
License: FileBot License PX8909397 (Valid-Until: 2069-08-08)
The following cmd succeeds:

Code: Select all

mv /volume2/downloads/The.Wheel.of.Time.S02E04.Daughter.of.the.Night.1080p.AMZN.WEB-DL.DDP5.1.Atmos.H.264-FLUX\[eztv.re\].mkv /volume2/TV\ Shows/The\ Wheel\ of\ Time/Season\ 2/S02E04\ -\ Daughter\ of\ the\ Night.mkv
So I'm at a loss as to what's actually happening...
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC not working since update to 5.1.1

Post by rednoah »

:?: What does the console output say?


:idea: Note that using /bin/mv will print standard output and error output directly to the console output of the filebot process, and notably bypasses the filebot log file. You'll want to use > "/path/to/log.txt" 2>&1 to collect console output. See Shell Script Debugging for Beginners for details.

Shell: Select all

command > "/path/to/log.txt" 2>&1

:idea: The console output of /bin/mv will likely tell you why /bin/mv is failing. /bin/mv could be failing for all kinds of reasons, but --action /bin/mv is certainly not a replacement for the built-in --action move, because mv does not implicitly call mkdir, so you choose to use a Custom Rename Action then you need to take care of things yourself:

Shell: Select all

#!/bin/sh -xu
(
	mkdir -p "$(dirname "$1")"
	mv -v "$1" "$2"
) | tee -a "/path/to/mv.log"



EDIT:

Looks like recent changes may indeed have changed behaviour, since FileBot accidently no longer sets the $PWD of --action commands to --output. You can work around the issue by doing cd "<output folder>" before running filebot.


EDIT 2:

FileBot r10020 restores the previous behaviour of setting $PWD to --output instead of inheriting $PWD from the filebot process.
:idea: Please read the FAQ and How to Request Help.
LightningRider
Posts: 10
Joined: 08 Aug 2019, 09:40

Re: Custom --action /bin/mv in combination with --output not working since update to 5.1.1

Post by LightningRider »

Thanks for the prompt response.

I'm using /bin/mv as the filebot --action move didn't play nice with BTRFS subvolumes way back in 2019 viewtopic.php?t=9630. TLDR; it was doing copy + delete.

If there's a better option for me now that we are in 2023 I'm all for it :).

When will r10020 be available via Synology package center?
- Do I need to download a binary and replace the filebot binary manually?
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Custom --action /bin/mv in combination with --output not working since update to 5.1.1

Post by rednoah »

The current revisions are highly experimental. Coincidentally I am working built-in APFS / BTRFS support for --action copy instead of relying on cp commands. I will make sure to look into --action move and BTRFS subvolumes later this week as well.


:idea: There won't be any major release anytime soon but you can manually upgrade or downgrade (DSM ➔ Packages ➔ Manual Install ➔ Select *.spk package) so you can just do that and see what works best for your use case:
https://get.filebot.net/filebot/


:?: Out of curiosity: How can --action /bin/mv work in the first place? I would expect it to fail if the target folder does not already exist. Do you manually create Series / Season folders? Does Synology /bin/mv - unlike normal Linux mv - automatically create parent folders if necessary?
:idea: Please read the FAQ and How to Request Help.
LightningRider
Posts: 10
Joined: 08 Aug 2019, 09:40

Re: Custom --action /bin/mv in combination with --output not working since update to 5.1.1

Post by LightningRider »

rednoah wrote: 09 Sep 2023, 07:00 Coincidentally I am working built-in APFS / BTRFS support for --action copy instead of relying on cp commands. I will make sure to look into --action move and BTRFS subvolumes later this week as well.
That's great news
rednoah wrote: 09 Sep 2023, 07:00 :idea: There won't be any major release anytime soon but you can manually upgrade or downgrade (DSM ➔ Packages ➔ Manual Install ➔ Select *.spk package) so you can just do that and see what works best for your use case:
https://get.filebot.net/filebot/
I'll just downgrade until next major release.
rednoah wrote: 09 Sep 2023, 07:00 :?: Out of curiosity: How can --action /bin/mv work in the first place? I would expect it to fail if the target folder does not already exist. Do you manually create Series / Season folders? Does Synology /bin/mv - unlike normal Linux mv - automatically create parent folders if necessary?
Exactly right, I manually add a folder when new season airs (or I add a new series); I also get a telegram notification if the automated script fails.
Then there's only 2 possibilities: a new season has aired or a show was miss-classified. Actually works pretty well as a safeguard against the latter.
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Custom --action /bin/mv in combination with --output not working since update to 5.1.1

Post by rednoah »

FileBot r10027 now adds support for BTRFS reflink+delete MOVE operations:
viewtopic.php?t=1609
:idea: Please read the FAQ and How to Request Help.
Post Reply