Simple Command Help

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Light
Posts: 6
Joined: 25 Apr 2025, 01:41

Simple Command Help

Post by Light »

Hi guys, I'm a new user and just purchased a license on Windows recently.

What i'm looking to achieve:
After finishing renaming files, I want to automatically fetch English subtitles and then move the subs to "\Subs\filename"

Ideally, I'd also like to remove the language parameter from the subs, so it matches the video file name exactly minus extension.

The result should be that all episodes in a TV series are in the \subs\ folder whilst the video files are a level up.

I've tried to do this via a custom post-processing script but I couldn't make it work and I'm not sure if there's an easier way to go about it anyway?
User avatar
rednoah
The Source
Posts: 23922
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Simple Command Help

Post by rednoah »

:idea: The easiest way would be to just use Plain File Mode, either semi-manually in the Desktop application via a Preset or automatically when needed via the filebot command-line tool:

Console Output: Select all

$ filebot -rename -r /path/to/input --db file --filter "f.subtitle && none{ f =~ /subs/ }" --format "{folder}/subs/{fn.removeAll(/[.][a-z]{2,3}$/)}"
[MOVE] from [Alias.1x01.eng.srt] to [subs/Alias.1x01.srt]




:idea: If you must have a Custom Post-Processing Script then code that moves subtitle files into a subs/ folder and renames them to the video file name might look like this:

Groovy: Select all

{ source, target ->
	if (target.video) {
		target.dir.listFiles().each{ f ->
			if (f.subtitle && f.isDerived(target)) {
				f.move(target.dir / 'subs' / target.nameWithoutExtension + '.' + f.extension)
			}
		}		
	}
}
File.isDerived() takes care of selecting files that have the same base name, e.g. Avatar.eng.srt is derived from Avatar.mkv.
:idea: Please read the FAQ and How to Request Help.
Light
Posts: 6
Joined: 25 Apr 2025, 01:41

Re: Simple Command Help

Post by Light »

You are absolutely insane @rednoah

I cannot believe you made it work that easily. I appreciate it.
Light
Posts: 6
Joined: 25 Apr 2025, 01:41

Re: Simple Command Help

Post by Light »

Hi @RedNoah, I'm now getting an error, but from the looks of it, it might be some sort of API limit rather than an issue with FileBot?

Console Output: Select all

WARNING: net.filebot.web.HttpClientError: https://api.opensubtitles.com/api/v1/download [406 Client Error 406] (F:\TV Shows\Black Mirror\Season 01\Black Mirror - S01E01 - The National Anthem.mkv)
Apr 25, 2025 12:25:58 PM net.filebot.subtitle.SubtitleMetrics$5 getSubtitleProperties
WARNING: Failed to read subtitle properties: class java.lang.Double cannot be cast to class java.lang.Float (java.lang.Double and java.lang.Float are in module java.base of loader 'bootstrap')
User avatar
rednoah
The Source
Posts: 23922
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Simple Command Help

Post by rednoah »

Light wrote: 25 Apr 2025, 11:34 Apr 25, 2025 12:25:58 PM net.filebot.subtitle.SubtitleMetrics$5 getSubtitleProperties
WARNING: Failed to read subtitle properties: class java.lang.Double cannot be cast to class java.lang.Float (java.lang.Double and java.lang.Float are in module java.base of loader 'bootstrap')[/output]
That would be a unintentional internal error on the FileBot side. We can look into that and fix it with the next release. Thanks for the report.

Light wrote: 25 Apr 2025, 11:34

Console Output: Select all

WARNING: net.filebot.web.HttpClientError: https://api.opensubtitles.com/api/v1/download [406 Client Error 406] (F:\TV Shows\Black Mirror\Season 01\Black Mirror - S01E01 - The National Anthem.mkv)
Not sure about this one. Can you provide more details so that we can reproduce the issue?
:idea: Please read the FAQ and How to Request Help.
Light
Posts: 6
Joined: 25 Apr 2025, 01:41

Re: Simple Command Help

Post by Light »

Sure. Let me know what else you need to know and I'll do all I can.

This is the full name of the file I tested it on.

Format: Select all

Black Mirror - S01E01 - The National Anthem.mkv
This is the preset I was using, but I also tested on default "TheMovieDB - TV"

Format: Select all

{drive}/{plex}
I was trying to rename the files, and these are the post-processing options I have enabled.
Screenshot

And this is what I can see in the Groovy Pad.

Groovy: Select all

WARNING: net.filebot.web.HttpClientError: https://api.opensubtitles.com/api/v1/download [406 Client Error 406] (F:\TV Shows\Black Mirror\Season 01\Black Mirror - S01E01 - The National Anthem.mkv)
Apr 25, 2025 3:16:23 PM net.filebot.ui.rename.PostProcessWorker applyPostProcess
WARNING: net.filebot.web.HttpClientError: https://api.opensubtitles.com/api/v1/download [406 Client Error 406] (F:\TV Shows\Black Mirror\Season 01\Black Mirror - S01E01 - The National Anthem.mkv)
I am successfully authenticated on OpenSubs if that matters.
User avatar
rednoah
The Source
Posts: 23922
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Simple Command Help

Post by rednoah »

I see. So this error causes subtitles to not be downloaded?

Please do a Clear Cache and then retry to see if that makes a difference:

Shell: Select all

filebot -clear-cache
:idea: Please read the FAQ and How to Request Help.
Light
Posts: 6
Joined: 25 Apr 2025, 01:41

Re: Simple Command Help

Post by Light »

You are correct in your understanding. It successfully renames the video file but will not fetch subtitles and thus does not move them because they don't exist.

This is the output I got after clearing cache and trying again.

Console Output: Select all

WARNING: Initialize new disk cache: C:\Users\***\AppData\Roaming\FileBot\cache\0
Apr 25, 2025 10:26:31 PM net.filebot.License lambda$verifyLicense$2
WARNING: Activate License [*********] on [Fri Apr 25 22:26:31 BST 2025]
Apr 25, 2025 10:26:33 PM net.filebot.ui.rename.PostProcessWorker applyPostProcess
WARNING: net.filebot.web.HttpClientError: https://api.opensubtitles.com/api/v1/download [406 Client Error 406] (F:\TV Shows\Black Mirror\Season 01\Black Mirror - S01E01 - The National Anthem.mkv)
Apr 25, 2025 10:26:33 PM net.filebot.ui.rename.PostProcessWorker applyPostProcess
WARNING: net.filebot.web.HttpClientError: https://api.opensubtitles.com/api/v1/download [406 Client Error 406] (F:\TV Shows\Black Mirror\Season 01\Black Mirror - S01E02 - Fifteen Million Merits.mkv)
Apr 25, 2025 10:26:33 PM net.filebot.ui.rename.PostProcessWorker applyPostProcess
WARNING: net.filebot.web.HttpClientError: https://api.opensubtitles.com/api/v1/download [406 Client Error 406] (F:\TV Shows\Black Mirror\Season 01\Black Mirror - S01E03 - The Entire History of You.mkv)
Apr 25, 2025 10:26:33 PM net.filebot.ui.rename.PostProcessWorker applyPostProcess
WARNING: net.filebot.web.HttpClientError: https://api.opensubtitles.com/api/v1/download [406 Client Error 406] (F:\TV Shows\Black Mirror\Season 01\Black Mirror - S01E01 - The National Anthem.mkv)
Apr 25, 2025 10:26:33 PM net.filebot.ui.rename.PostProcessWorker applyPostProcess
WARNING: net.filebot.web.HttpClientError: https://api.opensubtitles.com/api/v1/download [406 Client Error 406] (F:\TV Shows\Black Mirror\Season 01\Black Mirror - S01E02 - Fifteen Million Merits.mkv)
Apr 25, 2025 10:26:33 PM net.filebot.ui.rename.PostProcessWorker applyPostProcess
WARNING: net.filebot.web.HttpClientError: https://api.opensubtitles.com/api/v1/download [406 Client Error 406] (F:\TV Shows\Black Mirror\Season 01\Black Mirror - S01E03 - The Entire History of You.mkv)
User avatar
rednoah
The Source
Posts: 23922
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Simple Command Help

Post by rednoah »

Looks like clearing the cache didn't do anything. Have you perhaps exceeded your quota? If you use the Icon login button it'll show you the current quota.
:idea: Please read the FAQ and How to Request Help.
Light
Posts: 6
Joined: 25 Apr 2025, 01:41

Re: Simple Command Help

Post by Light »

Yes, I believe so. It seems the limit is 20, so I definitely would have hit it. Strangely, just days prior I remember renaming over 100 files and getting subs for them though... so that is strange.
Post Reply