forked from michael-mueller-git/Python-Funscript-Editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.py
More file actions
69 lines (60 loc) · 2.34 KB
/
api.py
File metadata and controls
69 lines (60 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import sys
import os
import cv2
import funscript_editor.utils.logging as logging
from funscript_editor.ui.funscript_editor_window import FunscriptEditorWindow
from funscript_editor.ui.funscript_generator_window import FunscriptGeneratorWindow
from funscript_editor.utils.config import VERSION
from PyQt5 import QtCore, QtGui, QtWidgets
def show_editor() -> None:
""" Show the Funscript Editor Main Window """
logging.setup_logging(silent=False)
logger = logging.getLogger(__name__)
logger.info("Python Funscript Editor %s", VERSION)
logger.info("Startup Path: %s", str(os.getcwd()))
app = QtWidgets.QApplication(sys.argv)
widget = FunscriptEditorWindow()
widget.show()
ret = app.exec_()
logger.info("EXIT")
sys.exit(ret)
def generate_funscript(
video_file: str,
start_time: float,
end_time :float,
output_file: str,
include_multiaxis_options: bool = False,
no_tracking: bool = False,
enable_logging: bool = False,
stdout_logging: bool = False) -> None:
""" Generate a funscript with minimal UI
Args:
video_file (str): path to video file
start_time (float): start time in milliseconds
end_time (float): end time in milliseconds (set -1.0 to use video end)
output_file (str): path for the output file
include_multiaxis_options (bool): include options for multiaxis output
no_tracking (bool): Use previous tracking result
enable_logging (bool): enable logging
stdout_logging (bool): enable stdout logging
"""
if stdout_logging:
enable_logging = True
if enable_logging:
logging.setup_logging(silent=not stdout_logging)
else:
logging.disable_logging()
logger = logging.getLogger(__name__)
logger.info("Python Funscript Generator %s", VERSION)
logger.info("Startup Path: %s", str(os.getcwd()))
logger.info("Args: video_file=%s, start_time=%s, end_time=%s, output_file=%s", \
str(video_file), str(start_time), str(end_time), str(output_file))
app = QtWidgets.QApplication(sys.argv)
w = FunscriptGeneratorWindow(video_file, start_time, end_time, output_file, include_multiaxis_options, no_tracking)
w.setFixedHeight(5)
w.setFixedWidth(5)
w.move(1,1)
w.show()
ret = app.exec_()
logger.info("EXIT")
sys.exit(ret)