Page 1 of 1

AMC subtitle codepage selection

Posted: 30 Aug 2014, 04:04
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

Re: AMC subtitle codepage selection

Posted: 30 Aug 2014, 04:21
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') ?: []

Re: AMC subtitle codepage selection

Posted: 18 Apr 2020, 17:43
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.

Re: AMC subtitle codepage selection

Posted: 18 Apr 2020, 18:19
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.

Re: AMC subtitle codepage selection

Posted: 18 Apr 2020, 18:45
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.

Re: AMC subtitle codepage selection

Posted: 19 Apr 2020, 04:37
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

Re: AMC subtitle codepage selection

Posted: 19 Apr 2020, 09:06
by trane5587
Can i make sed to search all the .srt in folder Downloads and make them utf8 with bom?

Re: AMC subtitle codepage selection

Posted: 19 Apr 2020, 09:09
by rednoah
You can certainly use find -exec to find all *.srt files and call sed on them.

Re: AMC subtitle codepage selection

Posted: 19 Apr 2020, 09:52
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?

Re: AMC subtitle codepage selection

Posted: 19 Apr 2020, 10:04
by trane5587
Maybe like this?

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

Re: AMC subtitle codepage selection

Posted: 19 Apr 2020, 18:54
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