Windows Command Line to create Linux LN Hardlink Command String

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
SoonerLater
Posts: 10
Joined: 27 Feb 2018, 22:43

Windows Command Line to create Linux LN Hardlink Command String

Post by SoonerLater »

Goal: a command line string that I can run at a Windows PC command line which will create the Linux LN command line string to create a desired hardlink.

Situation: I have a Google spreadsheet that takes four inputs:
(1) Source Path (example: "/media/sdu1/soonerlater/private/deluge/data/")
(2) Source Filename (example: "somestupidshow.S03E011080p.ATVP.WEB-DL.DDP5.1.H.264-NTb.mkv")
(3) Target Path: (example: "/media/sdu1/soonerlater/private/plexmedia/tv/")
(4) Target Filename: ("Some Stupid Show 3x01 - George Gets Even.mkv")

For step # 4, I use theTVDb or theMovieDb to create an appropriate filename.

The spreadsheet uses a formula to use the above four inputs to create this output:

"ln "/media/sdu1/soonerlater/private/deluge/data/somestupidshow.S03E011080p.ATVP.WEB-DL.DDP5.1.H.264-NTb.mkv" "/media/sdu1/soonerlater/private/plexmedia/tv/Some Stupid Show 3x01 - George Gets Even.mkv"

I then copy the output from the spreadsheet and paste it into SSH terminal window (e.g. Putty or Kitty) to run the LN command on my seedbox. When the command works correctly, it creates a hardlink that the Plex Server running on my seedbox can then use. This lets me keep files that I'm seeding in the folder shown in #1 above, but have a separate folder containing nothing but hardlinks with "cleaned up" names that Plex can use.

What I would like is a way to use FileBot at a Windows command line to create the "LN" command output that my current method creates. Is there a way to do that?

Clear as mud?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Windows Command Line to create Linux LN Hardlink Command String

Post by rednoah »

FileBot fundamentally cannot process non-existent file paths, and also cannot generate command-line scripts to be executed on other machines.


:arrow: You can however log into your Linux machine via SSH, then install filebot on your Linux machine, then run filebot on your Linux machine to move/rename files:
https://www.filebot.net/cli.html


:arrow: You can also mount the remote file system onto your local Windows machine, and then rename files with the FileBot Desktop application as if you were renaming local files on your local Windows computer. There are many tools (e.g.
Mountain Duck
)
that can make a remote Linux file systems available as a network drive on your Windows Desktop PC. Google is your friend here. Please report back if you take this path and what software ended up working for you.
:idea: Please read the FAQ and How to Request Help.
SoonerLater
Posts: 10
Joined: 27 Feb 2018, 22:43

Re: Windows Command Line to create Linux LN Hardlink Command String

Post by SoonerLater »

I am evaluating Mountain Duck and it looks awesome. With it I am able to mount my cloud storage as local storage on my Windows PC and use FileBot on it like the files were local. However, I have one question: how can I have Filebot create a hardlink *AND* place that hardlink in a location different from the source file? When I try to have FileBot create a hardlink, it seems to try to place the hardlink in the same folder as the source file.
SoonerLater
Posts: 10
Joined: 27 Feb 2018, 22:43

Re: Windows Command Line to create Linux LN Hardlink Command String

Post by SoonerLater »

What am I doing wrong?

Image
=================

Image
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Windows Command Line to create Linux LN Hardlink Command String

Post by rednoah »

SoonerLater wrote: 16 Mar 2023, 16:54 When I try to have FileBot create a hardlink, it seems to try to place the hardlink in the same folder as the source file.
:?: Are you sure? The screenshot above just shows that Windows refuses to perform the requested hardlink operation. Did you run a separate test with {folder}/{n} - {s00e00} - {t} as format where Windows indeed creates hardlinks on the remote Linux machine via the Mountain Duck virtual file system driver?



:!: Windows does support hardlink operations, but there is a good chance that hardlink operations are not implemented in the Mountain Duck virtual file system driver. You'd have to check with the Mountain Duck developer for details of the capabilities of their virtual file system implementation.


:arrow: I'd start by logging into the remote server just to confirm that it can actually work, i.e. make sure that source path and target path are indeed on the same device / file system. You can use the stat command for that.


:idea: If you indeed cannot create hardlinks from your Windows PC due to software limitations, then you may need to run filebot via SSH on the remote server directly.
:idea: Please read the FAQ and How to Request Help.
SoonerLater
Posts: 10
Joined: 27 Feb 2018, 22:43

Re: Windows Command Line to create Linux LN Hardlink Command String

Post by SoonerLater »

I tried this at the Windows command line:

Code: Select all

D:\private>filebot -rename --action hardlink D:/private/deluge/data/yellowstone.2018.s05e08.1080p.web.h264-glhf.mkv --db TheTVDB -non-strict --format D:/private/plexmedia/tv/{n}-{s00e00}-{t}
What it produced is this:

Code: Select all

Rename episodes using [TheTVDB] with [Airdate Order]
Lookup via [Yellowstone, Yellowstone] [yellowstone 2018]
Fetching episode data for [Yellowstone]
└─ 57 episodes
Fetching episode data for [Yellowstone]
└─ 6 episodes
[HARDLINK] from [D:\private\deluge\data\yellowstone.2018.s05e08.1080p.web.h264-glhf.mkv] to [D:\private\plexmedia\tv\Yellowstone (2018)-S05E08-A Knife and No Coin.mkv]
[HARDLINK] from [D:\private\deluge\data\yellowstone.2018.s05e08.1080p.web.h264-glhf.mkv] to [D:\private\plexmedia\tv\Yellowstone (2018)-S05E08-A Knife and No Coin.mkv] failed due to I/O error [D:\private\plexmedia\tv\Yellowstone (2018)-S05E08-A Knife and No Coin.mkv -> D:\private\deluge\data\yellowstone.2018.s05e08.1080p.web.h264-glhf.mkv: The request is not supported]
Processed 0 files
Although I can use Mountain Duck to write files to the desired folder on the remote Linux server, it seems that either FileBot can't create the hardlinks (not likely) or that Mountain Duck doesn't allow Filebot to create the hardlinks (far more likely).

FWIW... I've reached out to the makers of Mountain Duck to see what they say.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Windows Command Line to create Linux LN Hardlink Command String

Post by rednoah »

:?: If you don't mind using the filebot command-line tool, why not use the filebot command-line tool on your Linux server directly?

If you don't have root, and if your provider cannot install filebot for you, then you could try the portable package. If you want more manual control, then you can add the --mode interactive option.
:idea: Please read the FAQ and How to Request Help.
SoonerLater
Posts: 10
Joined: 27 Feb 2018, 22:43

Re: Windows Command Line to create Linux LN Hardlink Command String

Post by SoonerLater »

I do not have root / sudo access to my seedbox. However, I'm allowed to install Filebot provided that I can simply copy a compiled binary to the correct location. I have tried using the "portable package" installation method, but it calls sudo, which I'm not allowed to use.

Is there somewhere that I can get the Filebot compiled binary for Linux?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Windows Command Line to create Linux LN Hardlink Command String

Post by rednoah »

SoonerLater wrote: 19 Mar 2023, 01:28 Is there somewhere that I can get the Filebot compiled binary for Linux?
Yes. The tar.sh script uses curl to download the binary package. The URL is printed to the console output when you run the script:
https://github.com/filebot/plugins/blob ... ler/tar.sh


SoonerLater wrote: 19 Mar 2023, 01:28 I have tried using the "portable package" installation method, but it calls sudo, which I'm not allowed to use.
:?: What did the console output say?



:idea: sudo is not required. This line is optional. It merely links /path/to/filebot.sh into the $PATH so that you can run filebot via "filebot" but you can always skip this step and run "/path/to/filebot.sh" directly:

Code: Select all

# [OPTIONAL] Link `filebot` into the $PATH
sudo ln -sf "$PWD/filebot.sh" /usr/local/bin/filebot
:idea: Please read the FAQ and How to Request Help.
SoonerLater
Posts: 10
Joined: 27 Feb 2018, 22:43

Re: Windows Command Line to create Linux LN Hardlink Command String

Post by SoonerLater »

What did the console output say?

Code: Select all

[myserver ~] java -version
openjdk version "1.8.0_322"
OpenJDK Runtime Environment (build 1.8.0_322-8u322-b06-1~deb9u1-b06)
OpenJDK 64-Bit Server VM (build 25.322-b06, mixed mode)
[myserver ~] ls
action.log  Library  private  www
[myserver ~] mkdir filebot-portable
[myserver ~] cd filebot-portable
[myserver ~/filebot-portable] curl -fsSL https://raw.githubusercontent.com/filebot/plugins/master/installer/tar-jdk8.sh | sh -xu
+ PACKAGE_VERSION=5.0.1
+ curl -fsSL https://raw.githubusercontent.com/filebot/website/master/get.filebot.net/filebot/FileBot_5.0.1/FileBot_5.0.1-portable-jdk8.tar.xz.sha256
+ PACKAGE_SHA256=804cea3ee50472e7e552efc696ec67130f4dababfbb41f95bae052d758cc0a4c
+ PACKAGE_FILE=FileBot_5.0.1-portable-jdk8.tar.xz
+ PACKAGE_URL=https://get.filebot.net/filebot/FileBot_5.0.1/FileBot_5.0.1-portable-jdk8.tar.xz
+ curl -o FileBot_5.0.1-portable-jdk8.tar.xz -z FileBot_5.0.1-portable-jdk8.tar.xz https://get.filebot.net/filebot/FileBot_5.0.1/FileBot_5.0.1-portable-jdk8.tar.xz
Warning: Illegal date format for -z, --timecond (and not a file name).
Warning: Disabling time condition. See curl_getdate(3) for valid date syntax.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 30.2M  100 30.2M    0     0  13.7M      0  0:00:02  0:00:02 --:--:-- 13.7M
+ echo 804cea3ee50472e7e552efc696ec67130f4dababfbb41f95bae052d758cc0a4c *FileBot_5.0.1-portable-jdk8.tar.xz
+ sha256sum --check
FileBot_5.0.1-portable-jdk8.tar.xz: OK
+ tar xvf FileBot_5.0.1-portable-jdk8.tar.xz
filebot.sh
jar/args4j.jar
jar/bcpg.jar
jar/bcpkix.jar
jar/bcprov.jar
jar/bcutil.jar
jar/bencode.jar
jar/caffeine.jar
jar/commons-email.jar
jar/commons-io.jar
jar/commons-logging.jar
jar/darcula.jar
jar/ehcache.jar
jar/failureaccess.jar
jar/filebot.jar
jar/flatlaf.jar
jar/glazedlists.jar
jar/groovy-datetime.jar
jar/groovy-dateutil.jar
jar/groovy-json.jar
jar/groovy-jsr223.jar
jar/groovy-nio.jar
jar/groovy-xml.jar
jar/groovy.jar
jar/guava.jar
jar/icu4j.jar
jar/imgscalr.jar
jar/istack-commons-runtime.jar
jar/ivy.jar
jar/jakarta.activation.jar
jar/jakarta.mail.jar
jar/jakarta.xml.bind-api.jar
jar/java-diff-utils.jar
jar/jaxb-core.jar
jar/jaxb-runtime.jar
jar/jna-platform.jar
jar/jna.jar
jar/json-io.jar
jar/jsoup.jar
jar/language-detector.jar
jar/lanterna.jar
jar/metadata-extractor.jar
jar/miglayout-core.jar
jar/miglayout-swing.jar
jar/rsyntaxtextarea.jar
jar/sevenzipjbinding.jar
jar/simmetrics-core.jar
jar/slf4j-api.jar
jar/slf4j-jdk14.jar
jar/xmlrpc.jar
jar/xmpcore.jar
jar/xz.jar
lib/Linux-armv7l/lib7-Zip-JBinding.so
lib/Linux-armv7l/libjnidispatch.so
lib/Linux-armv7l/libmediainfo.so
lib/Linux-armv7l/libz.so
lib/Linux-armv7l/libzen.so
lib/Linux-aarch64/libjnidispatch.so
lib/Linux-aarch64/libmediainfo.so
lib/Linux-aarch64/libz.so
lib/Linux-aarch64/libzen.so
lib/Linux-x86_64/lib7-Zip-JBinding.so
lib/Linux-x86_64/libjnidispatch.so
lib/Linux-x86_64/libmediainfo.so
lib/Linux-x86_64/libzen.so
lib/FreeBSD-amd64/libjnidispatch.so
maintainer.gpg
+ /media/sdu1/soonerlater/filebot-portable/filebot.sh -version
FileBot 5.0.1 (r9665) JDK8 (headless) / Groovy 4.0.9 / OpenJDK Runtime Environment 1.8.0_322 / Linux 4.19.123-feral (amd64)
+ sudo ln -sf /media/sdu1/soonerlater/filebot-portable/filebot.sh /usr/local/bin/filebot
[sudo] password for soonerlater:
soonerlater is not in the sudoers file.  This incident will be reported.
@rednoah, I may be making this all more difficult than it needs to be, but my goal is to have a way to make a media file become available very quickly via Plex on my seedbox. Sometimes everyone has their "hair on fire" to see something ASAP. That's where Plex on my seedbox comes in. For other situations (99% of the time), I download from my seedbox to a temp location on my local server, process with Filebot, then move to permanent storage on my local server that my local Plex server can use - but that can add 20-30 minutes to the process. Sometimes my crew just wants it now, now, now.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Windows Command Line to create Linux LN Hardlink Command String

Post by rednoah »

The FileBot binary package was download from here:

Code: Select all

https://get.filebot.net/filebot/FileBot_5.0.1/FileBot_5.0.1-portable-jdk8.tar.xz
A call to /media/sdu1/soonerlater/filebot-portable/filebot.sh confirms that filebot is indeed working:

Code: Select all

/media/sdu1/soonerlater/filebot-portable/filebot.sh -version

Code: Select all

FileBot 5.0.1 (r9665) JDK8 (headless) / Groovy 4.0.9 / OpenJDK Runtime Environment 1.8.0_322 / Linux 4.19.123-feral (amd64)

:arrow: The next step is to set up unattended automation with the amc script. You'll want to configure your download tools to call filebot on newly completed downloads. There are many ways to do this, depending on your specific environment.



EDIT:

Presumably, you're using tools such as rsync to periodically sync files onto your server. In this case, you could also just run filebot on your server in a very simple script that you then call on a schedule every half an hour:

Code: Select all

# sync files from server
rsync ...
# process files with filebot and move them into the final plex folder structure
filebot ...
:arrow: The goal is to not to anything manually, so that things get synced and organized even if you're asleep or on holiday.
:idea: Please read the FAQ and How to Request Help.
Post Reply