added FFmpeg Settings tab and Tools tab and FFprobe tool

This commit is contained in:
k4yt3x 2020-05-12 20:31:58 -04:00
parent 0953fc52a1
commit 9b4ee89aee
2 changed files with 50 additions and 3 deletions

View File

@ -4,14 +4,16 @@
Creator: Video2X GUI
Author: K4YT3X
Date Created: May 5, 2020
Last Modified: May 11, 2020
Last Modified: May 12, 2020
"""
# local imports
from upscaler import Upscaler
from wrappers.ffmpeg import Ffmpeg
# built-in imports
import contextlib
import json
import os
import pathlib
import sys
@ -342,7 +344,14 @@ class Video2XMainWindow(QMainWindow):
self.anime4kcpp_post_processing_check_box = self.findChild(QCheckBox, 'anime4kCppPostProcessingCheckBox')
self.anime4kcpp_gpu_mode_check_box = self.findChild(QCheckBox, 'anime4kCppGpuModeCheckBox')
# load configurations
# FFmpeg settings
pass
# Tools
self.ffprobe_plain_text_edit = self.findChild(QPlainTextEdit, 'ffprobePlainTextEdit')
self.ffprobe_plain_text_edit.dropEvent = self.show_ffprobe_output
# load configurations after GUI initialization
self.load_configurations()
def dragEnterEvent(self, event):
@ -364,6 +373,15 @@ class Video2XMainWindow(QMainWindow):
line_edit.dragEnterEvent = self.dragEnterEvent
line_edit.dropEvent = lambda event: line_edit.setText(str(pathlib.Path(event.mimeData().urls()[0].toLocalFile()).absolute()))
def show_ffprobe_output(self, event):
input_paths = [pathlib.Path(u.toLocalFile()) for u in event.mimeData().urls()]
if not input_paths[0].is_file():
return
ffmpeg_object = Ffmpeg(self.ffmpeg_settings)
file_info_json = ffmpeg_object.probe_file_info(input_paths[0])
self.ffprobe_plain_text_edit.setPlainText(json.dumps(file_info_json, indent=2))
@staticmethod
def read_config(config_file: pathlib.Path) -> dict:
""" read video2x configurations from config file

View File

@ -33,7 +33,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="mainTab">
<attribute name="title">
@ -1519,6 +1519,35 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="ffmpegSettingsTab">
<attribute name="title">
<string>FFmpeg Settings</string>
</attribute>
</widget>
<widget class="QWidget" name="toolsTab">
<attribute name="title">
<string>Tools</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_15">
<item>
<widget class="QTabWidget" name="toolsTabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="toolsFFprobeTab">
<attribute name="title">
<string>FFprobe</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_16">
<item>
<widget class="QPlainTextEdit" name="ffprobePlainTextEdit"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>