Добавлено описание и документация для HVideoTool, включая функционал, требования, установку и запуск приложения для обнаружения цензуры на изображениях.
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
"""Options dialog for "Создать из ролика…" — sampling mode, step, downscale.
|
||||
|
||||
Keeps the speed levers in one place: keyframe-only (fast) vs every-Nth-frame, the
|
||||
step, and an optional max-side downscale (smaller files → less disk/AV pressure).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from PySide6.QtWidgets import (
|
||||
QComboBox,
|
||||
QDialog,
|
||||
QDialogButtonBox,
|
||||
QFormLayout,
|
||||
QLabel,
|
||||
QSpinBox,
|
||||
QWidget,
|
||||
)
|
||||
|
||||
|
||||
class ExtractDialog(QDialog):
|
||||
def __init__(self, parent: QWidget | None = None) -> None:
|
||||
super().__init__(parent)
|
||||
self.setWindowTitle("Создать из ролика")
|
||||
|
||||
self.mode = QComboBox()
|
||||
self.mode.addItem("Только ключевые кадры (быстро)", userData=True)
|
||||
self.mode.addItem("Каждый N-й кадр", userData=False)
|
||||
self.mode.currentIndexChanged.connect(self._sync)
|
||||
|
||||
self.step = QSpinBox()
|
||||
self.step.setRange(1, 100000)
|
||||
self.step.setValue(15)
|
||||
|
||||
self.max_dim = QSpinBox()
|
||||
self.max_dim.setRange(0, 8192)
|
||||
self.max_dim.setSingleStep(120)
|
||||
self.max_dim.setValue(0)
|
||||
self.max_dim.setSpecialValueText("оригинал")
|
||||
|
||||
form = QFormLayout(self)
|
||||
form.addRow("Режим:", self.mode)
|
||||
form.addRow("Брать каждый N-й кадр:", self.step)
|
||||
form.addRow("Макс. сторона, px:", self.max_dim)
|
||||
hint = QLabel(
|
||||
"Ключевые кадры — в разы быстрее (декодируются только I-кадры),\n"
|
||||
"но реже по времени. Даунскейл уменьшает файлы и нагрузку на диск."
|
||||
)
|
||||
hint.setWordWrap(True)
|
||||
form.addRow(hint)
|
||||
|
||||
buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||
buttons.accepted.connect(self.accept)
|
||||
buttons.rejected.connect(self.reject)
|
||||
form.addRow(buttons)
|
||||
self._sync()
|
||||
|
||||
def _sync(self) -> None:
|
||||
self.step.setEnabled(not self.mode.currentData())
|
||||
|
||||
def options(self) -> tuple[bool, int, int]:
|
||||
"""Return (keyframes_only, step, max_dim)."""
|
||||
return bool(self.mode.currentData()), self.step.value(), self.max_dim.value()
|
||||
Reference in New Issue
Block a user