subtitles.py: Backport for Python 2

This commit is contained in:
croneter 2021-09-04 16:37:56 +02:00
parent e6a0af4621
commit c182b8f5f8

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
import re import re
from os import path from os import path
@ -436,8 +437,8 @@ def external_subs_from_filesystem(dirname, filename):
# (but Plex might!!) # (but Plex might!!)
continue continue
regex = SUBTITLE_LANGUAGE.search(name.replace(filename, '', 1)) regex = SUBTITLE_LANGUAGE.search(name.replace(filename, '', 1))
language = (regex[1] or '').lower() language = (regex.group(1) if regex.group(1) else '').lower()
forced = True if regex[2] else False forced = True if regex.group(2) else False
iso = None iso = None
if len(language) == 2: if len(language) == 2:
language_searchgrid = (1, ) language_searchgrid = (1, )