2024-06-12 02:17:37 +00:00
|
|
|
import argparse
|
2023-06-27 15:38:30 +00:00
|
|
|
import logging
|
2023-06-09 12:41:53 +00:00
|
|
|
|
2023-12-02 08:14:36 +00:00
|
|
|
from .crawler_util import *
|
|
|
|
from .slider_util import *
|
|
|
|
from .time_util import *
|
2023-06-27 15:38:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
def init_loging_config():
|
|
|
|
level = logging.INFO
|
|
|
|
logging.basicConfig(
|
|
|
|
level=level,
|
2024-04-27 04:11:42 +00:00
|
|
|
format="%(asctime)s [%(threadName)s] %(name)s %(levelname)s (%(filename)s:%(lineno)d) - %(message)s",
|
|
|
|
datefmt='%Y-%m-%d %H:%M:%S'
|
2023-06-27 15:38:30 +00:00
|
|
|
)
|
2023-07-15 13:30:12 +00:00
|
|
|
_logger = logging.getLogger("MediaCrawler")
|
|
|
|
_logger.setLevel(level)
|
|
|
|
return _logger
|
|
|
|
|
|
|
|
|
|
|
|
logger = init_loging_config()
|
2024-06-12 02:17:37 +00:00
|
|
|
|
|
|
|
def str2bool(v):
|
|
|
|
if isinstance(v, bool):
|
|
|
|
return v
|
|
|
|
if v.lower() in ('yes', 'true', 't', 'y', '1'):
|
|
|
|
return True
|
|
|
|
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
|
|
|
|
return False
|
|
|
|
else:
|
|
|
|
raise argparse.ArgumentTypeError('Boolean value expected.')
|