[~] Refactor
This commit is contained in:
parent
43985cd5b0
commit
c4944ede7f
@ -22,7 +22,8 @@ import sys
|
||||
import tempfile
|
||||
import time
|
||||
import traceback
|
||||
from typing import (Literal, Optional, Iterable,)
|
||||
|
||||
from typing import (Literal, Optional, Iterable, TypedDict, Callable, Any,)
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -1695,7 +1696,7 @@ def pm_service(argv):
|
||||
|
||||
print('')
|
||||
|
||||
def scrap_yt_music(argv: Iterable[str]) -> None:
|
||||
def scrap_yt_music(argv: list[str]) -> None:
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option(
|
||||
'--verbose',
|
||||
@ -1817,7 +1818,15 @@ def scrap_yt_music(argv: Iterable[str]) -> None:
|
||||
if not p is None:
|
||||
p.terminate()
|
||||
|
||||
context = dict(
|
||||
class Context(TypedDict):
|
||||
http_on_event: Callable[..., None]
|
||||
shutdown: bool
|
||||
workers: list[threading.Thread]
|
||||
track_cv: threading.Condition
|
||||
main_cv: threading.Condition
|
||||
track_name: Optional[str]
|
||||
|
||||
context: Context = dict(
|
||||
http_on_event=lambda *args, **kwargs: None,
|
||||
shutdown=False,
|
||||
workers=[],
|
||||
@ -3452,10 +3461,12 @@ def media_keys(argv):
|
||||
def mocp_info() -> str:
|
||||
t1 = subprocess.check_output(['mocp', '-i'])
|
||||
t3 = t1.decode('utf-8')
|
||||
t2 = dict([
|
||||
tuple(o.split(':')[:2])
|
||||
t2 : dict[str, str] = dict([
|
||||
(lambda o2: (o2[0], o2[1]))(o.split(':'))
|
||||
#tuple(o.split(':')[:2])
|
||||
for o in t3.splitlines()
|
||||
])
|
||||
|
||||
return t2['Title'].strip()[:128]
|
||||
|
||||
if is_mocp():
|
||||
|
Loading…
Reference in New Issue
Block a user