KoD 1.7.2

- corretto il playback in tutti i casi (torrent, autoplay, videoteca, libreria ecc..)\n- piccole migliorie prestazionali nella ricerca globale\n- fix trailer\n\n
This commit is contained in:
marco
2021-11-08 19:50:51 +01:00
parent 9c7c41d44a
commit 941d8f2236
30 changed files with 202 additions and 137 deletions
-6
View File
@@ -4,12 +4,6 @@
# Use of this source code is governed by the 3-clause BSD license
# that can be found in the LICENSE file.
#
__title__ = 'babelfish'
__version__ = '0.5.5-dev'
__author__ = 'Antoine Bertin'
__license__ = 'BSD'
__copyright__ = 'Copyright 2015 the BabelFish authors'
import sys
if sys.version_info[0] >= 3:
+10 -7
View File
@@ -2,20 +2,22 @@
# Use of this source code is governed by the 3-clause BSD license
# that can be found in the LICENSE file.
#
import collections
import functools
from importlib import import_module
# from pkg_resources import iter_entry_points, EntryPoint
from ..exceptions import LanguageConvertError, LanguageReverseError
try:
# Python 3.3+
from collections.abc import Mapping, MutableMapping
except ImportError:
from collections import Mapping, MutableMapping
from importlib import import_module
# from https://github.com/kennethreitz/requests/blob/master/requests/structures.py
class CaseInsensitiveDict(collections.MutableMapping):
class CaseInsensitiveDict(MutableMapping):
"""A case-insensitive ``dict``-like object.
Implements all methods and operations of
``collections.MutableMapping`` as well as dict's ``copy``. Also
``collections.abc.MutableMapping`` as well as dict's ``copy``. Also
provides ``lower_items``.
All keys are expected to be strings. The structure remembers the
@@ -66,7 +68,7 @@ class CaseInsensitiveDict(collections.MutableMapping):
)
def __eq__(self, other):
if isinstance(other, collections.Mapping):
if isinstance(other, Mapping):
other = CaseInsensitiveDict(other)
else:
return NotImplemented
@@ -242,6 +244,7 @@ class ConverterManager(object):
# if ep.name == name:
# self.converters[ep.name] = ep.load()()
# return self.converters[ep.name]
def parse(str):
import re
match = re.match('(?P<name>\w+) = (?P<module>[a-z0-9.]+):(?P<class>\w+)', str)
+3 -3
View File
@@ -14,10 +14,10 @@ class OpenSubtitlesConverter(LanguageReverseConverter):
def __init__(self):
self.alpha3b_converter = language_converters['alpha3b']
self.alpha2_converter = language_converters['alpha2']
self.to_opensubtitles = {('por', 'BR'): 'pob', ('gre', None): 'ell', ('srp', None): 'scc', ('srp', 'ME'): 'mne'}
self.to_opensubtitles = {('por', 'BR'): 'pob', ('gre', None): 'ell', ('srp', None): 'scc', ('srp', 'ME'): 'mne', ('chi', 'TW'): 'zht'}
self.from_opensubtitles = CaseInsensitiveDict({'pob': ('por', 'BR'), 'pb': ('por', 'BR'), 'ell': ('ell', None),
'scc': ('srp', None), 'mne': ('srp', 'ME')})
self.codes = (self.alpha2_converter.codes | self.alpha3b_converter.codes | set(['pob', 'pb', 'scc', 'mne']))
'scc': ('srp', None), 'mne': ('srp', 'ME'), 'zht': ('zho', 'TW')})
self.codes = (self.alpha2_converter.codes | self.alpha3b_converter.codes | set(self.from_opensubtitles.keys()))
def convert(self, alpha3, country=None, script=None):
alpha3b = self.alpha3b_converter.convert(alpha3, country, script)
+1 -1
View File
@@ -8,9 +8,9 @@ from __future__ import unicode_literals
from collections import namedtuple
from functools import partial
# from pkg_resources import resource_stream # @UnresolvedImport
import os, io
from .converters import ConverterManager
from . import basestr
import os, io
COUNTRIES = {}
+1 -1
View File
@@ -7,13 +7,13 @@
from __future__ import unicode_literals
from collections import namedtuple
from functools import partial
import os, io
# from pkg_resources import resource_stream # @UnresolvedImport
from .converters import ConverterManager
from .country import Country
from .exceptions import LanguageConvertError
from .script import Script
from . import basestr
import os, io
LANGUAGES = set()
+1 -2
View File
@@ -5,11 +5,10 @@
# that can be found in the LICENSE file.
#
from __future__ import unicode_literals
import os, io
from collections import namedtuple
# from pkg_resources import resource_stream # @UnresolvedImport
from . import basestr
import os, io
#: Script code to script name mapping
SCRIPTS = {}