コード例 #1
0
ファイル: train.py プロジェクト: YuhaoYeSteve/simple_yolov5
def init_logger(work_dir='./work_dir'):
    cur_time = datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S")
    work_dir = os.path.join(work_dir, cur_time.split('_')[0], cur_time)

    mkdir_or_exist(os.path.abspath(work_dir))

    # log
    log_file = os.path.join(work_dir, 'log.log')
    logger = get_root_logger(log_file)
    return logger, work_dir
コード例 #2
0
ファイル: patrol.py プロジェクト: weebo-dev/plex_patrol
#!/usr/bin/env python3
import time
from threading import Thread

from utils import config
from utils import logger
from utils.plex import Plex

log = logger.get_root_logger()
server = None
watchlist = []
ip_watchlist = {}

# ip watchlist stuff


def check_stream_count(user):
    if user in ip_watchlist:
        return len(ip_watchlist[user])
    else:
        return 0


def add_stream_ip(user, ip):
    if user in ip_watchlist:
        # does ip exist
        if ip in ip_watchlist[user]:
            log.debug(
                "Skipping adding ip %s to watchlist for user %s because it is already in there!",
                ip, user)
            return