forked from Customrombay/database
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sync_with_derp_fest.dart
70 lines (66 loc) · 2.59 KB
/
sync_with_derp_fest.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
61
62
63
64
65
66
67
68
69
70
import 'dart:io';
import 'package:yaml/yaml.dart';
import 'tools/extended_codename_creator.dart';
import 'tools/is_supported.dart';
import 'tools/add_to_support.dart';
void main() async {
stdout.write("Cloning https://github.com/DerpFest-AOSP/Updater-Stuff.git...");
int numberOfCovered = 0;
int numberOfNotCovered = 0;
List<String> listOfNotCovered = [];
// List<String> listOfCovered = [];
Directory cacheDir = Directory(".cache/DerpFestSync");
if (cacheDir.existsSync()) {
cacheDir.deleteSync(recursive: true);
}
cacheDir.createSync(recursive: true);
Process.runSync("git", ["clone", "-b", "master", "https://github.com/DerpFest-AOSP/Updater-Stuff.git", cacheDir.path]);
stdout.write("OK\n");
String codenameFileContent = File("assets/vendor_by_codename.yaml").readAsStringSync();
YamlList listOfCodenames = loadYaml(codenameFileContent);
for (FileSystemEntity entity in cacheDir.listSync()) {
if (entity is File && entity.path.endsWith(".json") && !entity.path.startsWith("changelog_")) {
stdout.write("${entity.path}\n");
String entityContent = await entity.readAsString();
YamlMap ydoc = loadYaml(entityContent);
YamlMap response = ydoc["response"][0];
String readCodename = entity.path.split("/").last.replaceAll(".json", "");
String readVendor = "";
String androidVersion = response["version"];
String romType = response["romtype"];
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);
if (isSupported(extendedCodename: extendedCodename)) {
numberOfCovered += 1;
addToSupport(
androidVersion: androidVersion,
extendedCodename: extendedCodename,
romName: "DerpFest",
romState: romType,
romSupport: true,
romWebpage: "https://derpfest.org/",
deviceWebpage: "https://sourceforge.net/projects/derpfest/files/$readCodename/",
romNotes: ""
);
}
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");
}
}