|
|
@ -5,7 +5,8 @@ import os
|
|
|
|
|
|
|
|
|
|
|
|
from subzero.language import Language
|
|
|
|
from subzero.language import Language
|
|
|
|
|
|
|
|
|
|
|
|
from app.database import database, insert
|
|
|
|
from app.database import database, insert, update
|
|
|
|
|
|
|
|
from sqlalchemy.exc import IntegrityError
|
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
@ -18,7 +19,7 @@ class CustomLanguage:
|
|
|
|
language = "pt-BR"
|
|
|
|
language = "pt-BR"
|
|
|
|
official_alpha2 = "pt"
|
|
|
|
official_alpha2 = "pt"
|
|
|
|
official_alpha3 = "por"
|
|
|
|
official_alpha3 = "por"
|
|
|
|
name = "Brazilian Portuguese"
|
|
|
|
name = "Portuguese (Brazil)"
|
|
|
|
iso = "BR"
|
|
|
|
iso = "BR"
|
|
|
|
_scripts = []
|
|
|
|
_scripts = []
|
|
|
|
_possible_matches = ("pt-br", "pob", "pb", "brazilian", "brasil", "brazil")
|
|
|
|
_possible_matches = ("pt-br", "pob", "pb", "brazilian", "brasil", "brazil")
|
|
|
@ -50,13 +51,19 @@ class CustomLanguage:
|
|
|
|
"""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__():
|
|
|
|
|
|
|
|
try:
|
|
|
|
database.execute(
|
|
|
|
database.execute(
|
|
|
|
insert(table)
|
|
|
|
insert(table)
|
|
|
|
.values(code3=sub.alpha3,
|
|
|
|
.values(code3=sub.alpha3,
|
|
|
|
code2=sub.alpha2,
|
|
|
|
code2=sub.alpha2,
|
|
|
|
name=sub.name,
|
|
|
|
name=sub.name,
|
|
|
|
enabled=0)
|
|
|
|
enabled=0))
|
|
|
|
.on_conflict_do_nothing())
|
|
|
|
except IntegrityError:
|
|
|
|
|
|
|
|
database.execute(
|
|
|
|
|
|
|
|
update(table)
|
|
|
|
|
|
|
|
.values(code2=sub.alpha2,
|
|
|
|
|
|
|
|
name=sub.name)
|
|
|
|
|
|
|
|
.where(table.code3 == sub.alpha3))
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
@classmethod
|
|
|
|
def found_external(cls, subtitle, subtitle_path):
|
|
|
|
def found_external(cls, subtitle, subtitle_path):
|
|
|
@ -212,7 +219,7 @@ class LatinAmericanSpanish(CustomLanguage):
|
|
|
|
language = "es-MX"
|
|
|
|
language = "es-MX"
|
|
|
|
official_alpha2 = "es"
|
|
|
|
official_alpha2 = "es"
|
|
|
|
official_alpha3 = "spa"
|
|
|
|
official_alpha3 = "spa"
|
|
|
|
name = "Latin American Spanish"
|
|
|
|
name = "Spanish (Latino)"
|
|
|
|
iso = "MX" # Not fair, but ok
|
|
|
|
iso = "MX" # Not fair, but ok
|
|
|
|
_scripts = ("419",)
|
|
|
|
_scripts = ("419",)
|
|
|
|
_possible_matches = (
|
|
|
|
_possible_matches = (
|
|
|
|