Added support for pt-pt language code in subtitles filename. #2306

pull/2342/head
morpheus65535 1 year ago
parent 163a7834d2
commit 7d14798e69

@ -24,7 +24,9 @@ class CustomLanguage:
_possible_matches = ("pt-br", "pob", "pb", "brazilian", "brasil", "brazil") _possible_matches = ("pt-br", "pob", "pb", "brazilian", "brasil", "brazil")
_extensions = (".pt-br", ".pob", ".pb") _extensions = (".pt-br", ".pob", ".pb")
_extensions_forced = (".pt-br.forced", ".pob.forced", ".pb.forced") _extensions_forced = (".pt-br.forced", ".pob.forced", ".pb.forced")
_extensions_hi = (".pt-br.hi", ".pob.hi", ".pb.hi") _extensions_hi = (".pt-br.hi", ".pob.hi", ".pb.hi",
".pt-br.cc", ".pob.cc", ".pb.cc",
".pt-br.sdh", ".pob.sdh", ".pb.sdh")
def subzero_language(self): def subzero_language(self):
return Language(self.official_alpha3, self.iso) return Language(self.official_alpha3, self.iso)
@ -45,7 +47,7 @@ class CustomLanguage:
@classmethod @classmethod
def register(cls, table): def register(cls, table):
"Register the custom language subclasses in the database." """Register the custom language subclasses in the database."""
for sub in cls.__subclasses__(): for sub in cls.__subclasses__():
database.execute( database.execute(
@ -107,6 +109,23 @@ class BrazilianPortuguese(CustomLanguage):
pass pass
class Portuguese(CustomLanguage):
alpha2 = "pt"
alpha3 = "por"
language = "pt-PT"
official_alpha2 = "pt"
official_alpha3 = "por"
name = "Portuguese"
iso = "PT"
_scripts = []
_possible_matches = ("pt-pt", "por", "pt")
_extensions = (".pt-pt", ".por", ".pt")
_extensions_forced = (".pt-pt.forced", ".por.forced", ".pt.forced")
_extensions_hi = (".pt-pt.hi", ".por.hi", ".pt.hi",
".pt-pt.cc", ".por.cc", ".pt.cc",
".pt-pt.sdh", ".por.sdh", ".pt.sdh")
class ChineseTraditional(CustomLanguage): class ChineseTraditional(CustomLanguage):
alpha2 = "zt" alpha2 = "zt"
alpha3 = "zht" alpha3 = "zht"
@ -119,67 +138,27 @@ class ChineseTraditional(CustomLanguage):
# We'll use literals for now # We'll use literals for now
_scripts = ("Hant",) _scripts = ("Hant",)
_extensions = ( _extensions = (
".cht", ".cht", ".tc", ".zh-tw", ".zht", ".zh-hant", ".zhhant", ".zh_hant", ".hant", ".big5", ".traditional",
".tc",
".zh-tw",
".zht",
".zh-hant",
".zhhant",
".zh_hant",
".hant",
".big5",
".traditional",
) )
_extensions_forced = ( _extensions_forced = (
".cht.forced", ".cht.forced", ".tc.forced", ".zht.forced", "hant.forced", ".big5.forced", "繁體中文.forced", "雙語.forced",
".tc.forced",
".zht.forced",
"hant.forced",
".big5.forced",
"繁體中文.forced",
"雙語.forced",
".zh-tw.forced", ".zh-tw.forced",
) )
_extensions_hi = ( _extensions_hi = (
".cht.hi", ".cht.hi", ".tc.hi", ".zht.hi", "hant.hi", ".big5.hi", "繁體中文.hi", "雙語.hi", ".zh-tw.hi",
".tc.hi",
".zht.hi",
"hant.hi",
".big5.hi",
"繁體中文.hi",
"雙語.hi",
".zh-tw.hi",
) )
_extensions_fuzzy = ("", "雙語") _extensions_fuzzy = ("", "雙語")
_extensions_disamb_fuzzy = ("", "双语") _extensions_disamb_fuzzy = ("", "双语")
_extensions_disamb = ( _extensions_disamb = (
".chs", ".chs", ".sc", ".zhs", ".zh-hans", ".hans", ".zh_hans", ".zhhans", ".gb", ".simplified",
".sc",
".zhs",
".zh-hans",
".hans",
".zh_hans",
".zhhans",
".gb",
".simplified",
) )
_extensions_disamb_forced = ( _extensions_disamb_forced = (
".chs.forced", ".chs.forced", ".sc.forced", ".zhs.forced", "hans.forced", ".gb.forced", "简体中文.forced", "双语.forced",
".sc.forced",
".zhs.forced",
"hans.forced",
".gb.forced",
"简体中文.forced",
"双语.forced",
) )
_extensions_disamb_hi = ( _extensions_disamb_hi = (
".chs.hi", ".chs.hi", ".sc.hi", ".zhs.hi", "hans.hi", ".gb.hi", "简体中文.hi", "双语.hi",
".sc.hi", ".chs.cc", ".sc.cc", ".zhs.cc", "hans.cc", ".gb.cc", "简体中文.cc", "双语.cc",
".zhs.hi", ".chs.sdh", ".sc.sdh", ".zhs.sdh", "hans.sdh", ".gb.sdh", "简体中文.sdh", "双语.sdh",
"hans.hi",
".gb.hi",
"简体中文.hi",
"双语.hi",
) )
@classmethod @classmethod
@ -231,31 +210,14 @@ class LatinAmericanSpanish(CustomLanguage):
iso = "MX" # Not fair, but ok iso = "MX" # Not fair, but ok
_scripts = ("419",) _scripts = ("419",)
_possible_matches = ( _possible_matches = (
"es-la", "es-la", "spa-la", "spl", "mx", "latin", "mexic", "argent", "latam",
"spa-la",
"spl",
"mx",
"latin",
"mexic",
"argent",
"latam",
) )
_extensions = (".es-la", ".spl", ".spa-la", ".ea", ".es-mx", ".lat", ".es.ar") _extensions = (".es-la", ".spl", ".spa-la", ".ea", ".es-mx", ".lat", ".es.ar")
_extensions_forced = ( _extensions_forced = (
".es-la.forced", ".es-la.forced", ".spl.forced", ".spa-la.forced", ".ea.forced", ".es-mx.forced", ".lat.forced", ".es.ar.forced",
".spl.forced",
".spa-la.forced",
".ea.forced",
".es-mx.forced",
".lat.forced",
".es.ar.forced",
) )
_extensions_hi = ( _extensions_hi = (
".es-la.hi", ".es-la.hi", ".spl.hi", ".spa-la.hi", ".ea.hi", ".es-mx.hi", ".lat.hi", ".es.ar.hi",
".spl.hi", ".es-la.cc", ".spl.cc", ".spa-la.cc", ".ea.cc", ".es-mx.cc", ".lat.cc", ".es.ar.cc",
".spa-la.hi", ".es-la.sdh", ".spl.sdh", ".spa-la.sdh", ".ea.sdh", ".es-mx.sdh", ".lat.sdh", ".es.ar.sdh",
".ea.hi",
".es-mx.hi",
".lat.hi",
".es.ar.hi",
) )

Loading…
Cancel
Save