From d8a592157bb1a878c775adf879912e82e4dd244d Mon Sep 17 00:00:00 2001 From: Moustapha Kodjo Amadou <107993382+kodjodevf@users.noreply.github.com> Date: Thu, 24 Jul 2025 09:24:02 +0100 Subject: [PATCH] Remove anime_index.json generation from source generator --- source_generator.dart | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/source_generator.dart b/source_generator.dart index e67edf3d..232af453 100644 --- a/source_generator.dart +++ b/source_generator.dart @@ -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 jsMangasourceList) { List mangaSources = []; mangaSources.addAll(dartMangasourceList); mangaSources.addAll(jsMangasourceList); - final List> jsonList = - mangaSources.map((source) => source.toJson()).toList(); + final List> jsonList = mangaSources + .map((source) => source.toJson()) + .toList(); final jsonString = jsonEncode(jsonList); final file = File('index.json'); @@ -33,26 +30,13 @@ void genManga(List jsMangasourceList) { log('JSON file created: ${file.path}'); } -void genAnime(List jsAnimesourceList) { - List animeSources = []; - animeSources.addAll(dartAnimesourceList); - animeSources.addAll(jsAnimesourceList); - final List> 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 jsNovelSourceList) { List novelSources = []; novelSources.addAll(dartNovelSourceList); novelSources.addAll(jsNovelSourceList); - final List> jsonList = - novelSources.map((source) => source.toJson()).toList(); + final List> jsonList = novelSources + .map((source) => source.toJson()) + .toList(); final jsonString = jsonEncode(jsonList); final file = File('novel_index.json'); @@ -80,13 +64,12 @@ List _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) - ..sourceCodeLanguage = 1 - ..appMinVerReq = - sourceJson["appMinVerReq"] ?? defaultSource.appMinVerReq - ..sourceCodeUrl = - "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/javascript/${sourceJson["pkgPath"] ?? sourceJson["pkgName"]}"; + Source source = Source.fromJson(sourceJson) + ..sourceCodeLanguage = 1 + ..appMinVerReq = + sourceJson["appMinVerReq"] ?? defaultSource.appMinVerReq + ..sourceCodeUrl = + "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/javascript/${sourceJson["pkgPath"] ?? sourceJson["pkgName"]}"; if (sourceJson["id"] != null) { source = source..id = int.tryParse("${sourceJson["id"]}"); }