mirror of https://github.com/devine-dl/devine.git
refactor(Track): Remove TERRITORY_MAP constant, trim SAR China manually
e.g., Hong Kong SAR China, Macao SAR China
This commit is contained in:
parent
4f79550301
commit
f0b589c8a5
|
@ -5,9 +5,6 @@ DOWNLOAD_CANCELLED = Event()
|
||||||
DOWNLOAD_LICENCE_ONLY = Event()
|
DOWNLOAD_LICENCE_ONLY = Event()
|
||||||
|
|
||||||
DRM_SORT_MAP = ["ClearKey", "Widevine"]
|
DRM_SORT_MAP = ["ClearKey", "Widevine"]
|
||||||
TERRITORY_MAP = {
|
|
||||||
"Hong Kong SAR China": "Hong Kong"
|
|
||||||
}
|
|
||||||
LANGUAGE_MAX_DISTANCE = 5 # this is max to be considered "same", e.g., en, en-US, en-AU
|
LANGUAGE_MAX_DISTANCE = 5 # this is max to be considered "same", e.g., en, en-US, en-AU
|
||||||
VIDEO_CODEC_MAP = {
|
VIDEO_CODEC_MAP = {
|
||||||
"AVC": "H.264",
|
"AVC": "H.264",
|
||||||
|
|
|
@ -17,7 +17,7 @@ from langcodes import Language
|
||||||
from requests import Session
|
from requests import Session
|
||||||
|
|
||||||
from devine.core.config import config
|
from devine.core.config import config
|
||||||
from devine.core.constants import DOWNLOAD_CANCELLED, DOWNLOAD_LICENCE_ONLY, TERRITORY_MAP
|
from devine.core.constants import DOWNLOAD_CANCELLED, DOWNLOAD_LICENCE_ONLY
|
||||||
from devine.core.downloaders import aria2c, curl_impersonate, requests
|
from devine.core.downloaders import aria2c, curl_impersonate, requests
|
||||||
from devine.core.drm import DRM_T, Widevine
|
from devine.core.drm import DRM_T, Widevine
|
||||||
from devine.core.utilities import get_binary_path, get_boxes, try_ensure_utf8
|
from devine.core.utilities import get_binary_path, get_boxes, try_ensure_utf8
|
||||||
|
@ -326,7 +326,8 @@ class Track:
|
||||||
simplified_language = self.language.simplify_script()
|
simplified_language = self.language.simplify_script()
|
||||||
script = simplified_language.script_name(max_distance=25)
|
script = simplified_language.script_name(max_distance=25)
|
||||||
territory = simplified_language.territory_name(max_distance=25)
|
territory = simplified_language.territory_name(max_distance=25)
|
||||||
territory = TERRITORY_MAP.get(territory, territory)
|
if territory and territory.endswith(" SAR China"):
|
||||||
|
territory = territory.split(" SAR China")[0]
|
||||||
|
|
||||||
if (script or "").lower() == (territory or "").lower():
|
if (script or "").lower() == (territory or "").lower():
|
||||||
script = None
|
script = None
|
||||||
|
|
Loading…
Reference in New Issue