Where can I add ISO2, so that subs get rename in a 2 letter format

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
abescalamis
Posts: 17
Joined: 26 Jan 2018, 04:10

Where can I add ISO2, so that subs get rename in a 2 letter format

Post by abescalamis » 24 May 2018, 18:46

filebot -script 'fn:amc' /volume1/Data/Prueba --output /volume1/Data/Media/listo --action move -non-strict --conflict override --lang en --def 'ut_label=movie' 'music=y' 'unsorted=y' 'artwork=y' 'clean=y' 'deleteAfterExtract=y' 'excludeList=.excludes' --log all --log-file '/volume1/@appstore/filebot-node/data/filebot.log'

I use the above script, and I was wondering if there is a way so that the renaming of the subtitles get to Movie (2018).eng.srt, instead I want Movie (2018).en.srt, when I used the fileboot language identifier I just add the .ISO2 to the {'.'+lang.ISO2}, I was wondering if is possible to do the same for the above script.

Also, I notice that fileboot adds the artwork and names it like this (fanart.jpg, etc) and Kodi Names it like this (Movie (2018)-fanart.jpg, etc), is possible to make it match the way kodi does it?

is even possible to do any of the above? or maybe someone here knows how to make kodi to save the downloded subtitles using the three language code instead.

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

Re: Where can I add ISO2, so that subs get rename in a 2 letter format

Post by rednoah » 25 May 2018, 07:53

1.
Strange. You don't seem to be using any custom formats so it should be defaulting to the Plex format, which enforces Plex compatible 3-letter language codes.


2.
Changing artwork naming is not possible (unless you modify the scripts). I'd just write an extra scripts that batch renames artwork files to {folder.name}-{fn}.
:idea: Please read the FAQ and How to Request Help.

abescalamis
Posts: 17
Joined: 26 Jan 2018, 04:10

Re: Where can I add ISO2, so that subs get rename in a 2 letter format

Post by abescalamis » 25 May 2018, 19:06

Thank Rednoah.

The reason why I'm asking this is because I'm trying to make an automatic setup, with very little user interaction, I'm using multiple tools to accomplish that, and Emby is my streaming server, My biggest problem is that some tools use ISO2 and others ISO3, I have work around/solutions like the one you gave me in number 2,

My setup so far:
-Synology NAS - Running Emby Server
-Tasks created (NAS) to use "subliminal" and subtitle movies automatically from multiple providers automatically (it uses ISO-2).
-I use a Kodi client to download spanish subtitles that Subliminal cannot find using the Subdvix pluggin (Kodi uses ISO-2).
- Task created (NAS) to use Filebot AMC script after downloading movies.
- after running the AMC script I will do a rename command to match Kodi way of renaming artwork (work in progress need to find the command)

This is what I need to complete my set up

- I need to have the AMC to use ISO2 for subtitles if not possible I will use a rename command(work around)

-I still need to find the command to run before running the AMC script, to rename and identified the subtitle so that AMC detects it and move and rename the subtitle as well, I know how to do it using the GUI but need to find a command for automation, I need the command that does the same as this:
GUI setting
Input Folder:

Code: Select all

Z:\Media\Movies\Movies A-Z
Includes:

Code: Select all

ext=~/srt/
Format - Expression:

Code: Select all

{n.colon(' - ')} ({y}){' CD'+pi}{'.'+lang.ISO2}
Thank you, .

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

Re: Where can I add ISO2, so that subs get rename in a 2 letter format

Post by rednoah » 27 May 2018, 05:26

Are you familiar with using command-line tools? What have you tried so far?

If you're using the amc script, then it's using {plex} as format by default, but you can pass in your own custom format if you like. Please read the Change how files will be organized and renamed section of the amc script.
:idea: Please read the FAQ and How to Request Help.

abescalamis
Posts: 17
Joined: 26 Jan 2018, 04:10

Re: Where can I add ISO2, so that subs get rename in a 2 letter format

Post by abescalamis » 27 May 2018, 22:40

I figure out how to change the language suffix when using the AMC script

filebot -script fn:amc --output "/volume1/Data/Prueba/" --action move -non-strict "/volume1/AMC Filebot/" 'movieFormat={n}{y}/{ny}{'\'' CD'\''+pi}{'\''.'\''+lang.ISO2}' 'clean=y' 'deleteAfterExtract=y' --log-file amc.log --def excludeList=amc.txt

I'm a step closer to fully automation.
I know that the AMC sript doesn't detect and move the subtitles if they don't have the same name as the video file, the solution I thought is run a comand before running the AMC script to rename the srt subitles and add the videofile name and language suffix. Do you know if filebot can do that.

last question

if I add '--def artwork=y' it adds artwork and NFO, if there a way to add the NFO only?

kim
Power User
Posts: 798
Joined: 15 May 2014, 16:17

Re: Where can I add ISO2, so that subs get rename in a 2 letter format

Post by kim » 28 May 2018, 02:38

if I add '--def artwork=y' it adds artwork and NFO, if there a way to add the NFO only?
you may want to try my custom AMC script ;)
viewtopic.php?f=4&t=5451&p=31192#p31191
--def nfoOnly=y (get/make ONLY Movie/TV NFO's)

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

Re: Where can I add ISO2, so that subs get rename in a 2 letter format

Post by rednoah » 28 May 2018, 03:26

abescalamis wrote:
27 May 2018, 22:40
I know that the AMC sript doesn't detect and move the subtitles if they don't have the same name as the video file, the solution I thought is run a comand before running the AMC script to rename the srt subitles and add the videofile name and language suffix. Do you know if filebot can do that.
This would be my recommendation, but not sure if anybody is using FileBot for that. It should be quite easy, but I'm also not aware of any commands you could just copy & paste.


Here's a start though:
viewtopic.php?f=10&t=5941#p34035


If you replace {fn.nameWithoutExtension} with {folder.name} maybe that might just be good enough? Assuming that all your movies are in their own folder and that the folder names matches the movie file file name.
:idea: Please read the FAQ and How to Request Help.

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

Re: Where can I add ISO2, so that subs get rename in a 2 letter format

Post by rednoah » 28 May 2018, 04:20

If all your subtitles are in "Subs" folders then this will work:

Code: Select all

{f.dir.dir.listFiles().find{ it.video }.nameWithoutExtension}{subt}


:idea: Note that this format will not work correctly if subs are not exactly one folder level inside the movie folder, and the format will need to be adjusted for different situations, or to auto-detect different situations.



e.g. Test Case:

Code: Select all

$ tree .
.
├── Avatar.2009.mp4
└── Subs
    └── 1_eng.srt
e.g. Output:

Code: Select all

$ filebot -rename -r . --db xattr -non-strict --filter "f.subtitle" --output . --format "{f.dir.dir.listFiles().find{ it.video }.nameWithoutExtension}{subt}"
Rename files using [Extended Attributes]
[MOVE] From [Avatar.2009/Subs/1_eng.srt] to [Avatar.2009/Avatar.2009.eng.srt]
Processed 1 files

Code: Select all

$ tree .
.
├── Avatar.2009.eng.srt
├── Avatar.2009.mp4
└── Subs



EDIT:

Here's a bit of internal API that might be useful in this particular case:

Code: Select all

{net.filebot.media.MediaDetection.guessMovieFolder(f).name}
:idea: Please read the FAQ and How to Request Help.

abescalamis
Posts: 17
Joined: 26 Jan 2018, 04:10

Re: Where can I add ISO2, so that subs get rename in a 2 letter format

Post by abescalamis » 29 May 2018, 18:59

All of the info provided help me a lot and I'm done

This is the command to rename the subs the same as the video file and adds language suffix (pre AMC run)(doesn't move any sub)

Code: Select all

filebot -rename -r '/volume1/AMC Filebot' --db xattr -non-strict --format "{net.filebot.media.MediaDetection.guessMovieFolder(f).name}{subt}"
Then I run my AMC scrip:

Code: Select all

filebot -script 'fn:amc' '/volume1/AMC Filebot' --output /volume1/Data/Prueba --action move -non-strict --conflict fail --def 'ut_label=movie' 'clean=y' 'deleteAfterExtract=y' 'movieFormat={ny}/{ny}{'\''.'\''+lang.ISO2}' --log-file amc.log --def excludeList=amc.txt
Important Note:

The first command only renames the subs even if they are inside a subfolder or next to the video, this is enough for the AMC script to detect and move the subs.

I also tried to have the subs moved next to the video file, but couldn't find a good --output argument for that, this is what I tried

Code: Select all

filebot -rename -r '/volume1/AMC Filebot/Bluray' --db xattr -non-strict --filter "f.subtitle" --output '/volume1/AMC Filebot/Bluray' --format "{net.filebot.media.MediaDetection.guessMovieFolder(f).name}{subt}"
Anyways

Thank you Rednoah.

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

Re: Where can I add ISO2, so that subs get rename in a 2 letter format

Post by rednoah » 30 May 2018, 05:35

This should do the trick, to move subtitles in the movie folder and renaming them using that movie folders name:

Code: Select all

{def m = net.filebot.media.MediaDetection.guessMovieFolder(f); m/m.name}{subt}
:idea: Please read the FAQ and How to Request Help.

kimosavi
Posts: 3
Joined: 05 Apr 2014, 14:05

Re: Where can I add ISO2, so that subs get rename in a 2 letter format

Post by kimosavi » 15 Aug 2019, 15:39

hi guys, at the end, can the orphan Eng.1.srt file that was downloaded with the movie under folder Subs be renamed before the main "filebot -script fn:amc..." script is run?

can the latest sript: "{def m = net.filebot.media.MediaDetection.guessMovieFolder(f); m/m.name}{subt}" do this? and sorry for the question, but where is this to be pasted, if I'm calling the script from mutorrent?

I have the standard AMC script working ok from mutorrent.

Post Reply