mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
fix: Yomiroll sort videos
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import '../../../../model/source.dart';
|
import '../../../../model/source.dart';
|
||||||
|
|
||||||
const _yomirollVersion = "0.0.1";
|
const _yomirollVersion = "0.0.15";
|
||||||
const _yomirollSourceCodeUrl =
|
const _yomirollSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/anime/src/all/yomiroll/yomiroll.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/anime/src/all/yomiroll/yomiroll.dart";
|
||||||
|
|
||||||
|
|||||||
@@ -234,6 +234,8 @@ class YomiRoll extends MProvider {
|
|||||||
String hardsub = getMapValue(json.encode(ok.value), "hardsub_locale");
|
String hardsub = getMapValue(json.encode(ok.value), "hardsub_locale");
|
||||||
if (hardsub.isNotEmpty) {
|
if (hardsub.isNotEmpty) {
|
||||||
hardsub = " - HardSub: $hardsub";
|
hardsub = " - HardSub: $hardsub";
|
||||||
|
} else {
|
||||||
|
hardsub = " - SoftSub";
|
||||||
}
|
}
|
||||||
|
|
||||||
final res = await client.get(Uri.parse(url));
|
final res = await client.get(Uri.parse(url));
|
||||||
@@ -422,8 +424,7 @@ class YomiRoll extends MProvider {
|
|||||||
"policy": policyJson['cms']['policy'],
|
"policy": policyJson['cms']['policy'],
|
||||||
"signature": policyJson['cms']['signature'],
|
"signature": policyJson['cms']['signature'],
|
||||||
"key_pair_id": policyJson['cms']['key_pair_id'],
|
"key_pair_id": policyJson['cms']['key_pair_id'],
|
||||||
"bucket": policyJson['cms']['bucket'],
|
"bucket": policyJson['cms']['bucket']
|
||||||
"expires": DateTime.parse("2024-02-02T14:06:52Z").microsecondsSinceEpoch,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,30 +432,41 @@ class YomiRoll extends MProvider {
|
|||||||
String quality = getPreferenceValue(source.id, "preferred_quality");
|
String quality = getPreferenceValue(source.id, "preferred_quality");
|
||||||
String dub = getPreferenceValue(source.id, "preferred_audioLang");
|
String dub = getPreferenceValue(source.id, "preferred_audioLang");
|
||||||
String sub = getPreferenceValue(source.id, "preferred_subLang");
|
String sub = getPreferenceValue(source.id, "preferred_subLang");
|
||||||
String subType = getPreferenceValue(source.id, "preferred_sub_type");
|
String subType = getPreferenceValue(source.id, "preferred_sub_type1");
|
||||||
videos.sort((MVideo a, MVideo b) {
|
videos.sort((MVideo a, MVideo b) {
|
||||||
|
if (subType == "HardSub") {
|
||||||
int qualityMatchA = 0;
|
int qualityMatchA = 0;
|
||||||
|
|
||||||
if (a.quality.contains(quality) &&
|
if (a.quality.contains(quality) &&
|
||||||
a.quality
|
a.quality.contains("Aud: ${getLocale(dub)}") &&
|
||||||
.toLowerCase()
|
a.quality.contains("HardSub: $sub")) {
|
||||||
.contains("Aud: ${getLocale(dub)}".toLowerCase()) &&
|
|
||||||
a.quality.toLowerCase().contains(subType.toLowerCase()) &&
|
|
||||||
a.quality.toLowerCase().contains(sub.toLowerCase())) {
|
|
||||||
qualityMatchA = 1;
|
qualityMatchA = 1;
|
||||||
}
|
}
|
||||||
int qualityMatchB = 0;
|
int qualityMatchB = 0;
|
||||||
if (b.quality.contains(quality) &&
|
if (b.quality.contains(quality) &&
|
||||||
b.quality
|
b.quality.contains("Aud: ${getLocale(dub)}") &&
|
||||||
.toLowerCase()
|
b.quality.contains("HardSub: $sub")) {
|
||||||
.contains("Aud: ${getLocale(dub)}".toLowerCase()) &&
|
|
||||||
b.quality.toLowerCase().contains(subType.toLowerCase()) &&
|
|
||||||
b.quality.toLowerCase().contains(sub.toLowerCase())) {
|
|
||||||
qualityMatchB = 1;
|
qualityMatchB = 1;
|
||||||
}
|
}
|
||||||
if (qualityMatchA != qualityMatchB) {
|
if (qualityMatchA != qualityMatchB) {
|
||||||
return qualityMatchB - qualityMatchA;
|
return qualityMatchB - qualityMatchA;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
int qualityMatchA = 0;
|
||||||
|
if (a.quality.contains(quality) &&
|
||||||
|
a.quality.contains("Aud: ${getLocale(dub)}") &&
|
||||||
|
a.quality.contains(subType)) {
|
||||||
|
qualityMatchA = 1;
|
||||||
|
}
|
||||||
|
int qualityMatchB = 0;
|
||||||
|
if (b.quality.contains(quality) &&
|
||||||
|
b.quality.contains("Aud: ${getLocale(dub)}") &&
|
||||||
|
b.quality.contains(subType)) {
|
||||||
|
qualityMatchB = 1;
|
||||||
|
}
|
||||||
|
if (qualityMatchA != qualityMatchB) {
|
||||||
|
return qualityMatchB - qualityMatchA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final regex = RegExp(r'(\d+)p');
|
final regex = RegExp(r'(\d+)p');
|
||||||
final matchA = regex.firstMatch(a.quality);
|
final matchA = regex.firstMatch(a.quality);
|
||||||
@@ -1138,12 +1150,12 @@ class YomiRoll extends MProvider {
|
|||||||
entries: locale.entries.map((e) => e.value).toList(),
|
entries: locale.entries.map((e) => e.value).toList(),
|
||||||
entryValues: locale.entries.map((e) => e.key).toList()),
|
entryValues: locale.entries.map((e) => e.key).toList()),
|
||||||
ListPreference(
|
ListPreference(
|
||||||
key: "preferred_sub_type",
|
key: "preferred_sub_type1",
|
||||||
title: "Preferred Sub Type",
|
title: "Preferred Sub Type",
|
||||||
summary: "",
|
summary: "",
|
||||||
valueIndex: 0,
|
valueIndex: 0,
|
||||||
entries: ["Softsub", "Hardsub"],
|
entries: ["Softsub", "Hardsub"],
|
||||||
entryValues: ["", "Hardsub"]),
|
entryValues: ["SoftSub", "HardSub"]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user