diff --git a/CHANGES b/CHANGES index 1cbef7f6..53382a6f 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,7 @@ * Fixing #319 no longer disables built in tracks for profile matching (thanks to Owen Quinlan) * Fixing #218 and #308 subtitle scaling with rigaya's hardware encoders needs to be scaled for 4K content (thanks to wynterca) * Fixing #350 subtitle burn in quoting (thanks to Maddie Davis) +* Fixing #346 preserve the order of audio tracks when editing a queued job (thanks to Patrick Bassner) * Fixing Chinese translations (thanks to leonardyan) ## Version 4.9.4 diff --git a/fastflix/widgets/panels/audio_panel.py b/fastflix/widgets/panels/audio_panel.py index f63f31a0..c1d4fa0d 100644 --- a/fastflix/widgets/panels/audio_panel.py +++ b/fastflix/widgets/panels/audio_panel.py @@ -679,8 +679,12 @@ def reload(self, original_tracks: List[AudioTrack], audio_formats): all_info=x, disable_dup=disable_dups, ) - self.tracks.append(new_item) - - self.tracks.sort(key=lambda z: (int(not z.original), z.index)) + for idx, tk in enumerate(self.tracks): + if tk.index > new_item.index: + print(f"Inserting at {idx}") + self.tracks.insert(idx, new_item) + break + else: + self.tracks.append(new_item) super()._new_source(self.tracks)