-
Notifications
You must be signed in to change notification settings - Fork 26
/
sync_with_ancient_os.dart
60 lines (56 loc) · 2.1 KB
/
sync_with_ancient_os.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import 'dart:io';
import 'package:yaml/yaml.dart';
import 'package:http/http.dart' as http;
import 'tools/extended_codename_creator.dart';
import 'tools/is_supported.dart';
import 'tools/add_to_support.dart';
void main() async {
int numberOfCovered = 0;
int numberOfNotCovered = 0;
List<String> listOfNotCovered = [];
var response = await http.get(Uri.parse("https://raw.githubusercontent.com/ancient-devices/official/13T/ancient.devices"));
String codenameFileContent = File("assets/vendor_by_codename.yaml").readAsStringSync();
YamlList listOfCodenames = loadYaml(codenameFileContent);
if (response.statusCode == 200) {
stdout.write("OK\n");
List<String> listOfReadCodenames = response.body.split("\n");
for (String readCodename in listOfReadCodenames) {
if (readCodename.trim() != "") {
String readVendor = "";
for (YamlMap codename in listOfCodenames) {
if (codename["codename"] == readCodename) {
readVendor = codename["vendors"][0];
}
}
if (readVendor == "") {
stdout.write("\x1B[33mNo vendor found for $readCodename!\x1B[0m\n");
}
else {
String extendedCodename = extendedCodenameCreator(readCodename: readCodename, readVendor: readVendor);
stdout.write("$extendedCodename\n");
if (isSupported(extendedCodename: extendedCodename)) {
numberOfCovered += 1;
addToSupport(
androidVersion: "13",
extendedCodename: extendedCodename,
romName: "AncientOS",
romState: "Official",
romSupport: true,
romWebpage: "https://ancientrom.xyz/",
deviceWebpage: "https://ancientrom.xyz/download"
);
}
else {
numberOfNotCovered += 1;
listOfNotCovered += [extendedCodename];
}
}
}
}
stdout.write("Covered: $numberOfCovered\n");
stdout.write("Not covered: $numberOfNotCovered\n");
for (var deviceNotCovered in listOfNotCovered) {
stdout.write("$deviceNotCovered\n");
}
}
}