Skip to content

Commit

Permalink
Beta Version 4.2.0b3 (#207)
Browse files Browse the repository at this point in the history
* Fixing returning from queue now works with duplicated audio tracks
* Fixing cover when returned from queue could cause issues
* Fixing cancel button could not always reset to converting if error happened
  • Loading branch information
cdgriffith authored Mar 27, 2021
1 parent 56fc6e7 commit 9740342
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 53 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Fixing that deinterlace detection could crash program due to CPython bug issue #43423 (thanks to macx)
* Fixing that returning item back from queue of a different encoder type would crash Fastflix
* Fixing HDR10 details to be track specific (thanks to Harybo)
* Fixing returning from queue works with duplicated audio tracks

## Version 4.1.2

Expand Down
2 changes: 1 addition & 1 deletion fastflix/data/styles/default.qss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ QPushButton {
min-height: 20px;
}

QPushButton:pressed, QPushButton:clicked {
QPushButton:pressed, QPushButton:clicked, QPushButton:checked {
background-color: #ccc;
}

Expand Down
1 change: 1 addition & 0 deletions fastflix/models/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import shutil
Expand Down
10 changes: 9 additions & 1 deletion fastflix/models/encode.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pathlib import Path
from typing import List, Optional, Union
from typing import List, Optional, Union, Dict

from pydantic import BaseModel, Field
from box import Box


class AudioTrack(BaseModel):
Expand All @@ -14,6 +16,12 @@ class AudioTrack(BaseModel):
language: str = ""
conversion_bitrate: str = ""
conversion_codec: str = ""
profile: Optional[str] = None
enabled: bool = True
original: bool = False
channels: int = 2
friendly_info: str = ""
raw_info: Optional[Union[Dict, Box]] = None


class SubtitleTrack(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion fastflix/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = "4.2.0b2"
__version__ = "4.2.0b3"
__author__ = "Chris Griffith"
2 changes: 1 addition & 1 deletion fastflix/widgets/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self, app: FastFlixApp, **kwargs):
self.profile = ProfileWindow(self.app, self.main)

self.setCentralWidget(self.main)
self.setMinimumSize(QtCore.QSize(1280, 650))
self.setMinimumSize(QtCore.QSize(1280, 700))
self.icon = QtGui.QIcon(main_icon)
self.setWindowIcon(self.icon)
self.main.set_profile()
Expand Down
22 changes: 12 additions & 10 deletions fastflix/widgets/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ def __init__(self, parent, app: FastFlixApp):
self.grid = QtWidgets.QGridLayout()

self.grid.addLayout(self.init_top_bar(), 0, 0, 1, 14)
self.grid.addLayout(self.init_video_area(), 1, 0, 6, 6)
self.grid.addLayout(self.init_scale_and_crop(), 1, 6, 6, 4)
self.grid.addWidget(self.init_preview_image(), 1, 10, 5, 4, (QtCore.Qt.AlignTop | QtCore.Qt.AlignRight))
self.grid.addLayout(self.init_thumb_time_selector(), 6, 10, 1, 4, (QtCore.Qt.AlignTop | QtCore.Qt.AlignRight))
self.grid.addLayout(self.init_video_area(), 2, 0, 6, 6)
self.grid.addLayout(self.init_scale_and_crop(), 2, 6, 6, 4)
self.grid.addWidget(self.init_preview_image(), 2, 10, 5, 4, (QtCore.Qt.AlignTop | QtCore.Qt.AlignRight))
self.grid.addLayout(self.init_thumb_time_selector(), 7, 10, 1, 4, (QtCore.Qt.AlignTop | QtCore.Qt.AlignRight))

spacer = QtWidgets.QLabel()
spacer.setFixedHeight(5)
self.grid.addWidget(spacer, 7, 0, 1, 14)
self.grid.addWidget(self.video_options, 8, 0, 10, 14)
self.grid.addWidget(spacer, 8, 0, 1, 14)
self.grid.addWidget(self.video_options, 9, 0, 10, 14)

self.grid.setSpacing(5)
self.paused = False
Expand Down Expand Up @@ -498,6 +498,7 @@ def init_encoder_drop_down(self):
layout = QtWidgets.QHBoxLayout()
self.widgets.convert_to = QtWidgets.QComboBox()
self.widgets.convert_to.setMinimumWidth(180)
self.widgets.convert_to.setFixedHeight(40)
self.change_output_types()
self.widgets.convert_to.currentTextChanged.connect(self.change_encoder)

Expand Down Expand Up @@ -1700,16 +1701,20 @@ def conversion_complete(self, return_code):

@reusables.log_exception("fastflix", show_traceback=False)
def conversion_cancelled(self, data):
self.converting = False
self.set_convert_button()

if not data:
return

try:
video_uuid, *_ = data.split("|")
cancelled_video = self.find_video(video_uuid)
exists = cancelled_video.video_settings.output_path.exists()
except Exception:
return

if cancelled_video.video_settings.output_path.exists():
if exists:
sm = QtWidgets.QMessageBox()
sm.setWindowTitle(t("Cancelled"))
sm.setText(
Expand All @@ -1726,9 +1731,6 @@ def conversion_cancelled(self, data):
except OSError:
pass

self.converting = False
self.set_convert_button()

@reusables.log_exception("fastflix", show_traceback=True)
def dropEvent(self, event):
if not event.mimeData().hasUrls:
Expand Down
94 changes: 78 additions & 16 deletions fastflix/widgets/panels/audio_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __init__(
self.codecs = codecs
self.channels = channels
self.available_audio_encoders = available_audio_encoders
self.all_info = all_info

self.widgets = Box(
track_number=QtWidgets.QLabel(f"{index}:{self.outdex}" if enabled else "❌"),
Expand Down Expand Up @@ -430,25 +431,86 @@ def update_audio_settings(self):
downmix=track.downmix,
title=track.title,
language=track.language,
profile=track.profile,
channels=track.channels,
enabled=track.enabled,
original=track.original,
raw_info=track.all_info,
friendly_info=track.audio,
)
)
self.app.fastflix.current_video.video_settings.audio_tracks = tracks

def reload(self, original_tracks, audio_formats):
enabled_tracks = [x.index for x in original_tracks]
self.new_source(audio_formats)
for track in self.tracks:
enabled = track.index in enabled_tracks
track.widgets.enable_check.setChecked(enabled)
if enabled:
existing_track = [x for x in original_tracks if x.index == track.index][0]
track.widgets.downmix.setCurrentText(existing_track.downmix)
track.widgets.convert_to.setCurrentText(existing_track.conversion_codec)
track.widgets.convert_bitrate.setCurrentText(existing_track.conversion_bitrate)
track.widgets.title.setText(existing_track.title)
if existing_track.language:
track.widgets.language.setCurrentText(Lang(existing_track.language).name)
else:
track.widgets.language.setCurrentIndex(0)
def reload(self, original_tracks: List[AudioTrack], audio_formats):
disable_dups = "nvencc" in self.main.convert_to.lower()

repopulated_tracks = set()
for track in original_tracks:
if track.original:
repopulated_tracks.add(track.index)

new_track = Audio(
parent=self,
audio=track.friendly_info,
all_info=Box(track.raw_info) if track.raw_info else None,
title=track.title,
language=track.language,
profile=track.profile,
original=track.original,
index=track.index,
outdex=track.outdex,
codec=track.codec,
codecs=audio_formats,
channels=track.channels,
available_audio_encoders=self.available_audio_encoders,
enabled=True,
disable_dup=disable_dups,
)

new_track.widgets.downmix.setCurrentText(track.downmix)
new_track.widgets.convert_to.setCurrentText(track.conversion_codec)
new_track.widgets.convert_bitrate.setCurrentText(track.conversion_bitrate)
new_track.widgets.title.setText(track.title)
if track.language:
new_track.widgets.language.setCurrentText(Lang(track.language).name)
else:
new_track.widgets.language.setCurrentIndex(0)

self.tracks.append(new_track)

for i, x in enumerate(self.app.fastflix.current_video.streams.audio, start=1):
if x.index in repopulated_tracks:
continue
track_info = ""
tags = x.get("tags", {})
if tags:
track_info += tags.get("title", "")
# if "language" in tags:
# track_info += f" {tags.language}"
track_info += f" - {x.codec_name}"
if "profile" in x:
track_info += f" ({x.profile})"
track_info += f" - {x.channels} {t('channels')}"

new_item = Audio(
self,
track_info,
title=tags.get("title"),
language=tags.get("language"),
profile=x.get("profile"),
original=True,
index=x.index,
outdex=i,
codec=x.codec_name,
codecs=audio_formats,
channels=x.channels,
available_audio_encoders=self.available_audio_encoders,
enabled=False,
all_info=x,
disable_dup=disable_dups,
)
self.tracks.append(new_item)

self.tracks.sort(key=lambda z: (int(not z.original), z.index))

super()._new_source(self.tracks)
4 changes: 2 additions & 2 deletions fastflix/widgets/panels/cover_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def update_cover_settings(self):

def cover_passthrough_check(self):
checked = self.cover_passthrough_checkbox.isChecked()
if checked:
if checked and "cover" in self.attachments:
self.cover_path.setDisabled(True)
self.cover_button.setDisabled(True)
pixmap = QtGui.QPixmap(str(self.app.fastflix.current_video.work_path / self.attachments.cover.name))
Expand All @@ -253,7 +253,7 @@ def small_cover_passthrough_check(self):

def cover_land_passthrough_check(self):
checked = self.cover_land_passthrough_checkbox.isChecked()
if checked:
if checked and "cover_land" in self.attachments:
self.cover_land_path.setDisabled(True)
self.landscape_button.setDisabled(True)
pixmap = QtGui.QPixmap(str(self.app.fastflix.current_video.work_path / self.attachments.cover_land.name))
Expand Down
20 changes: 12 additions & 8 deletions fastflix/widgets/video_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,18 @@ def reload(self):
settings = copy.deepcopy(self.app.fastflix.current_video.video_settings)
audio_tracks = settings.audio_tracks
subtitle_tracks = settings.subtitle_tracks
if getattr(self.main.current_encoder, "enable_audio", False):
self.audio.reload(audio_tracks, self.audio_formats)
if getattr(self.main.current_encoder, "enable_subtitles", False):
self.subtitles.reload(subtitle_tracks)
if getattr(self.main.current_encoder, "enable_attachments", False):
self.attachments.reload_from_queue(streams, settings)
self.advanced.reset(settings=settings)
self.info.reset()
try:
if getattr(self.main.current_encoder, "enable_audio", False):
self.audio.reload(audio_tracks, self.audio_formats)
if getattr(self.main.current_encoder, "enable_subtitles", False):
self.subtitles.reload(subtitle_tracks)
if getattr(self.main.current_encoder, "enable_attachments", False):
self.attachments.reload_from_queue(streams, settings)
self.advanced.reset(settings=settings)
self.info.reset()
except Exception:
logger.exception("Should not have happened, could not reload from queue")
return
self.debug.reset()

def clear_tracks(self):
Expand Down
26 changes: 13 additions & 13 deletions requirements-build.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
appdirs
colorama
coloredlogs
iso639-lang
mistune
pathvalidate
psutil
pydantic
appdirs==1.4.4
colorama==0.4.4
coloredlogs==15.0
iso639-lang==0.0.9
mistune==0.8.4
pathvalidate==2.3.2
psutil==5.8.0
pydantic==1.8.1
pyinstaller==4.2
pyqt5
python-box
qtpy
requests
reusables
pyqt5==5.15.3
python-box==5.3.0
qtpy==1.9.0
requests==2.25.1
reusables==0.9.6
ruamel.yaml<0.16

0 comments on commit 9740342

Please sign in to comment.