def __format__(self, format_spec): default = "{series} - {season:02}x{episode:02} - {title}" re_pattern = r"({(\w+)(?:\[[\w:]+\])?(?:\:\d{1,2})?})" s = re.sub(re_pattern, self._format_repl, format_spec or default) s = str_fix_padding(s) return s
def __format__(self, format_spec): default = "{name} ({year})" re_pattern = r"({(\w+)(?:\[[\w:]+\])?(?:\:\d{1,2})?})" s = re.sub(re_pattern, self._format_repl, format_spec or default) s = str_fix_padding(s) return s