mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 19:01:15 +00:00
extension(Autoembed): Added stream resolution preference
This commit is contained in:
@@ -6,7 +6,7 @@ const mangayomiSources = [{
|
|||||||
"iconUrl": "https://www.google.com/s2/favicons?sz=64&domain=https://autoembed.cc/",
|
"iconUrl": "https://www.google.com/s2/favicons?sz=64&domain=https://autoembed.cc/",
|
||||||
"typeSource": "multi",
|
"typeSource": "multi",
|
||||||
"isManga": false,
|
"isManga": false,
|
||||||
"version": "0.0.4",
|
"version": "0.0.5",
|
||||||
"dateFormat": "",
|
"dateFormat": "",
|
||||||
"dateFormatLocale": "",
|
"dateFormatLocale": "",
|
||||||
"pkgPath": ""
|
"pkgPath": ""
|
||||||
@@ -162,6 +162,25 @@ class DefaultExtension extends MProvider {
|
|||||||
return streams;
|
return streams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async sortStreams(streams) {
|
||||||
|
var sortedStreams = [];
|
||||||
|
|
||||||
|
var copyStreams = streams.slice()
|
||||||
|
var pref = await this.getPreference("pref_video_resolution");
|
||||||
|
for (var i in streams) {
|
||||||
|
var stream = streams[i];
|
||||||
|
if (stream.quality.indexOf(pref) > -1) {
|
||||||
|
sortedStreams.push(stream);
|
||||||
|
var index = copyStreams.indexOf(stream);
|
||||||
|
if (index > -1) {
|
||||||
|
copyStreams.splice(index, 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [...sortedStreams, ...copyStreams]
|
||||||
|
}
|
||||||
|
|
||||||
// For anime episode video list
|
// For anime episode video list
|
||||||
async getVideoList(url) {
|
async getVideoList(url) {
|
||||||
var parts = url.split("||");
|
var parts = url.split("||");
|
||||||
@@ -182,11 +201,11 @@ class DefaultExtension extends MProvider {
|
|||||||
streams.push({
|
streams.push({
|
||||||
url: link,
|
url: link,
|
||||||
originalUrl: link,
|
originalUrl: link,
|
||||||
quality: "Auto",
|
quality: "auto",
|
||||||
subtitles: subtitles,
|
subtitles: subtitles,
|
||||||
});
|
});
|
||||||
|
|
||||||
return streams;
|
return await this.sortStreams(streams);
|
||||||
}
|
}
|
||||||
// For manga chapter pages
|
// For manga chapter pages
|
||||||
async getPageList() {
|
async getPageList() {
|
||||||
@@ -206,8 +225,18 @@ class DefaultExtension extends MProvider {
|
|||||||
entries: ["Day", "Week"],
|
entries: ["Day", "Week"],
|
||||||
entryValues: ["day", "week"]
|
entryValues: ["day", "week"]
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'pref_video_resolution',
|
||||||
|
listPreference: {
|
||||||
|
title: 'Preferred video resolution',
|
||||||
|
summary: '',
|
||||||
|
valueIndex: 0,
|
||||||
|
entries: ["Auto", "1080p", "720p", "360p"],
|
||||||
|
entryValues: ["auto", "1080", "720", "360"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user