1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-11-22 15:47:30 +00:00

Update "preferred quality" setting

- Re-order the options on the settings page
- "best" and "best <= 1080p" now prefer high-fps
This commit is contained in:
Cadence Ember 2021-04-25 22:13:04 +12:00
parent 05b91a7102
commit 699af63583
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17
2 changed files with 13 additions and 7 deletions

View File

@ -52,15 +52,21 @@ function sortFormats(video, preference) {
} }
if (preference === 1) { // best dash if (preference === 1) { // best dash
formats.sort((a, b) => (b.second__height - a.second__height)) formats.sort((a, b) => {
const a1 = a.second__height + a.fps / 100
const b1 = b.second__height + b.fps / 100
return b1 - a1
})
} else if (preference === 2) { // best <=1080p } else if (preference === 2) { // best <=1080p
formats.sort((a, b) => { formats.sort((a, b) => {
if (b.second__height > 1080) { const a1 = a.second__height + a.fps / 100
if (a.second__height > 1080) return b.second__height - a.second__height const b1 = b.second__height + b.fps / 100
if (b1 > 1081) {
if (a1 > 1081) return b1 - a1
return -1 return -1
} }
if (a.second__height > 1080) return 1 if (a1 > 1081) return 1
return b.second__height - a.second__height return b1 - a1
}) })
} else if (preference === 3) { // best low-fps } else if (preference === 3) { // best low-fps
formats.sort((a, b) => { formats.sort((a, b) => {

View File

@ -34,10 +34,10 @@ block content
+select("quality", "Preferred qualities", false, [ +select("quality", "Preferred qualities", false, [
{value: "0", text: "720p"}, {value: "0", text: "720p"},
{value: "4", text: "360p"},
{value: "1", text: "Best possible"}, {value: "1", text: "Best possible"},
{value: "2", text: "Best <=1080p"}, {value: "2", text: "Best <=1080p"},
{value: "3", text: "Best <=30fps"}, {value: "3", text: "Best <=30fps"}
{value: "4", text: "360p"}
]) ])
+select("save_history", "Watched videos history", false, [ +select("save_history", "Watched videos history", false, [