diff --git a/channels/ilcorsaronero.py b/channels/ilcorsaronero.py index 301aa75a..a2f32e5e 100644 --- a/channels/ilcorsaronero.py +++ b/channels/ilcorsaronero.py @@ -56,7 +56,7 @@ def peliculas(item): def itemHook(item): if not sceneTitle: item.title = item.title.replace('_', ' ') - item.title = support.urlparse.unquote(item.title) + item.title = support.scrapertools.decodeHtmlentities(support.urlparse.unquote(item.title)) return item if 'search' not in item.args: diff --git a/lib/babelfish/country.py b/lib/babelfish/country.py index 4c24b52b..2c6a2a45 100755 --- a/lib/babelfish/country.py +++ b/lib/babelfish/country.py @@ -7,9 +7,10 @@ from __future__ import unicode_literals from collections import namedtuple from functools import partial -from pkg_resources import resource_stream # @UnresolvedImport +# from pkg_resources import resource_stream # @UnresolvedImport from .converters import ConverterManager from . import basestr +import os, io COUNTRIES = {} @@ -18,10 +19,10 @@ COUNTRY_MATRIX = [] #: The namedtuple used in the :data:`COUNTRY_MATRIX` IsoCountry = namedtuple('IsoCountry', ['name', 'alpha2']) -f = resource_stream('babelfish', 'data/iso-3166-1.txt') +f = io.open(os.path.join(os.path.dirname(__file__), 'data/iso-3166-1.txt'), encoding='utf-8') f.readline() for l in f: - iso_country = IsoCountry(*l.decode('utf-8').strip().split(';')) + iso_country = IsoCountry(*l.strip().split(';')) COUNTRIES[iso_country.alpha2] = iso_country.name COUNTRY_MATRIX.append(iso_country) f.close() diff --git a/lib/babelfish/language.py b/lib/babelfish/language.py index b4b25193..bcee8e50 100755 --- a/lib/babelfish/language.py +++ b/lib/babelfish/language.py @@ -7,12 +7,13 @@ from __future__ import unicode_literals from collections import namedtuple from functools import partial -from pkg_resources import resource_stream # @UnresolvedImport +# 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() @@ -21,10 +22,10 @@ LANGUAGE_MATRIX = [] #: The namedtuple used in the :data:`LANGUAGE_MATRIX` IsoLanguage = namedtuple('IsoLanguage', ['alpha3', 'alpha3b', 'alpha3t', 'alpha2', 'scope', 'type', 'name', 'comment']) -f = resource_stream('babelfish', 'data/iso-639-3.tab') +f = io.open(os.path.join(os.path.dirname(__file__), 'data/iso-639-3.tab'), encoding='utf-8') f.readline() for l in f: - iso_language = IsoLanguage(*l.decode('utf-8').split('\t')) + iso_language = IsoLanguage(*l.split('\t')) LANGUAGES.add(iso_language.alpha3) LANGUAGE_MATRIX.append(iso_language) f.close() diff --git a/lib/babelfish/script.py b/lib/babelfish/script.py index 4b59ce01..5f484f43 100755 --- a/lib/babelfish/script.py +++ b/lib/babelfish/script.py @@ -6,8 +6,9 @@ # from __future__ import unicode_literals from collections import namedtuple -from pkg_resources import resource_stream # @UnresolvedImport +# from pkg_resources import resource_stream # @UnresolvedImport from . import basestr +import os, io #: Script code to script name mapping SCRIPTS = {} @@ -18,10 +19,10 @@ SCRIPT_MATRIX = [] #: The namedtuple used in the :data:`SCRIPT_MATRIX` IsoScript = namedtuple('IsoScript', ['code', 'number', 'name', 'french_name', 'pva', 'date']) -f = resource_stream('babelfish', 'data/iso15924-utf8-20131012.txt') +f = io.open(os.path.join(os.path.dirname(__file__), 'data/iso15924-utf8-20131012.txt'), encoding='utf-8') f.readline() for l in f: - l = l.decode('utf-8').strip() + l = l.strip() if not l or l.startswith('#'): continue script = IsoScript._make(l.split(';'))