diff --git a/README.md b/README.md index f787707..cdb574e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # dsPlayblast Playblast to mp4 + diff --git a/dsPlayblast/__init__.py b/dsPlayblast/__init__.py index e69de29..327b81f 100644 --- a/dsPlayblast/__init__.py +++ b/dsPlayblast/__init__.py @@ -0,0 +1,2 @@ +__version__ = "1.0.0" +__author__ = "Dmitrii Shevchenko" diff --git a/dsPlayblast/ffmpegFn.py b/dsPlayblast/ffmpegFn.py index f2b28f5..f9cf8f8 100644 --- a/dsPlayblast/ffmpegFn.py +++ b/dsPlayblast/ffmpegFn.py @@ -1,4 +1,5 @@ import os +import time import logging LOGGER = logging.getLogger() @@ -13,5 +14,7 @@ def __init__(self, ffmpeg_path: str, input_path: str, output_path: str = ""): def convert_avi_to_mp4(self): if not self.output_path or not self.output_path.endswith(".mp4"): self.output_path = self.input_path.replace(".avi", ".mp4") + LOGGER.debug(f"File access: {os.access(self.input_path, mode=os.X_OK)}") + time.sleep(2) command = f'"{self.ffmpeg_path}" -i {self.input_path} {self.output_path} -y' return os.system(command) diff --git a/dsPlayblast/loggingFn.py b/dsPlayblast/loggingFn.py index 03eb810..9fe417a 100644 --- a/dsPlayblast/loggingFn.py +++ b/dsPlayblast/loggingFn.py @@ -9,7 +9,7 @@ def setup_logging(): brief_formatter = logging.Formatter(fmt="%(levelname)s | %(message)s", datefmt="%Y-%m-%d %H:%M") verbose_formatter = logging.Formatter(fmt="%(asctime)s | %(levelname)s | %(name)s | %(message)s") # Handlers - rfile_handler = logging.handlers.RotatingFileHandler(log_file, mode="a", maxBytes=1024, backupCount=1, delay=0) + rfile_handler = logging.handlers.RotatingFileHandler(log_file, mode="a", maxBytes=1024, backupCount=0, delay=0) rfile_handler.setLevel("DEBUG") rfile_handler.setFormatter(verbose_formatter) stream_handler = logging.StreamHandler() diff --git a/dsPlayblast/playblastFn.py b/dsPlayblast/playblastFn.py deleted file mode 100644 index e69de29..0000000 diff --git a/dsPlayblast/playblastUI.py b/dsPlayblast/playblastUI.py index f5b834c..d1a7647 100644 --- a/dsPlayblast/playblastUI.py +++ b/dsPlayblast/playblastUI.py @@ -4,12 +4,12 @@ import webbrowser from PySide2 import QtWidgets from PySide2 import QtCore +from dsPlayblast import __version__ +from dsPlayblast import __author__ from dsPlayblast import ffmpegFn from dsPlayblast import widgets from dsPlayblast import clientFn -__version__ = 1.0 - LOGGER = logging.getLogger(__name__) @@ -100,6 +100,7 @@ def create_actions(self): self.always_on_top_action.setChecked(self.settings.value("always_on_top", 0)) self.ffmpeg_help_action = QtWidgets.QAction("FFmpeg download", self) self.ffmpeg_help_action.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_DialogHelpButton)) + self.about_help_action = QtWidgets.QAction("About", self) # Create menus self.options_menu = self.menuBar().addMenu("&Options") @@ -108,6 +109,7 @@ def create_actions(self): self.help_menu = self.menuBar().addMenu("Help") self.help_menu.addAction(self.ffmpeg_help_action) + self.help_menu.addAction(self.about_help_action) def create_widgets(self): self.main_widget = QtWidgets.QWidget() @@ -180,7 +182,7 @@ def create_widgets(self): # Status bar # self.statusBar = QtWidgets.QStatusBar() - self.statusBar = widgets.StatusLogger(level="DEBUG", timeout=4000) + self.statusBar = widgets.StatusLogger(level="INFO", timeout=4000) self.statusBar.setFormatter(LOGGER.parent.handlers[0].formatter) self.statusBar.widget.setMaximumHeight(17) LOGGER.addHandler(self.statusBar) @@ -232,6 +234,7 @@ def create_connections(self): self.always_on_top_action.toggled.connect(self.toggle_always_on_top) self.set_maya_port_action.triggered.connect(self.set_maya_port) self.ffmpeg_help_action.triggered.connect(self.open_ffmpeg_web) + self.about_help_action.triggered.connect(self.diplay_about_info) # Inputs self.ffmpeg_path.path_line_edit.textChanged.connect(self.validate_paths) @@ -251,6 +254,13 @@ def toggle_always_on_top(self) -> None: def open_ffmpeg_web(self): webbrowser.open(url="https://ffmpeg.org/", new=2, autoraise=True) + @QtCore.Slot() + def diplay_about_info(self): + info_dialog = QtWidgets.QMessageBox(self) + info_dialog.setWindowTitle("About") + info_dialog.setText(f"Author: {__author__}\nVersion: {__version__}") + info_dialog.exec_() + @ QtCore.Slot() def connect_to_maya(self) -> None: LOGGER.info(f"TODO: Connecting to maya port {self.maya_client.port}") diff --git a/dsPlayblast/widgets.py b/dsPlayblast/widgets.py index a80e401..d866f62 100644 --- a/dsPlayblast/widgets.py +++ b/dsPlayblast/widgets.py @@ -238,8 +238,9 @@ def __init__(self, parent=None, mode=0, start_time=0, end_time=120, max_time=999 # Widgets self.timeslider_radio = QtWidgets.QRadioButton("Time slider") self.startend_radio = QtWidgets.QRadioButton("Start/end") - self.timeslider_radio.setChecked(not mode) - self.startend_radio.setChecked(mode) + self.timeslider_radio.setChecked(mode) + self.startend_radio.setChecked(not mode) + self.start_label = QtWidgets.QLabel("Start:") self.start_time = QtWidgets.QSpinBox() self.start_time.setMinimumWidth(50) @@ -273,6 +274,8 @@ def __init__(self, parent=None, mode=0, start_time=0, end_time=120, max_time=999 self.main_layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.main_layout) + # Apply selection + self.startend_radio.toggled.connect(self.set_spinboxes_enabled) def showEvent(self, event):