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