Tweaks based on comments in the PR
This commit is contained in:
parent
75e9911317
commit
80394dab4a
@ -194,7 +194,7 @@ class DownloadCache(
|
|||||||
val chapterDirName = provider.getValidChapterDirNames(chapter)
|
val chapterDirName = provider.getValidChapterDirNames(chapter)
|
||||||
chapterDirName.forEach {
|
chapterDirName.forEach {
|
||||||
if (it in mangaDir.files) {
|
if (it in mangaDir.files) {
|
||||||
mangaDir.files -= chapterDirName
|
mangaDir.files -= it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ class DownloadCache(
|
|||||||
val chapterDirName = provider.getValidChapterDirNames(chapter)
|
val chapterDirName = provider.getValidChapterDirNames(chapter)
|
||||||
chapterDirName.forEach {
|
chapterDirName.forEach {
|
||||||
if (it in mangaDir.files) {
|
if (it in mangaDir.files) {
|
||||||
mangaDir.files -= chapterDirName
|
mangaDir.files -= it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,12 +255,13 @@ class DownloadManager(/* SY private */ val context: Context) {
|
|||||||
val newName = provider.getChapterDirName(newChapter)
|
val newName = provider.getChapterDirName(newChapter)
|
||||||
val mangaDir = provider.getMangaDir(manga, source)
|
val mangaDir = provider.getMangaDir(manga, source)
|
||||||
|
|
||||||
val oldFolder = mangaDir.findFile(oldName.find { mangaDir.findFile(it) != null })
|
val oldFolderName = oldName.find { mangaDir.findFile(it) != null }
|
||||||
|
val oldFolder = mangaDir.findFile(oldFolderName)
|
||||||
if (oldFolder?.renameTo(newName) == true) {
|
if (oldFolder?.renameTo(newName) == true) {
|
||||||
cache.removeChapter(oldChapter, manga)
|
cache.removeChapter(oldChapter, manga)
|
||||||
cache.addChapter(newName, mangaDir, manga)
|
cache.addChapter(newName, mangaDir, manga)
|
||||||
} else {
|
} else {
|
||||||
Timber.e("Could not rename downloaded chapter: %s.", oldName.last())
|
Timber.e("Could not rename downloaded chapter: %s.", oldFolderName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user