forked from Customrombay/database
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsync_with_alpha_droid.dart
67 lines (61 loc) · 2.25 KB
/
sync_with_alpha_droid.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
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/AlphaDroid-devices/OTA.git...");
int numberOfCovered = 0;
int numberOfNotCovered = 0;
List<String> listOfNotCovered = [];
// List<String> listOfCovered = [];
Directory cacheDir = Directory(".cache/AlphaDroidOSSync");
if (cacheDir.existsSync()) {
cacheDir.deleteSync(recursive: true);
}
cacheDir.createSync(recursive: true);
Process.runSync("git", ["clone", "-b", "alpha-13", "https://github.com/AlphaDroid-devices/OTA.git", cacheDir.path]);
stdout.write("OK\n");
for (FileSystemEntity entity in cacheDir.listSync()) {
if (entity is File && entity.path.endsWith(".json")) {
stdout.write("${entity.path}\n");
String entityContent = await entity.readAsString();
try {
YamlMap ydoc = loadYaml(entityContent);
YamlMap response = ydoc["response"][0];
String readVendor = response["oem"];
String readCodename = entity.path.split("/").last.replaceAll(".json", "");
String extendedCodename = extendedCodenameCreator(readCodename: readCodename, readVendor: readVendor);
if (readCodename == "rova") {
continue;
}
if (isSupported(extendedCodename: extendedCodename)) {
numberOfCovered += 1;
// listOfCovered += [extendedCodename];
addToSupport(
androidVersion: "13",
extendedCodename: extendedCodename,
romName: "AlphaDroid",
romState: "Official",
romSupport: true,
romNotes: "",
romWebpage: "https://sourceforge.net/projects/alphadroid-project/",
deviceWebpage: "https://sourceforge.net/projects/alphadroid-project/files/$readCodename/"
);
}
else {
numberOfNotCovered += 1;
listOfNotCovered += [extendedCodename];
}
}
catch (e) {
print(e);
}
}
}
stdout.write("Covered: $numberOfCovered\n");
stdout.write("Not covered: $numberOfNotCovered\n");
for (var deviceNotCovered in listOfNotCovered) {
stdout.write("$deviceNotCovered\n");
}
}