Skip to content

Commit

Permalink
Audio queue fixes and button highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
cdgriffith committed May 29, 2024
1 parent 2465b36 commit 8aef267
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
6 changes: 0 additions & 6 deletions fastflix/ff_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion fastflix/widgets/panels/audio_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
19 changes: 6 additions & 13 deletions fastflix/widgets/windows/audio_conversion.py
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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()
Expand All @@ -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()

0 comments on commit 8aef267

Please sign in to comment.