2018-02-27 00:06:15 +01:00
|
|
|
from functools import wraps
|
2018-03-04 04:08:20 +01:00
|
|
|
from urllib.parse import urlsplit, urlunsplit, parse_qs, urlencode
|
2018-02-26 22:55:01 +01:00
|
|
|
import threading
|
|
|
|
import youtube_dl
|
|
|
|
|
|
|
|
class Namespace(object): pass
|
|
|
|
|
2018-03-04 04:08:20 +01:00
|
|
|
def seconds_to_timestamp(s):
|
|
|
|
return "%i:%.2i" % (s//60, s%60)
|
2018-02-26 22:55:01 +01:00
|
|
|
|
|
|
|
# decorator:
|
2018-02-27 00:06:15 +01:00
|
|
|
def call_as_thread(func): # This will discard any return value!
|
|
|
|
@wraps(func)
|
2018-02-26 22:55:01 +01:00
|
|
|
def new_func(*args, **kwargs):
|
|
|
|
threading.Thread(
|
|
|
|
target = func,
|
|
|
|
args = args,
|
|
|
|
kwargs = kwargs
|
|
|
|
).start()
|
|
|
|
return new_func
|