Skip to content

Commit 78a8ee2

Browse files
author
Ferenc Nánási
committed
Support added for setting Youtube quality on Open URL modal
1 parent cba5133 commit 78a8ee2

File tree

4 files changed

+46
-10
lines changed

4 files changed

+46
-10
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ Important Android stuff:
3535
- Some code tidy-up, optimizations,
3636
- The app gonna check if the mpv-remote-node version is compatible with the app,
3737
- [CSS] Improved contrast,
38+
- Made the whole app more consistent,
39+
- Set Youtube quality on "Open URL" dialog.

src/components/openURLModal.vue

+41-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,27 @@
2525
v-model="dialog.appendToPlaylist"
2626
></ion-checkbox>
2727
</ion-item>
28+
<ion-item lines="full">
29+
<ion-label>Youtube quality</ion-label>
30+
<ion-select v-model="dialog['file-local-options']['ytdl-format']">
31+
<ion-select-option value="">Default</ion-select-option>
32+
<ion-select-option value="bestvideo[height<=?2160]+bestaudio/best"
33+
>4k</ion-select-option
34+
>
35+
<ion-select-option value="bestvideo[height<=?1440]+bestaudio/best"
36+
>1440p</ion-select-option
37+
>
38+
<ion-select-option value="bestvideo[height<=?1080]+bestaudio/best"
39+
>1080p</ion-select-option
40+
>
41+
<ion-select-option value="bestvideo[height<=?720]+bestaudio/best"
42+
>720p</ion-select-option
43+
>
44+
<ion-select-option value="bestvideo[height<=?480]+bestaudio/best"
45+
>480p</ion-select-option
46+
>
47+
</ion-select>
48+
</ion-item>
2849
<ion-button
2950
expand="block"
3051
style="margin-top: 10px"
@@ -50,20 +71,36 @@ import {
5071
IonLabel,
5172
IonButton,
5273
IonButtons,
74+
IonSelect,
75+
IonSelectOption,
5376
} from "@ionic/vue";
5477
import { arrowBack } from "ionicons/icons";
78+
import { loadFileFlags } from "../tools";
79+
5580
export default {
5681
props: ["modalController"],
5782
setup(props) {
5883
const dialog = ref({
5984
filename: "",
6085
appendToPlaylist: true,
6186
"file-local-options": {
62-
"ytdl-format": "bestvideo[height<=?720]+bestaudio/best",
87+
"ytdl-format": "",
6388
},
6489
});
90+
6591
const onAppendClicked = () => {
66-
props.modalController.dismiss(dialog);
92+
if (dialog.value.appendToPlaylist) {
93+
dialog.value.flag = loadFileFlags.APPEND_PLAY;
94+
} else {
95+
dialog.value.flag = loadFileFlags.REPLACE;
96+
}
97+
98+
delete dialog.value.appendToPlaylist;
99+
// if (dialog.value["file-local-options"]["ytdl-format"].length === 0) {
100+
// delete dialog.value["file-local-options"]["ytdl-format"];
101+
// }
102+
103+
props.modalController.dismiss(dialog.value);
67104
};
68105
69106
const onCancelClicked = () => {
@@ -88,6 +125,8 @@ export default {
88125
IonItem,
89126
IonButton,
90127
IonButtons,
128+
IonSelect,
129+
IonSelectOption,
91130
},
92131
};
93132
</script>

src/tools.js

+2
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,5 @@ export const loadFileFlags = {
4747
APPEND_PLAY: "append-play",
4848
REPLACE: "replace",
4949
};
50+
51+
export const youtubDLQualities = {};

src/views/Player.vue

+1-8
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,7 @@ export default {
230230
231231
modal.onDidDismiss().then((response) => {
232232
if (response.data) {
233-
const mode = response.data.value.appendToPlaylist
234-
? "append-play"
235-
: "replace";
236-
apiInstance.post("playlist", {
237-
filename: response.data.value.filename,
238-
flag: mode,
239-
"file-local-options": response.data.value["file-local-options"],
240-
});
233+
apiInstance.post("playlist", response.data);
241234
}
242235
});
243236
return modal.present();

0 commit comments

Comments
 (0)