Пример #1
0
        WIuvlCgz6f8DOZtdDw==
    """,
}
t1utils.resources_check(script_path, resources)

GLOBALS = globals()
MIN_FREE_SPACE = GLOBALS.get("MIN_FREE_SPACE", 500)
FOLDER = GLOBALS.get("FOLDER", "")
CHECK_INTERVAL = GLOBALS.get("CHECK_INTERVAL", 1)
FILE_AGE = GLOBALS.get("FILE_AGE", 10)
FILTER_EXT = GLOBALS.get("FILTER_EXT", "")
DEBUG = GLOBALS.get("DEBUG", False)

import helpers

helpers.set_script_name()
logger = helpers.init_logger("folder_cleaner", debug=DEBUG)

logger.debug(
    "script started with params folder:%s, free space(Mb):%s, check interval(min):%s, file age(days):%s, "
    "filter ext: %s",
    FOLDER,
    MIN_FREE_SPACE,
    CHECK_INTERVAL,
    FILE_AGE,
    FILTER_EXT,
)

import psutil
import time
import os
Пример #2
0
SIGNAL_LOST_ENABLE = GLOBALS.get("SIGNAL_LOST_ENABLE", True)
SIGNAL_LOST_TIMEOUT = GLOBALS.get("SIGNAL_LOST_TIMEOUT", 5)

SCHEDULE_REBOOT_ENABLE = GLOBALS.get("SCHEDULE_REBOOT_ENABLE", False)
SCHEDULE_NAME = GLOBALS.get("SCHEDULE_NAME", "")

DEBUG = GLOBALS.get("DEBUG", False)

APP_NAME = "DeviceAutoReboot"

import time
import host
import helpers

default_script_name = helpers.set_script_name()
logger = helpers.init_logger(APP_NAME, debug=DEBUG)

from schedule import ScheduleObject
from long_event_handler import LongEventHandler

logger.info("Starting script %s (%s)", default_script_name, __name__)
logger.debug("DEVICES='%s'", DEVICES)
logger.debug("SIGNAL_LOST_ENABLE=%s", SIGNAL_LOST_ENABLE)
logger.debug("SIGNAL_LOST_TIMEOUT=%s", SIGNAL_LOST_TIMEOUT)
logger.debug("SCHEDULE_REBOOT_ENABLE=%s", SCHEDULE_REBOOT_ENABLE)
logger.debug("SCHEDULE_NAME='%s'", SCHEDULE_NAME)

_ip_cameras = host.settings("ip_cameras")
_channels = host.settings("channels")
    from host import service_create_person_folder
except ImportError:
    raise RuntimeError("You need to update Trassir")

GLOBALS = globals()

DEBUG = GLOBALS.get("DEBUG", False)
TYPE_OF_WORK = GLOBALS.get("TYPE_OF_WORK", "export")
DELETE_PERSONS = GLOBALS.get("DELETE_PERSONS", False)
UPDATE_SAME_PERSON = GLOBALS.get("UPDATE_SAME_PERSON", False)
FOLDER = GLOBALS.get("FOLDER", "{path}/face_from_folder")

IMPORT_FOLDER = FOLDER.format(
    path=host.settings("system_wide_options")["screenshots_folder"])

set_script_name("Face from folder")
logger = init_logger(name=host.stats().parent().name, debug=DEBUG)

engine = host.get_database_connection()
Session = sessionmaker(bind=engine)
session = Session()
Base = declarative_base()


class PersonImage(Base):
    __tablename__ = "persons_images_t"
    person_guid = Column(String(8))
    image_guid = Column(String(8),
                        primary_key=True,
                        nullable=False,
                        unique=True)
Пример #4
0
t1utils.resources_check(script_path, resources)

import time
from __builtin__ import object
from helpers import init_logger, set_script_name
import host

GLOBALS = globals()
DEBUG = GLOBALS.get("DEBUG", False)
DELAY_BEFORE_ENABLE_BACKUP_DEVICES = GLOBALS.get(
    "DELAY_BEFORE_ENABLE_BACKUP_DEVICES", 10)
logger = init_logger(name=host.stats().parent().name, debug=DEBUG)

logger.info(
    "SCRIPT START. Script info: %s, pc id %s, pc name: %s",
    set_script_name(),
    host.settings("").guid,
    host.settings("").name,
)


class TRObject(object):
    def __init__(self, sett):
        self.sett = sett

    def __getattr__(self, name):
        return getattr(self.sett, name)


class ServerObj(TRObject):
    def __init__(self, sett):