mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-18 15:07:30 +01:00
Allow reading downloaded chapters
This commit is contained in:
@@ -48,10 +48,9 @@ public class DownloadManager {
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
private Observable<Page> downloadChapter(Manga manga, Chapter chapter) {
|
||||
public Observable<Page> downloadChapter(Manga manga, Chapter chapter) {
|
||||
final Source source = sourceManager.get(manga.source);
|
||||
final File chapterDirectory = new File(
|
||||
preferences.getDownloadsDirectory(), getChapterDirectory(source, manga, chapter));
|
||||
final File chapterDirectory = getAbsoluteChapterDirectory(source, manga, chapter);
|
||||
|
||||
return source
|
||||
.pullPageListFromNetwork(chapter.url)
|
||||
@@ -64,8 +63,13 @@ public class DownloadManager {
|
||||
// Start downloading images
|
||||
.flatMap(page -> getDownloadedImage(page, source, chapterDirectory));
|
||||
}
|
||||
|
||||
public File getAbsoluteChapterDirectory(Source source, Manga manga, Chapter chapter) {
|
||||
return new File(preferences.getDownloadsDirectory(),
|
||||
getChapterDirectory(source, manga, chapter));
|
||||
}
|
||||
|
||||
private String getChapterDirectory(Source source, Manga manga, Chapter chapter) {
|
||||
public String getChapterDirectory(Source source, Manga manga, Chapter chapter) {
|
||||
return source.getName() +
|
||||
File.separator +
|
||||
manga.title.replaceAll("[^a-zA-Z0-9.-]", "_") +
|
||||
|
||||
@@ -32,6 +32,12 @@ public class Chapter {
|
||||
@StorIOSQLiteColumn(name = ChaptersTable.COLUMN_DATE_UPLOAD)
|
||||
public long date_upload;
|
||||
|
||||
public int downloaded;
|
||||
|
||||
public static final int UNKNOWN = 0;
|
||||
public static final int NOT_DOWNLOADED = 1;
|
||||
public static final int DOWNLOADED = 2;
|
||||
|
||||
|
||||
public Chapter() {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user