Auto Sub Lang Detection / Plex Rescan Problem

Any questions? Need some help?
Post Reply
MeRoL
Posts: 9
Joined: 28 Jun 2015, 08:20

Auto Sub Lang Detection / Plex Rescan Problem

Post by MeRoL »

Hi guys,

Since I updated Filebot to the latest version I have problems with adding the lang extension to my .srt files. The .srt is just being passed as .srt and not movie_name.dan.srt or movie_name.eng.srt. When Plex is picking up the .srt file I get unknown language because of the missing lang tag.

Im calling Filebot AMC from a Python script like this:

cmd = ("filebot -script dev:amc -non-strict --def ut_kind=multi --log all --log-file amc.log --def ut_dir=\"%s/%s\" " % (sys.argv[3], sys.argv[2]) + ' '.join(f$join(filebotOptions)).encode(u'utf-8')

filebotOptions = [
'--output $HOME/media', # where you want to copy/organize you're files i.e: X:/path/to/media
'--action symlink', # rename action i.e: move | copy | keeplink | symlink | hardlink
'--conflict override', # conflict resolution i.e: override | skip | fail
'--def subtitles=da', # download subtitles i.e: true | false
'--def artwork=false', # fetch artwork/nfo i.e: true | false
'--def extractfolder=' + path.join(os.getenv("HOME"), "torrents/extracted"),
'--def skipExtract=n',
'--def music=n',
'--encoding utf8',
'--def plex=localhost', # Tell the given Plex instance to rescan it's library
]

EDIT:

I'm also having problems with rescanning Plex when Filebot have done it's magic. I get this error:

Notify Plex: localhost
GET: https://localhost:32400/library/sections/all/refresh
SSLHandshakeException: java.security.cert.CertificateException: No subject alternative DNS name matching localhost found.
User avatar
rednoah
The Source
Posts: 23950
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Auto Sub Lang Detection / Plex Rescan Problem

Post by rednoah »

1.
{lang} won't work if the subtitles aren't already somehow language tagged. That is for dealing with existing subtitles. If filebot is downloading the subs then it'll always save them with language tag. Provide logs if you have issues with that.

movie.eng.srt => yes
movie.srt => no

If you wan't custom logic for language tags you'll need to pass in your own formats. There's threads here in the forums on how to do some primitive language "detection" with simple Groovy expressions.


2.
Use 127.0.0.1 instead of localhost. Since 4.6 the amc script will use HTTP://IP or HTTPS://HOSTNAME to make Plex API calls.
:idea: Please read the FAQ and How to Request Help.
MeRoL
Posts: 9
Joined: 28 Jun 2015, 08:20

Re: Auto Sub Lang Detection / Plex Rescan Problem

Post by MeRoL »

rednoah wrote:1.
{lang} won't work if the subtitles aren't already somehow language tagged. That is for dealing with existing subtitles. If filebot is downloading the subs then it'll always save them with language tag. Provide logs if you have issues with that.

movie.eng.srt => yes
movie.srt => no

If you wan't custom logic for language tags you'll need to pass in your own formats. There's threads here in the forums on how to do some primitive language "detection" with simple Groovy expressions.


2.
Use 127.0.0.1 instead of localhost. Since 4.6 the amc script will use HTTP://IP or HTTPS://HOSTNAME to make Plex API calls.
1.
I have used an older version of Filebot which tagged existing subs with the right lang code. Since every movie I download are with subtitles so no need to get Filebot to automatically download subs.

2.
127.0.0.1 seems to work. But when I try the hostname of my Ubuntu server I still get the same error.
User avatar
rednoah
The Source
Posts: 23950
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Auto Sub Lang Detection / Plex Rescan Problem

Post by rednoah »

1.
Older versions had language detection. Newer versions don't because it didn't work reliably for most languages.

You, as mostly everyone else, probably just want to "detect" English and Other Language, so you don't need to waste OSDB resources for that. Here's some ideas for a workaround:
@see viewtopic.php?f=8&t=2726#p15388

2.
Use IP to force HTTP, or setup HTTPS/SSL correctly.
:idea: Please read the FAQ and How to Request Help.
MeRoL
Posts: 9
Joined: 28 Jun 2015, 08:20

Re: Auto Sub Lang Detection / Plex Rescan Problem

Post by MeRoL »

rednoah wrote:1.
Older versions had language detection. Newer versions don't because it didn't work reliably for most languages.

You, as mostly everyone else, probably just want to "detect" English and Other Language, so you don't need to waste OSDB resources for that. Here's some ideas for a workaround:
@see viewtopic.php?f=8&t=2726#p15388

2.
Use IP to force HTTP, or setup HTTPS/SSL correctly.
1.
Thanks I will try adding that to my format and see what happens!

EDIT:

So I added this code inside of my Python script and now Filebot is adding .dan lang extension to my .srt files:
'--def "movieFormat=$HOME/media/Movies/{n} ({y})/{n} ({y}){\' CD\'+pi}{\'.\'+lang}{if (ext == \'srt\') \'.dan\'}"',

Thanks for the help

2.
When I try to use https://server_ip:32400/web/index.html in my browser I get an SSL error. Maybe thats the reason why Filebot can't rescan Plex with SSL.

But when I use 127.0.0.1 everything works fine. But I want to add SSL.

It's my first time working with Filebot and Plex so I'm sorry if this could easily be fixed :lol:
User avatar
rednoah
The Source
Posts: 23950
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Auto Sub Lang Detection / Plex Rescan Problem

Post by rednoah »

1.
Like I said, if you only process Danish subtitles you may as well hardcode the ".dan" part. ;)

2.
SSL is not trivial. And naturally Java/HTTPS stack will not allow certificate errors, or to skip certificate errors just like that. I'd completely undermine the point of using SSL in the first place! :D

Though these SSL issues are completely generic. Google should provide plenty of resources for troubleshooting that kinda of stuff.
:idea: Please read the FAQ and How to Request Help.
MeRoL
Posts: 9
Joined: 28 Jun 2015, 08:20

Re: Auto Sub Lang Detection / Plex Rescan Problem

Post by MeRoL »

rednoah wrote:1.
Like I said, if you only process Danish subtitles you may as well hardcode the ".dan" part. ;)

2.
SSL is not trivial. And naturally Java/HTTPS stack will not allow certificate errors, or to skip certificate errors just like that. I'd completely undermine the point of using SSL in the first place! :D

Though these SSL issues are completely generic. Google should provide plenty of resources for troubleshooting that kinda of stuff.
Okay I got everything to work now. But I ran into another problem. Some torrents are downloaded with additional nordic subtitles (swe, nor, fin). So if I hardcode the .dan into every file with .srt ext I get files like this: file_name.swe.dan.srt

Is there a way to only process a specific .srt file. Every nordic torrent I grab are downloaded like this

file_name.mkv
file_name.srt (The file with only the .srt ext and without the lang code is always danish subtitles)
file_name.sw.srt
file_name.fi.srt
file_name.no.srt

So either way I want to skip the sw, fi and no subtitles or then Filebot should only hardcode .dan lang code into files that are only ending at .srt without lang code.

Is this possible?
User avatar
rednoah
The Source
Posts: 23950
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Auto Sub Lang Detection / Plex Rescan Problem

Post by rednoah »

--def ignore
:idea: Please read the FAQ and How to Request Help.
Post Reply