Fix "Lowest Quality" Option Selects "Highest Quality" Instead of 144p#779
Fix "Lowest Quality" Option Selects "Highest Quality" Instead of 144p#779
Conversation
…nstead of highest Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Done! Issue #759 investigated and fixed in commit d720379. The bug was in Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Fixes issue #759 where selecting the “Lowest quality” video preference incorrectly selected the highest available quality.
Changes:
- Adjusted
VideoQualityPreference.Lowestselection logic to use the first ordered option rather than the last.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| VideoQualityPreference.Lowest => orderedOptions.FirstOrDefault(o => | ||
| o.Container == PreferredContainer | ||
| ), |
There was a problem hiding this comment.
orderedOptions is built from options.OrderBy(o => o.VideoQuality), and audio-only options have VideoQuality == null (see VideoDownloadOption.VideoQuality), which will sort first. Switching Lowest to FirstOrDefault can therefore select an audio-only option that shares the same container (e.g., Container.Mp4 has an audio-only option), resulting in downloading audio-only instead of the lowest video quality. Consider filtering out audio-only options here (e.g., require !o.IsAudioOnly / o.VideoQuality is not null) when PreferredContainer.IsAudioOnly is false, so Lowest picks the lowest video stream option for that container.
Summary
Fixed issue #759 where selecting "Lowest Quality" option was downloading the highest quality (2160p) instead of the lowest (144p).
Closes #759
Bug Description
When users selected "Lowest Quality" preference for video downloads, the application incorrectly downloaded the highest available quality (e.g., 2160p) instead of the lowest available quality (e.g., 144p).
Root Cause
In
VideoDownloadPreference.csline 43, theLowestquality preference case was usingLastOrDefault()instead ofFirstOrDefault().Since the options are ordered by
o.VideoQualityin ascending order (line 19):FirstOrDefault()returns the lowest quality ✓LastOrDefault()returns the highest quality ✗ (bug)Fix Applied
Changed line 43 from:
To:
Validation
LowestusesFirstOrDefault(),HighestusesLastOrDefault()This fix ensures that selecting "Lowest Quality" will now correctly download the lowest available quality (e.g., 144p) instead of the highest quality (e.g., 2160p).
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.