mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 00:59:17 +01:00
Allow whitespaces in downloads path and add chapter id to avoid path conflicts. Throw if page list is empty
WARNING: Downloaded chapters from a previous version won't be visible in the app anymore. You will have to manually delete the folder and download them again.
This commit is contained in:
parent
e702be1a8d
commit
226cc6990d
@ -253,7 +253,6 @@ public class DatabaseHelper {
|
||||
.filter(c -> !dbChapters.contains(c))
|
||||
.doOnNext(c -> {
|
||||
c.manga_id = manga.id;
|
||||
c.date_fetch = new Date().getTime();
|
||||
ChapterRecognition.parseChapterNumber(c, manga);
|
||||
})
|
||||
.toList();
|
||||
|
@ -164,7 +164,7 @@ public class DownloadManager {
|
||||
|
||||
// Check that all the images are downloaded
|
||||
private boolean isChapterDownloaded(File directory, List<Page> pages) {
|
||||
return pages != null && pages.size() + 1 == directory.listFiles().length;
|
||||
return pages != null && !pages.isEmpty() && pages.size() + 1 == directory.listFiles().length;
|
||||
}
|
||||
|
||||
// Download the entire chapter
|
||||
@ -359,9 +359,9 @@ public class DownloadManager {
|
||||
public File getAbsoluteChapterDirectory(Source source, Manga manga, Chapter chapter) {
|
||||
String chapterRelativePath = source.getName() +
|
||||
File.separator +
|
||||
manga.title.replaceAll("[^a-zA-Z0-9.-]", "_") +
|
||||
manga.title.replaceAll("[^\\sa-zA-Z0-9.-]", "_") +
|
||||
File.separator +
|
||||
chapter.name.replaceAll("[^a-zA-Z0-9.-]", "_");
|
||||
chapter.name.replaceAll("[^\\sa-zA-Z0-9.-]", "_") + " (" + chapter.id + ")";
|
||||
|
||||
return new File(preferences.getDownloadsDirectory(), chapterRelativePath);
|
||||
}
|
||||
|
@ -105,7 +105,9 @@ public abstract class Source extends BaseSource {
|
||||
.getStringResponse(getBaseUrl() + overrideChapterUrl(chapterUrl), requestHeaders, null)
|
||||
.flatMap(unparsedHtml -> {
|
||||
List<Page> pages = convertToPages(parseHtmlToPageUrls(unparsedHtml));
|
||||
return Observable.just(parseFirstPage(pages, unparsedHtml));
|
||||
return !pages.isEmpty() ?
|
||||
Observable.just(parseFirstPage(pages, unparsedHtml)) :
|
||||
Observable.error(new Exception("Page list is empty"));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,9 @@ public class Kissmanga extends Source {
|
||||
.flatMap(networkService::mapResponseToString)
|
||||
.flatMap(unparsedHtml -> {
|
||||
List<Page> pages = convertToPages(parseHtmlToPageUrls(unparsedHtml));
|
||||
return Observable.just(parseFirstPage(pages, unparsedHtml));
|
||||
return !pages.isEmpty() ?
|
||||
Observable.just(parseFirstPage(pages, unparsedHtml)) :
|
||||
Observable.error(new Exception("Page list is empty"));
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user