Module hdrezka.post.urls.kind.quality
High-level representation of video quality
Classes
class Quality (val: str)-
Expand source code
class Quality(str): """str type add-on to represent video quality""" __slots__ = ('_i', 'addon', 'units') def __new__(cls, val: str): clean_val = _clean_html('', val).strip() # noinspection PyTypeChecker return super().__new__(cls, clean_val) def __init__(self, val: str): match = _match_quality_int(self) if not match: raise ValueError(f'{val!r} is unknown quality.') _i, units, self.addon = match.groups() _i = _i or '0' if units.upper() == 'K': _i += '000' units = 'p' self.addon = self.addon.casefold() self._i = int(_i) self.units = units def __int__(self): """ returns pixels height """ return self._i def __lt__(self, other): """Is other quality better then self""" if not isinstance(other, self.__class__): return super().__le__(other) if self._i != other._i: return self._i < other._i return not self.addon and bool(other.addon)str type add-on to represent video quality
Ancestors
- builtins.str
Instance variables
var addon-
Expand source code
class Quality(str): """str type add-on to represent video quality""" __slots__ = ('_i', 'addon', 'units') def __new__(cls, val: str): clean_val = _clean_html('', val).strip() # noinspection PyTypeChecker return super().__new__(cls, clean_val) def __init__(self, val: str): match = _match_quality_int(self) if not match: raise ValueError(f'{val!r} is unknown quality.') _i, units, self.addon = match.groups() _i = _i or '0' if units.upper() == 'K': _i += '000' units = 'p' self.addon = self.addon.casefold() self._i = int(_i) self.units = units def __int__(self): """ returns pixels height """ return self._i def __lt__(self, other): """Is other quality better then self""" if not isinstance(other, self.__class__): return super().__le__(other) if self._i != other._i: return self._i < other._i return not self.addon and bool(other.addon) var units-
Expand source code
class Quality(str): """str type add-on to represent video quality""" __slots__ = ('_i', 'addon', 'units') def __new__(cls, val: str): clean_val = _clean_html('', val).strip() # noinspection PyTypeChecker return super().__new__(cls, clean_val) def __init__(self, val: str): match = _match_quality_int(self) if not match: raise ValueError(f'{val!r} is unknown quality.') _i, units, self.addon = match.groups() _i = _i or '0' if units.upper() == 'K': _i += '000' units = 'p' self.addon = self.addon.casefold() self._i = int(_i) self.units = units def __int__(self): """ returns pixels height """ return self._i def __lt__(self, other): """Is other quality better then self""" if not isinstance(other, self.__class__): return super().__le__(other) if self._i != other._i: return self._i < other._i return not self.addon and bool(other.addon)