From 8aef267b62bdd5c8145aa7ca4e0446367951172a Mon Sep 17 00:00:00 2001 From: Chris Griffith Date: Tue, 28 May 2024 22:33:48 -0500 Subject: [PATCH] Audio queue fixes and button highlighting --- fastflix/ff_queue.py | 6 ------ fastflix/widgets/panels/audio_panel.py | 15 ++++++++++++++- fastflix/widgets/windows/audio_conversion.py | 19 ++++++------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/fastflix/ff_queue.py b/fastflix/ff_queue.py index 18ab59a4..88914736 100644 --- a/fastflix/ff_queue.py +++ b/fastflix/ff_queue.py @@ -50,17 +50,11 @@ def get_queue(queue_file: Path) -> list[Video]: crop = None if video["video_settings"]["crop"]: crop = Crop(**video["video_settings"]["crop"]) - del video["audio_tracks"] - del video["subtitle_tracks"] - del video["attachment_tracks"] del video["video_settings"]["video_encoder_settings"] del video["status"] del video["video_settings"]["crop"] vs = VideoSettings( **video["video_settings"], - audio_tracks=audio, - subtitle_tracks=subtitles, - attachment_tracks=attachments, crop=crop, ) vs.video_encoder_settings = ves # No idea why this has to be called after, otherwise reset to x265 diff --git a/fastflix/widgets/panels/audio_panel.py b/fastflix/widgets/panels/audio_panel.py index ae75a567..a052697f 100644 --- a/fastflix/widgets/panels/audio_panel.py +++ b/fastflix/widgets/panels/audio_panel.py @@ -166,7 +166,10 @@ def show_conversions(self): pass self.conversion_box = AudioConversion( - self.app, track_index=self.index, encoders=self.app.fastflix.audio_encoders + self.app, + track_index=self.index, + encoders=self.app.fastflix.audio_encoders, + audio_track_update=self.page_update, ) self.conversion_box.show() @@ -204,6 +207,7 @@ def update_enable(self): def page_update(self): if not self.loading: + self.check_conversion_button() return self.parent.main.page_update(build_thumbnail=False) @property @@ -279,6 +283,15 @@ def update_track(self, conversion=None, bitrate=None, downmix=None): audio_track.downmix = downmix self.page_update() + def check_conversion_button(self): + audio_track: AudioTrack = self.app.fastflix.current_video.audio_tracks[self.index] + if audio_track.conversion_codec: + self.widgets.conversion.setStyleSheet("border-color: #0055ff") + self.widgets.conversion.setText(t("Conversion") + f": {audio_track.conversion_codec}") + else: + self.widgets.conversion.setStyleSheet("") + self.widgets.conversion.setText(t("Conversion")) + class AudioList(FlixList): def __init__(self, parent, app: FastFlixApp): diff --git a/fastflix/widgets/windows/audio_conversion.py b/fastflix/widgets/windows/audio_conversion.py index e5ffdb0e..b2a7869d 100644 --- a/fastflix/widgets/windows/audio_conversion.py +++ b/fastflix/widgets/windows/audio_conversion.py @@ -1,20 +1,12 @@ # -*- coding: utf-8 -*- import logging -from pathlib import Path -from subprocess import run, PIPE -from typing import Optional -import secrets -from PySide6 import QtWidgets, QtCore, QtGui +from PySide6 import QtWidgets from fastflix.models.fastflix_app import FastFlixApp from fastflix.models.encode import AudioTrack -from fastflix.flix import ( - generate_thumbnail_command, -) -from fastflix.encoders.common import helpers -from fastflix.resources import get_icon + from fastflix.language import t __all__ = ["AudioConversion"] @@ -62,9 +54,10 @@ class AudioConversion(QtWidgets.QWidget): - def __init__(self, app: FastFlixApp, track_index, encoders): + def __init__(self, app: FastFlixApp, track_index, encoders, audio_track_update): super().__init__(None) self.app = app + self.audio_track_update = audio_track_update self.setWindowTitle(f"Audio Conversion for Track {track_index}") self.setMinimumWidth(400) self.audio_track: AudioTrack = self.app.fastflix.current_video.audio_tracks[track_index] @@ -175,7 +168,7 @@ def save(self): if self.conversion_codec.currentIndex() != 0: self.audio_track.conversion_codec = self.conversion_codec.currentText() else: - self.audio_track.conversion_codec = None + self.audio_track.conversion_codec = "" if self.aq.currentIndex() != 10: self.audio_track.conversion_aq = self.aq.currentIndex() @@ -188,5 +181,5 @@ def save(self): self.audio_track.downmix = self.downmix.currentText() else: self.audio_track.downmix = None - + self.audio_track_update() self.close()