AMC subtitle codepage selection

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
psicotron3
Posts: 3
Joined: 17 Feb 2014, 22:25

AMC subtitle codepage selection

Post by psicotron3 »

I found out that AMC saves subtitles only wiith utf-8 encoding. Since my samsung tv need windows-1252 (ANSI) I usually save a local copy of the script and change the code.

Could you please add an option to select the encoding?

By the way, it would be nice to add an option to name the srt file without the language tag.

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

Re: AMC subtitle codepage selection

Post by rednoah »

Not gonna add options just to make outdated devices work. You can make your own mod for that.

Just change this line:

Code: Select all

def subtitleFiles = getMissingSubtitles(file:files, lang:languageCode, strict:true, output:'srt', encoding:'UTF-8', db: 'OpenSubtitles', format:'MATCH_VIDEO_ADD_LANGUAGE_TAG') ?: []
:idea: Please read the FAQ and How to Request Help.
trane5587
Posts: 6
Joined: 18 Apr 2020, 17:39

Re: AMC subtitle codepage selection

Post by trane5587 »

Greetings,

I also have this problem the thing is that some devices cant recognize the characters of the .srt file which is UTF-8 but can recognise UTF-8 with BOM or an ANSI.

I used the windows-1253 for encoding and working perfectly but only to get subtitles for one file.

Can you please be more specific in how can we change this for a script suball?

Thank you.
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC subtitle codepage selection

Post by rednoah »

e.g. you can pass --encoding on the command-line, if you're not using the amc script:

Code: Select all

--encoding Windows-1252
:arrow: https://www.filebot.net/cli.html


:idea: Alternatively, you could write a script that adds the UTF-8 BOM to all your *.srt files. That would be rather trivial.
:idea: Please read the FAQ and How to Request Help.
trane5587
Posts: 6
Joined: 18 Apr 2020, 17:39

Re: AMC subtitle codepage selection

Post by trane5587 »

I m running this via a task on my synology

filebot -script fn:suball /volume2/Disk.2/Downloads/ --lang el -non-strict

the thing is because of greek language the best is to have a utf8 with bom can i write a script at the end of the task? Do you have any idea how to do that?

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

Re: AMC subtitle codepage selection

Post by rednoah »

Yes, writing a Groovy script is trivial. But Googling for a solution is even easier, even sed can do the job:
https://stackoverflow.com/a/35807131/1514467
:idea: Please read the FAQ and How to Request Help.
trane5587
Posts: 6
Joined: 18 Apr 2020, 17:39

Re: AMC subtitle codepage selection

Post by trane5587 »

Can i make sed to search all the .srt in folder Downloads and make them utf8 with bom?
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC subtitle codepage selection

Post by rednoah »

You can certainly use find -exec to find all *.srt files and call sed on them.
:idea: Please read the FAQ and How to Request Help.
trane5587
Posts: 6
Joined: 18 Apr 2020, 17:39

Re: AMC subtitle codepage selection

Post by trane5587 »

Is that right?

find . -name '*.srt' -type f -exec sed -i '1s/^/\xef\xbb\xbf/'

but how i ll make find to look to specific file?
trane5587
Posts: 6
Joined: 18 Apr 2020, 17:39

Re: AMC subtitle codepage selection

Post by trane5587 »

Maybe like this?

find /volume2/Disk.2/Downloads/ -name '*.srt' -type f -exec sed -i '1s/^/\xef\xbb\xbf/'
trane5587
Posts: 6
Joined: 18 Apr 2020, 17:39

Re: AMC subtitle codepage selection

Post by trane5587 »

I think that finally found it if anyone need it this is it:

Code: Select all

find 'path' -name '*.srt' -exec sed -i '1s/^/\xef\xbb\xbf/' {} \;
this will find all your .srt files in the specific directory and then change utf 8 to utf 8 with bom
Post Reply