def __init__(self, args): """Initialization method of :class:`t_system.accession.NetworkConnector` class. Args: args: Command-line arguments. """ self.folder = f'{dot_t_system_dir}/network' if not os.path.exists(self.folder): os.mkdir(self.folder) self.login_table = DBFetcher(self.folder, "db", "login").fetch() self.status_table = DBFetcher(self.folder, "db", "status").fetch() self.activity = None self.__refresh_status() self.wpa_supplicant = WpaSupplicant(args) self.wlan = args["wlan"] self.interface_ec = 0 self.current_cells = [] self.current_available_networks = [] self.known_networks = [] if args["static_ip"]: set_local_ip_address(args["wlan"], args["static_ip"]) if self.activity: self.scan() self.__set_available_networks() self.__refresh_known_networks()
def __init__(self): """Initialization method of :class:`t_system.motion.action.ActionManager` class. """ db_folder = f'{T_SYSTEM_PATH}/motion/action' self.predicted_db_name = 'predicted_missions' self.predicted_scenarios_table = DBFetcher(db_folder, self.predicted_db_name, "scenarios", 30).fetch() self.predicted_positions_table = DBFetcher(db_folder, self.predicted_db_name, "positions", 30).fetch() db_folder = dot_t_system_dir self.db_name = 'missions' self.scenarios_table = DBFetcher(db_folder, self.db_name, "scenarios").fetch() self.positions_table = DBFetcher(db_folder, self.db_name, "positions").fetch() self.predicted_positions = [] self.predicted_scenarios = [] self.positions = [] self.scenarios = [] self.refresh_members() self.actor = Actor()
def __get_db(self, db_folder, db_name, cache_size=30): """Function to set the database of the position. Args: db_folder (str): Containing folder of the database file db_name (str): Database of the position abject. cache_size (int): TinyDB caches query result for performance. """ if self.is_for_scenario: return DBFetcher(db_folder, db_name, "scenarios", cache_size).fetch() else: return DBFetcher(db_folder, db_name, "positions", cache_size).fetch()
def get_db_table(root, db_name): """Method to set work database by root. Args: root (bool): Root privileges flag. db_name (str): Name of the registered Database. It uses if administration privileges activated. """ table = "scenarios" if root: db_folder = f'{T_SYSTEM_PATH}/motion/action' return DBFetcher(db_folder, db_name, table).fetch() else: db_folder = dot_t_system_dir db_name = 'missions' return DBFetcher(db_folder, db_name, table).fetch()
def __init__(self): """Initialization method of :class:`t_system.recordation.RecordManager` class. """ self.records_folder = f'{dot_t_system_dir}/records' self.__check_folders() self.shoots_table = DBFetcher(self.records_folder, "db", "shoots").fetch() self.shot_table = DBFetcher(self.records_folder, "db", "shots").fetch() self.shoots = [] self.shots = [] self.__set_records()
def __init__(self): """Initialization method of :class:`t_system.motion.action.EmotionManager` class. """ db_folder = f'{T_SYSTEM_PATH}/motion/action' self.db_name = 'emotions' self.scenarios_table = DBFetcher(db_folder, self.db_name, "scenarios", 30).fetch() self.positions_table = DBFetcher(db_folder, self.db_name, "positions", 30).fetch() self.positions = [] self.scenarios = [] self.__refresh_members() self.actor = Actor()
def __init__(self, to_be_used=False, accounts=None, active_account=None): """Initialization method of :class:`t_system.r_sync.DropBox` class. Args: to_be_used (bool): To be used flag that specify usage status of service on folder synchronization. accounts: DropBox account owner name and account API key list. active_account: hexadecimal stream key that use in current stream of the website. """ self.accounts = accounts if not accounts: self.accounts = [] self.active_account = active_account if not active_account: self.active_account = {} self.name = "Dropbox" self.to_be_used = to_be_used self.dbx = None self.folder = f'{dot_t_system_dir}/r_sync' self.sync_sou_dir = f'{dot_t_system_dir}/records' self.sync_tar_dir = "Media-from-T_System" self.table = DBFetcher(self.folder, "db", "services").fetch() self.__db_upsert()
def __init__(self, args): """Initialization method of :class:`t_system.accession.NetworkManager` class. Args: args: Command-line arguments. """ self.folder = dot_t_system_dir + "/network" if not os.path.exists(self.folder): os.mkdir(self.folder) self.table = DBFetcher(self.folder, "db", "login").fetch() self.wpa_supplicant = WpaSupplicant(args) self.wlan = args["wlan"] self.current_cells = [] self.current_available_networks = [] self.known_networks = [] set_local_ip_address(args["wlan"], args["static_ip"]) self.scan() self.set_available_networks() self.refresh_known_networks()
def __init__(self, camera, hearer): """Initialization method of :class:`t_system.online_stream.OnlineStream` class. Args: camera: Camera object from PiCamera. hearer: Hearer object. """ self.folder = f'{dot_t_system_dir}/streaming' self.__check_folders() self.websites_table = DBFetcher(self.folder, "db", "websites").fetch() self.websites = [] self.stream_pipes = [] self.streamer_config_file = f'{T_SYSTEM_PATH}/online_stream/config.json' self.__set_websites() if not self.websites: self.__create_websites() self.camera = camera self.hearer = hearer
def __init__(self, name, id=None): """Initialization method of :class:`t_system.face_encoder.Face` class. Args: name (str): The name of the man who has face in dataset. id (str): The id of the face. """ self.name = name self.id = id self.id = id if not id: self.id = str(uuid.uuid1()) self.recognition_folder = f'{dot_t_system_dir}/recognition' self.dataset_folder = f'{self.recognition_folder}/dataset/{self.name}' self.pickle_file = f'{self.recognition_folder}/encodings/{self.name}_encoding.pickle' self.__check_folders() self.table = DBFetcher(self.recognition_folder, "db", "faces").fetch() self.image_names = [] self.refresh_image_names() self.__db_upsert()
def __get_db(db_folder, db_name, cache_size=None): """Function to set the database of the scenario. Args: db_folder (str): Containing folder of the database file db_name (str): Database file of the scenario abject. cache_size (int): TinyDB caches query result for performance. """ return DBFetcher(db_folder, db_name, "scenarios", cache_size).fetch()
def __init__(self): """Initialization method of :class:`t_system.r_sync.RSynchronizer` class. """ self.folder = f'{dot_t_system_dir}/r_sync' self.__check_folders() self.services_table = DBFetcher(self.folder, "db", "services").fetch() self.status_table = DBFetcher(self.folder, "db", "status").fetch() self.services = [] self.auto_sync = None self.__set_services() self.__refresh_status() if not self.services: self.__create_services()
def __init__(self): """Initialization method of :class:`t_system.administration.Identifier` class. """ self.table = DBFetcher(dot_t_system_dir, "db", "identity").fetch() self.public_id = None self.private_id = None self.name = None self.__get_keys()
def __init__(self): """Initialization method of :class:`t_system.administration.Administrator` class. """ self.table = DBFetcher(dot_t_system_dir, "db", "admin").fetch() self.ssid_hash = None self.password_hash = None self.private_key = None self.get_keys()
def __init__(self, name, url, server, to_be_used=False, stream_ids=None, active_stream_id=None, id=None): """Initialization method of :class:`t_system.online_stream.OnlineStream` class. Args: name: Name of the WebSite. youtube, facebook etc. url: Website's page URL. server: Website's Live stream server RTMP URL. to_be_used (bool): To be used flag that specify usage status of website on live stream. stream_ids: hexadecimal stream keys of the website. active_stream_id: hexadecimal stream key that use in current stream of the website. id: Unique ID of the website. """ self.id = id if not id: self.id = str(uuid.uuid1()) self.stream_ids = stream_ids if not stream_ids: self.stream_ids = [] self.active_stream_id = active_stream_id if not active_stream_id: self.active_stream_id = {} self.name = name self.url = url self.server = server self.to_be_used = to_be_used self.streaming_folder = f'{dot_t_system_dir}/streaming' self.keys_folder = f'{self.streaming_folder}/keys' self.parent_folder = f'{self.streaming_folder}/websites' self.folder = f'{self.parent_folder}/{self.name}' self.key_file = f'{self.keys_folder}/{self.name}.key' self.__check_folders() self.table = DBFetcher(self.streaming_folder, "db", "websites").fetch() self.__db_upsert()
def __init__(self, d_m_y, h_m_s, scope, record_formats, id=None, name=None, length=None): """Initialization method of :class:`t_system.recordation.Record` class. Args: d_m_y (str): Date that is day_mount_year format. h_m_s (str): Date that is hour_minute_second format. scope (str): The working type during recording. record_formats (dict): Formats of the records for video, audio and merged. id (str): The id of the record. name (str): The name of the record. length (str): The length of the record as m:s. """ self.id = id if not id: self.id = str(uuid.uuid1()) self.name = name if not name: self.name = h_m_s self.date = d_m_y # table name at the same time self.time = h_m_s self.scope = scope self.record_formats = record_formats self.length = length self.records_folder = f'{dot_t_system_dir}/records' self.parent_folder = f'{self.records_folder}/{self.date}' self.folder = f'{self.parent_folder}/{self.time}' self.video_file = f'{self.folder}/{self.time}.{self.record_formats["video"]}' self.audio_file = f'{self.folder}/{self.time}.{self.record_formats["audio"]}' self.merged_file = f'{self.folder}/{self.time}.{self.record_formats["merged"]}' self.db = DBFetcher(self.records_folder, "db").fetch() self.__check_folders() if length is None: self.length = self.__calc_length() self.__db_upsert()
def __init__(self): """Initialization method of :class:`t_system.recordation.RecordManager` class. """ self.records_folder = f'{dot_t_system_dir}/records' if not os.path.exists(self.records_folder): os.mkdir(self.records_folder) self.db = DBFetcher(self.records_folder, "db").fetch() self.records = [] self.__set_records()
def __init__(self, editable=False, verbose=False): """Initialization method of :class:`t_system.updation.UpdateManager` class. Args: editable: Editable updation mode flag. For making updates as development. verbose: Verbosity flag about printing debug messages. """ self.editable = editable self.verbose = verbose # this argument will be added. self.table = DBFetcher(dot_t_system_dir, "db", "update").fetch() self.auto_update = None self.refresh_members() self.updater = Updater(self.verbose) self.installer = Installer(self.editable, self.verbose)
def __init__(self): """Initialization method of :class:`t_system.motion.arm.modelisation.ArmModeler` class. """ self.name = None self.config_file = f'{T_SYSTEM_PATH}/motion/arm/config.json' self.db = DBFetcher(f'{T_SYSTEM_PATH}/motion/arm', "model").fetch() self.joint_count = 0 self.alpha = None self.a = None self.q = None self.d = None self.dh_params = {} self.tf_matrices = [] self.jacobian_matrix = None
def __init__(self, detection_method="hog"): """Initialization method of :class:`t_system.face_encoding.FaceEncodeManager` class. Args: detection_method (str): face detection model """ self.detection_method = detection_method # either `hog` or `cnn` self.recognition_folder = f'{dot_t_system_dir}/recognition' self.encodings_folder = f'{self.recognition_folder}/encodings' self.dataset_folder = f'{self.recognition_folder}/dataset' self.main_encoding_file = f'{self.recognition_folder}/main_encoding.pickle' self.__check_folders() self.table = DBFetcher(self.recognition_folder, "db", "faces").fetch() self.face_encoder = FaceEncoder(detection_method) self.faces = [] self.__refresh_faces()
def __init__(self, d_m_y, h_m_s, shot_format, id=None, name=None, size=None): """Initialization method of :class:`t_system.recordation.Record` class. Args: d_m_y (str): Date that is day_mount_year format. h_m_s (str): Date that is hour_minute_second format. shot_format (str): Format of the shot. (jpg, png etc.) id (str): The id of the record. name (str): The name of the record. size (str): The length of the record as m:s. """ self.id = id if not id: self.id = str(uuid.uuid1()) self.name = name if not name: self.name = h_m_s self.date = d_m_y # table name at the same time self.time = h_m_s self.shot_format = shot_format self.size = size self.records_folder = f'{dot_t_system_dir}/records' self.parent_folder = f'{self.records_folder}/{self.date}' self.folder = f'{self.parent_folder}/{self.time}' self.shot_file = f'{self.folder}/{self.time}.{self.shot_format}' self.table = DBFetcher(self.records_folder, "db", "shots").fetch() self.__check_folders() if size is None: self.size = self.__calc_size() self.__db_upsert()
def get_db_table(): """Method to get work database. """ db_folder = f'{dot_t_system_dir}/network' return DBFetcher(db_folder, "db", "login").fetch()