mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-12 20:15:10 +00:00
remove(tracks): Remove specific service features (#174)
This commit is contained in:
@@ -45,6 +45,7 @@ class Audio(Track):
|
||||
ALAC = "ALAC" # https://en.wikipedia.org/wiki/Apple_Lossless_Audio_Codec
|
||||
FLAC = "FLAC" # https://en.wikipedia.org/wiki/FLAC
|
||||
MP3 = "MP3" # https://en.wikipedia.org/wiki/MP3
|
||||
PCM = "PCM" # https://en.wikipedia.org/wiki/Pulse-code_modulation
|
||||
|
||||
@property
|
||||
def extension(self) -> str:
|
||||
@@ -87,21 +88,6 @@ class Audio(Track):
|
||||
pass
|
||||
raise ValueError(f"No MIME types matched any supported Audio Codecs in '{codecs}'")
|
||||
|
||||
@staticmethod
|
||||
def from_netflix_profile(profile: str) -> Audio.Codec:
|
||||
profile = profile.lower().strip()
|
||||
if profile.startswith("heaac") or profile.startswith("xheaac"):
|
||||
return Audio.Codec.AAC
|
||||
if profile.startswith("dd-"):
|
||||
return Audio.Codec.AC3
|
||||
if profile.startswith("ddplus"):
|
||||
return Audio.Codec.EC3
|
||||
if profile.startswith("ac4"):
|
||||
return Audio.Codec.AC4
|
||||
if profile.startswith("playready-oggvorbis"):
|
||||
return Audio.Codec.OGG
|
||||
raise ValueError(f"The Content Profile '{profile}' is not a supported Audio Codec")
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*args: Any,
|
||||
|
||||
@@ -89,15 +89,6 @@ class Subtitle(Track):
|
||||
pass
|
||||
raise ValueError(f"No MIME types matched any supported Subtitle Codecs in '{codecs}'")
|
||||
|
||||
@staticmethod
|
||||
def from_netflix_profile(profile: str) -> Subtitle.Codec:
|
||||
profile = profile.lower().strip()
|
||||
if profile.startswith("webvtt"):
|
||||
return Subtitle.Codec.WebVTT
|
||||
if profile.startswith("dfxp"):
|
||||
return Subtitle.Codec.TimedTextMarkupLang
|
||||
raise ValueError(f"The Content Profile '{profile}' is not a supported Subtitle Codec")
|
||||
|
||||
# WebVTT sanitization patterns (compiled once for performance)
|
||||
CUE_ID_PATTERN = re.compile(r"^[A-Za-z]+\d+$")
|
||||
TIMING_START_PATTERN = re.compile(r"^\d+:\d+[:\.]")
|
||||
|
||||
@@ -27,6 +27,7 @@ class Video(Track):
|
||||
class Codec(str, Enum):
|
||||
AVC = "H.264"
|
||||
HEVC = "H.265"
|
||||
VVC = "H.266"
|
||||
VC1 = "VC-1"
|
||||
VP8 = "VP8"
|
||||
VP9 = "VP9"
|
||||
@@ -84,19 +85,6 @@ class Video(Track):
|
||||
pass
|
||||
raise ValueError(f"No MIME types matched any supported Video Codecs in '{codecs}'")
|
||||
|
||||
@staticmethod
|
||||
def from_netflix_profile(profile: str) -> Video.Codec:
|
||||
profile = profile.lower().strip()
|
||||
if profile.startswith(("h264", "playready-h264")):
|
||||
return Video.Codec.AVC
|
||||
if profile.startswith("hevc"):
|
||||
return Video.Codec.HEVC
|
||||
if profile.startswith("vp9"):
|
||||
return Video.Codec.VP9
|
||||
if profile.startswith("av1"):
|
||||
return Video.Codec.AV1
|
||||
raise ValueError(f"The Content Profile '{profile}' is not a supported Video Codec")
|
||||
|
||||
class Range(str, Enum):
|
||||
SDR = "SDR" # No Dynamic Range
|
||||
HLG = "HLG" # https://en.wikipedia.org/wiki/Hybrid_log%E2%80%93gamma
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
log = logging.getLogger("NF-ESN")
|
||||
|
||||
|
||||
def chrome_esn_generator() -> str:
|
||||
ESN_GEN = "".join(random.choice("0123456789ABCDEF") for _ in range(30))
|
||||
esn_file = ".esn"
|
||||
|
||||
def gen_file() -> None:
|
||||
with open(esn_file, "w") as file:
|
||||
file.write(f"NFCDIE-03-{ESN_GEN}")
|
||||
|
||||
if not os.path.isfile(esn_file):
|
||||
log.warning("Generating a new Chrome ESN")
|
||||
gen_file()
|
||||
|
||||
file_datetime = datetime.fromtimestamp(os.path.getmtime(esn_file))
|
||||
time_diff = datetime.now() - file_datetime
|
||||
if time_diff > timedelta(hours=6):
|
||||
log.warning("Old ESN detected, Generating a new Chrome ESN")
|
||||
gen_file()
|
||||
|
||||
with open(esn_file, "r") as f:
|
||||
esn = f.read()
|
||||
|
||||
return esn
|
||||
Reference in New Issue
Block a user