# Path: core/config.py
# def full_path(path_to_config):
# def _import(filename):
# def create_if_not_exist(directory):
#     def update(self, new_values):
# def setup_config(path_to_config):
# class Config(object):
# 
# Path: core/utils/network_utils.py
# def get_free_port():
#     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#     s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
#     s.bind(('', 0))
#     port = s.getsockname()[1]
#     s.close()
#     return port
# 
# Path: core/exceptions.py
# class VNCProxyException(Exception):
#     pass


import os
import sys
import time
import signal
import logging
import os.path
import websockify
import multiprocessing
from core.config import config
from vnc2flv import flv, rfb, video
from core.utils.network_utils import get_free_port
from core.exceptions import VNCProxyException
            kwargs=kwargs,
            name="{}.recorder".format(__name__)
        )
        self.recorder.daemon = True
        self.recorder.start()
        log.info(
            "Started screencast recording(pid:{}) for {}:{} to {}".format(
                self.recorder.pid, self.host, self.port, self.dir_path
            )
        )

    def stop_recording(self):
        if self.recorder and self.recorder.is_alive():
            self.recorder.terminate()
            log.info(
                "Stopped screencast recording(pid:{}) for {}:{} to {}".format(
                    self.recorder.pid, self.host, self.port, self.dir_path
                )
            )

    def is_alive(self):
        if self.recorder:
            return self.recorder.is_alive()
        return False

    def stop(self):
        self.stop_recording()


def start_vnc_proxy(vnc_server_host, vnc_server_port=5900):

# Path: core/config.py
# def full_path(path_to_config):
# def _import(filename):
# def create_if_not_exist(directory):
#     def update(self, new_values):
# def setup_config(path_to_config):
# class Config(object):
# 
# Path: core/utils/network_utils.py
# def get_free_port():
#     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#     s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
#     s.bind(('', 0))
#     port = s.getsockname()[1]
#     s.close()
#     return port
# 
# Path: core/exceptions.py
# class VNCProxyException(Exception):
#     pass


# Path: core/video.py
import os
import sys
import time
import signal
import logging
import os.path
import websockify
import multiprocessing
from core.config import config
from vnc2flv import flv, rfb, video
from core.utils.network_utils import get_free_port
from core.exceptions import VNCProxyException

            kwargs=kwargs,
            name="{}.recorder".format(__name__)
        )
        self.recorder.daemon = True
        self.recorder.start()
        log.info(
            "Started screencast recording(pid:{}) for {}:{} to {}".format(
                self.recorder.pid, self.host, self.port, self.dir_path
            )
        )

    def stop_recording(self):
        if self.recorder and self.recorder.is_alive():
            self.recorder.terminate()
            log.info(
                "Stopped screencast recording(pid:{}) for {}:{} to {}".format(
                    self.recorder.pid, self.host, self.port, self.dir_path
                )
            )

    def is_alive(self):
        if self.recorder:
            return self.recorder.is_alive()
        return False

    def stop(self):
        self.stop_recording()


def start_vnc_proxy(vnc_server_host, vnc_server_port=5900):

    port = get_free_port()