Fix indexing error for madara sources #37

Merged
resolritter merged 4 commits from 36 into main 2024-03-12 20:25:02 +00:00
resolritter commented 2024-03-11 21:24:47 +00:00 (Migrated from github.com)

We'll add the chapters to a single chapters array, instead of adding them to 3 different arrays as in:

1e6f245175/manga/multisrc/madara/madara.dart (L184-L186)

Doing so should get rid of indexing errors.

Please let me know if I need to bump the versions of madara sources in index.json. If so, I also need to know the next version number.


close #36

We'll add the chapters to a single `chapters` array, instead of adding them to 3 different arrays as in: https://github.com/kodjodevf/mangayomi-extensions/blob/1e6f245175e5716abcce9c10c48de79d3584c59a/manga/multisrc/madara/madara.dart#L184-L186 Doing so should get rid of indexing errors. Please let me know if I need to bump the versions of `madara` sources in [index.json](https://github.com/kodjodevf/mangayomi-extensions/blob/main/index.json). If so, I also need to know the next version number. --- close #36
kodjodevf commented 2024-03-12 08:00:59 +00:00 (Migrated from github.com)

Looks great, I modifier the code because for other sources it may be that the date of the chapter can be null due to the fact that these are chapters released recently you can add it on your side:

List<MChapter>` getChapters(MDocument chapDoc) {
    List<MChapter> chapters = [];
    for (MElement element in chapDoc.select("li.wp-manga-chapter") ?? []) {
      var ch = element.selectFirst("a");
      if (ch != null) {
        var url = ch.attr("href");
        if (url != null && url.isNotEmpty) {
          url = substringBefore(url, "?style=paged");
          if (url.endsWith("?style=paged")) {
            url = url + "?style=paged";
          }
          var chapter = MChapter();
          chapter.url = url;
          chapter.name = ch.text;
          if (source.dateFormat.isNotEmpty) {
            var chd = element.selectFirst("span.chapter-release-date");
            if (chd != null && chd.text.isNotEmpty) {
              var dates = parseDates(
                  [chd.text], source.dateFormat, source.dateFormatLocale);
              chapter.dateUpload = dates[0];
            } else {
              chapter.dateUpload =
                  DateTime.now().millisecondsSinceEpoch.toString();
            }
          }
          chapters.add(chapter);
        }
      }
    }
    return chapters;
  }
Looks great, I modifier the code because for other sources it may be that the date of the chapter can be null due to the fact that these are chapters released recently you can add it on your side: ``` List<MChapter>` getChapters(MDocument chapDoc) { List<MChapter> chapters = []; for (MElement element in chapDoc.select("li.wp-manga-chapter") ?? []) { var ch = element.selectFirst("a"); if (ch != null) { var url = ch.attr("href"); if (url != null && url.isNotEmpty) { url = substringBefore(url, "?style=paged"); if (url.endsWith("?style=paged")) { url = url + "?style=paged"; } var chapter = MChapter(); chapter.url = url; chapter.name = ch.text; if (source.dateFormat.isNotEmpty) { var chd = element.selectFirst("span.chapter-release-date"); if (chd != null && chd.text.isNotEmpty) { var dates = parseDates( [chd.text], source.dateFormat, source.dateFormatLocale); chapter.dateUpload = dates[0]; } else { chapter.dateUpload = DateTime.now().millisecondsSinceEpoch.toString(); } } chapters.add(chapter); } } } return chapters; } ```
kodjodevf commented 2024-03-12 08:16:24 +00:00 (Migrated from github.com)

Also for the next version go to madara sources file and change const madaraVersion = "0.0.85" to const madaraVersion = "0.0.86" after this go to sources_generator and run main() it will generate index.json

Also for the next version go to [madara sources file](https://github.com/kodjodevf/mangayomi-extensions/blob/main/manga/multisrc/madara/sources.dart) and change `const madaraVersion = "0.0.85"` to `const madaraVersion = "0.0.86"` after this go to [sources_generator](https://github.com/kodjodevf/mangayomi-extensions/blob/main/manga/sources_generator.dart) and run `main()` it will generate index.json
resolritter commented 2024-03-12 19:32:22 +00:00 (Migrated from github.com)

Looks great, I modifier the code because for other sources it may be that the date of the chapter can be null due to the fact that these are chapters released recently you can add it on your side:

Done in a6462c9f5e.

Also for the next version go to madara sources file and change const madaraVersion = "0.0.85" to const madaraVersion = "0.0.86" after this go to sources_generator and run main() it will generate index.json

Done in f0d0e202c5 and 80ed7b8f47.

The "Allow edits by maintainers" feature is enabled for this PR, so feel free to push any changes you want.

> Looks great, I modifier the code because for other sources it may be that the date of the chapter can be null due to the fact that these are chapters released recently you can add it on your side: Done in a6462c9f5eb5450161461ce13c5a2082cc972a71. > Also for the next version go to [madara sources file](https://github.com/kodjodevf/mangayomi-extensions/blob/main/manga/multisrc/madara/sources.dart) and change `const madaraVersion = "0.0.85"` to `const madaraVersion = "0.0.86"` after this go to [sources_generator](https://github.com/kodjodevf/mangayomi-extensions/blob/main/manga/sources_generator.dart) and run `main()` it will generate index.json Done in f0d0e202c599b0885488e0535dd9f8c17b367723 and 80ed7b8f47969e04cf384846a9e5305cb80834ef. The "Allow edits by maintainers" feature is enabled for this PR, so feel free to push any changes you want.
kodjodevf (Migrated from github.com) approved these changes 2024-03-12 20:22:27 +00:00
kodjodevf (Migrated from github.com) left a comment

Thanks for your contribution

Thanks for your contribution
Sign in to join this conversation.
No description provided.