# along with this program. If not, see <https://www.gnu.org/licenses/>. import os import argparse import sys import math import pandas as pd import logging sys.path.append(os.path.join(os.path.dirname(__file__), "..")) import lib.log as log from lib.cmd_utils import ParallelRunner from lib.ffmpeg import get_segment_info logger = log.setup_custom_logger("main") # REFERENCE_BITRATE was arbitrarily chosen in order to get a maximum difficulty of around 10 REFERENCE_BITRATE = 2.75 # define thresholds for difficulty classes [~30fps, ~60fps] DIFFICULTY_CLASS_THRESHOLDS = [[6, 4], [7, 6], [8, 8]] class Segment: """ Fake segment class to allow calls to get_segment_info """ def __init__(self, path): self.filename = "random"
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. import os import sys import logging import lib.test_config as cfg import lib.parse_args as parse_args import lib.log as log import lib.check_requirements as check_requirements import lib.cmd_utils as cmd_utils import lib.ffmpeg as ffmpeg logger = log.setup_custom_logger('main') def run(cli_args, test_config=None): if not test_config: test_config = cfg.TestConfig(cli_args.test_config, cli_args.filter_src, cli_args.filter_hrc, cli_args.filter_pvs) cmd_runner = cmd_utils.ParallelRunner(cli_args.parallelism) # get all pvs to be processed pvs_to_process = [] for pvs_id, pvs in test_config.pvses.items(): if pvs.is_online() and cli_args.skip_online_services: continue pvs_to_process.append(pvs_id)
from flask import Flask, request from flask_cors import CORS from lib import config, log from werkzeug.exceptions import HTTPException from routes.tv import tv_template from flask_swagger_ui import get_swaggerui_blueprint from lib.exlink import ExLink try: c = config.Configuration('config.ini') except Exception as e: exit() fileLocation = None log.setup_custom_logger(c.Logging.moduleName, c.Logging.level, fileLocation) swaggerUiUrl = '' swaggerDocUrl = '/static/swagger.json' swaggerui_blueprint = get_swaggerui_blueprint(swaggerUiUrl, swaggerDocUrl, config={'app_name': 'TV API', 'validatorUrl': None, 'layout': 'BaseLayout'}) app = Flask(__name__, static_url_path="/static") cors = CORS(app) app.tv = ExLink(c.TV.serialPort, c.TV.type) @app.errorhandler(HTTPException) def handle_bad_request(e): if not hasattr(e, 'code'): return str(e), 500 elif e.code > 499: app.logger.error(e) return e