You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
2.0 KiB
Python
95 lines
2.0 KiB
Python
#! /usr/bin/python3
|
|
|
|
import os, sys, subprocess, json, click, time, re, tempfile, math
|
|
from datetime import datetime, timedelta
|
|
|
|
from ffx.file_properties import FileProperties
|
|
|
|
from ffx.ffx_app import FfxApp
|
|
from ffx.ffx_controller import FfxController
|
|
from ffx.show_controller import ShowController
|
|
from ffx.tmdb_controller import TmdbController
|
|
|
|
from ffx.database import databaseContext
|
|
|
|
from ffx.track_descriptor import TrackDescriptor
|
|
from ffx.track_type import TrackType
|
|
from ffx.video_encoder import VideoEncoder
|
|
from ffx.track_disposition import TrackDisposition
|
|
|
|
from ffx.process import executeProcess
|
|
|
|
from ffx.test.helper import createMediaTestFile
|
|
|
|
from ffx.test.scenario import Scenario
|
|
|
|
VERSION='0.1.0'
|
|
|
|
# 0.1.1
|
|
# Bugfixes, TMBD identify shows
|
|
# 0.1.2
|
|
# Bugfixes
|
|
# 0.1.3
|
|
# Subtitle file imports
|
|
|
|
|
|
@click.group()
|
|
@click.pass_context
|
|
def ffx(ctx):
|
|
"""FFX"""
|
|
|
|
ctx.obj = {}
|
|
ctx.obj['database'] = databaseContext(databasePath=None)
|
|
|
|
|
|
# Define a subcommand
|
|
@ffx.command()
|
|
def version():
|
|
click.echo(VERSION)
|
|
|
|
|
|
# Another subcommand
|
|
@ffx.command()
|
|
def help():
|
|
click.echo(f"ffx tests {VERSION}\n")
|
|
click.echo(f"Usage: ffx_test ...")
|
|
|
|
|
|
# @ffx.command()
|
|
# def show():
|
|
# for i in Scenario().list():
|
|
# click.echo(i)
|
|
|
|
|
|
# Another subcommand
|
|
@ffx.command()
|
|
@click.pass_context
|
|
def run(ctx):
|
|
"""Run ffx test sequences"""
|
|
|
|
for scenarioIdentifier in Scenario().list():
|
|
|
|
scenario = Scenario.getClassReference(scenarioIdentifier)(ctx.obj)
|
|
|
|
click.echo(f"Running scenario {scenarioIdentifier}")
|
|
|
|
scenario.run()
|
|
|
|
|
|
@ffx.command()
|
|
@click.pass_context
|
|
@click.argument('paths', nargs=-1)
|
|
def dupe(ctx, paths):
|
|
|
|
existingSourcePaths = [p for p in paths if os.path.isfile(p) and p.split('.')[-1] in FfxController.INPUT_FILE_EXTENSIONS]
|
|
|
|
for sourcePath in existingSourcePaths:
|
|
|
|
sourceFileProperties = FileProperties(ctx.obj, sourcePath)
|
|
sourceMediaDescriptor = sourceFileProperties.getMediaDescriptor()
|
|
|
|
createMediaTestFile(sourceMediaDescriptor, baseName='dupe')
|
|
|
|
if __name__ == '__main__':
|
|
ffx()
|