From c884dfd77fe7dd437e8325ff91c401e7afade96c Mon Sep 17 00:00:00 2001 From: Chris Griffith Date: Wed, 7 Aug 2024 10:18:49 -0500 Subject: [PATCH] * Fixing #585 error when trying to return a video from queue that has the video track after audio or subtitiles (thanks to Hankuu) --- CHANGES | 1 + FastFlix.nsi | 13 ------------- fastflix/widgets/main.py | 20 ++++++++++++-------- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/CHANGES b/CHANGES index 12fb1a19..b20934fd 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,7 @@ * Fixing #185 audio channels not being set properly and resetting on encoder change (thanks to Tupsi) * Fixing #522 add file fails - fixed as of 5.7.0 (thanks to pcl5x2008) * Fixing #531 list limitation in readme that FFmpeg must support the software encoders listed (thanks to brunoais) +* Fixing #585 error when trying to return a video from queue that has the video track after audio or subtitiles (thanks to Hankuu) * Fixing #586 audio channels being set incorrectly (thanks to Hankuu) * Fixing #588 audio and subtitle dispositions were not set from source (thanks to GeZorTenPlotZ) diff --git a/FastFlix.nsi b/FastFlix.nsi index a4310ff5..02fff751 100644 --- a/FastFlix.nsi +++ b/FastFlix.nsi @@ -92,19 +92,6 @@ SectionEnd Section "Uninstall" - ${nsProcess::FindProcess} "FastFlix.exe" $R0 - - ${If} $R0 == 0 - DetailPrint "FastFlix is running. Closing it down" - ${nsProcess::CloseProcess} "FastFlix.exe" $R0 - DetailPrint "Waiting for FastFlix to close" - Sleep 2000 - ${Else} - DetailPrint "FastFlix was not found to be running" - ${EndIf} - - ${nsProcess::Unload} - ; Remove registry keys DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FastFlix" DeleteRegKey HKLM SOFTWARE\FastFlix diff --git a/fastflix/widgets/main.py b/fastflix/widgets/main.py index 451aa843..13c5e455 100644 --- a/fastflix/widgets/main.py +++ b/fastflix/widgets/main.py @@ -1421,11 +1421,15 @@ def reload_video_from_queue(self, video: Video): ] self.widgets.video_track.clear() self.widgets.video_track.addItems(text_video_tracks) - selected_track = 0 - for track in self.app.fastflix.current_video.streams.video: - if track.index == self.app.fastflix.current_video.video_settings.selected_track: - selected_track = track.index - self.widgets.video_track.setCurrentIndex(selected_track) + for i, track in enumerate(text_video_tracks): + if int(track.split(":")[0]) == self.app.fastflix.current_video.video_settings.selected_track: + self.widgets.video_track.setCurrentIndex(i) + break + else: + logger.warning( + f"Could not find selected track {self.app.fastflix.current_video.video_settings.selected_track} " + f"in {text_video_tracks}" + ) end_time = self.app.fastflix.current_video.video_settings.end_time or video.duration if self.app.fastflix.current_video.video_settings.crop: @@ -1468,7 +1472,7 @@ def reload_video_from_queue(self, video: Video): self.app.fastflix.current_video.status = Status() self.loading_video = False - self.page_update() + self.page_update(build_thumbnail=True, force_build_thumbnail=True) @reusables.log_exception("fastflix", show_traceback=False) def update_video_info(self, hide_progress=False): @@ -1786,7 +1790,7 @@ def video_track_update(self): self.loading_video = False self.page_update(build_thumbnail=True) - def page_update(self, build_thumbnail=True): + def page_update(self, build_thumbnail=True, force_build_thumbnail=False): while self.page_updating: time.sleep(0.1) self.page_updating = True @@ -1803,7 +1807,7 @@ def page_update(self, build_thumbnail=True): f"{int(self.remove_hdr)}:{self.preview_place}:{self.widgets.rotate.currentIndex()}:" f"{self.widgets.flip.currentIndex()}" ) - if new_hash == self.last_thumb_hash: + if new_hash == self.last_thumb_hash and not force_build_thumbnail: return self.last_thumb_hash = new_hash self.generate_thumbnail()