|
|
@ -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__():
|
|
|
|
database.execute(
|
|
|
|
try:
|
|
|
|
insert(table)
|
|
|
|
database.execute(
|
|
|
|
.values(code3=sub.alpha3,
|
|
|
|
insert(table)
|
|
|
|
code2=sub.alpha2,
|
|
|
|
.values(code3=sub.alpha3,
|
|
|
|
name=sub.name,
|
|
|
|
code2=sub.alpha2,
|
|
|
|
enabled=0)
|
|
|
|
name=sub.name,
|
|
|
|
.on_conflict_do_nothing())
|
|
|
|
enabled=0))
|
|
|
|
|
|
|
|
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 = (
|
|
|
|