mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
Remove anime_index.json generation from source generator
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart/anime/anime_source_list.dart';
|
|
||||||
import 'dart/manga/manga_source_list.dart';
|
import 'dart/manga/manga_source_list.dart';
|
||||||
import 'dart/novel/novel_source_list.dart';
|
import 'dart/novel/novel_source_list.dart';
|
||||||
import 'model/source.dart';
|
import 'model/source.dart';
|
||||||
@@ -11,9 +10,6 @@ void main() {
|
|||||||
genManga(
|
genManga(
|
||||||
jsSources.where((element) => element.itemType!.name == "manga").toList(),
|
jsSources.where((element) => element.itemType!.name == "manga").toList(),
|
||||||
);
|
);
|
||||||
genAnime(
|
|
||||||
jsSources.where((element) => element.itemType!.name == "anime").toList(),
|
|
||||||
);
|
|
||||||
genNovel(
|
genNovel(
|
||||||
jsSources.where((element) => element.itemType!.name == "novel").toList(),
|
jsSources.where((element) => element.itemType!.name == "novel").toList(),
|
||||||
);
|
);
|
||||||
@@ -23,8 +19,9 @@ void genManga(List<Source> jsMangasourceList) {
|
|||||||
List<Source> mangaSources = [];
|
List<Source> mangaSources = [];
|
||||||
mangaSources.addAll(dartMangasourceList);
|
mangaSources.addAll(dartMangasourceList);
|
||||||
mangaSources.addAll(jsMangasourceList);
|
mangaSources.addAll(jsMangasourceList);
|
||||||
final List<Map<String, dynamic>> jsonList =
|
final List<Map<String, dynamic>> jsonList = mangaSources
|
||||||
mangaSources.map((source) => source.toJson()).toList();
|
.map((source) => source.toJson())
|
||||||
|
.toList();
|
||||||
final jsonString = jsonEncode(jsonList);
|
final jsonString = jsonEncode(jsonList);
|
||||||
|
|
||||||
final file = File('index.json');
|
final file = File('index.json');
|
||||||
@@ -33,26 +30,13 @@ void genManga(List<Source> jsMangasourceList) {
|
|||||||
log('JSON file created: ${file.path}');
|
log('JSON file created: ${file.path}');
|
||||||
}
|
}
|
||||||
|
|
||||||
void genAnime(List<Source> jsAnimesourceList) {
|
|
||||||
List<Source> animeSources = [];
|
|
||||||
animeSources.addAll(dartAnimesourceList);
|
|
||||||
animeSources.addAll(jsAnimesourceList);
|
|
||||||
final List<Map<String, dynamic>> jsonList =
|
|
||||||
animeSources.map((source) => source.toJson()).toList();
|
|
||||||
final jsonString = jsonEncode(jsonList);
|
|
||||||
|
|
||||||
final file = File('anime_index.json');
|
|
||||||
file.writeAsStringSync(jsonString);
|
|
||||||
|
|
||||||
log('JSON file created: ${file.path}');
|
|
||||||
}
|
|
||||||
|
|
||||||
void genNovel(List<Source> jsNovelSourceList) {
|
void genNovel(List<Source> jsNovelSourceList) {
|
||||||
List<Source> novelSources = [];
|
List<Source> novelSources = [];
|
||||||
novelSources.addAll(dartNovelSourceList);
|
novelSources.addAll(dartNovelSourceList);
|
||||||
novelSources.addAll(jsNovelSourceList);
|
novelSources.addAll(jsNovelSourceList);
|
||||||
final List<Map<String, dynamic>> jsonList =
|
final List<Map<String, dynamic>> jsonList = novelSources
|
||||||
novelSources.map((source) => source.toJson()).toList();
|
.map((source) => source.toJson())
|
||||||
|
.toList();
|
||||||
final jsonString = jsonEncode(jsonList);
|
final jsonString = jsonEncode(jsonList);
|
||||||
|
|
||||||
final file = File('novel_index.json');
|
final file = File('novel_index.json');
|
||||||
@@ -80,8 +64,7 @@ List<Source> _searchJsSources(Directory dir) {
|
|||||||
if (match != null) {
|
if (match != null) {
|
||||||
for (var sourceJson in jsonDecode(match.group(1)!) as List) {
|
for (var sourceJson in jsonDecode(match.group(1)!) as List) {
|
||||||
final langs = sourceJson["langs"] as List?;
|
final langs = sourceJson["langs"] as List?;
|
||||||
Source source =
|
Source source = Source.fromJson(sourceJson)
|
||||||
Source.fromJson(sourceJson)
|
|
||||||
..sourceCodeLanguage = 1
|
..sourceCodeLanguage = 1
|
||||||
..appMinVerReq =
|
..appMinVerReq =
|
||||||
sourceJson["appMinVerReq"] ?? defaultSource.appMinVerReq
|
sourceJson["appMinVerReq"] ?? defaultSource.appMinVerReq
|
||||||
|
|||||||
Reference in New Issue
Block a user