mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Fix download chapter dir when scanlator is empty or changed
This commit is contained in:
parent
61d0023e2f
commit
80f2423f98
2 changed files with 6 additions and 5 deletions
|
@ -229,10 +229,10 @@ class DownloadProvider(private val context: Context) {
|
|||
*
|
||||
* @param chapter the chapter to query.
|
||||
*/
|
||||
fun getChapterDirName(chapter: Chapter): String {
|
||||
fun getChapterDirName(chapter: Chapter, includeBlank: Boolean = false): String {
|
||||
return DiskUtil.buildValidFilename(
|
||||
if (chapter.scanlator != null) "${chapter.scanlator}_${chapter.name}"
|
||||
else chapter.name,
|
||||
if (!chapter.scanlator.isNullOrBlank()) "${chapter.scanlator}_${chapter.name}"
|
||||
else (if (includeBlank) "_" else "") + chapter.name,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -244,8 +244,9 @@ class DownloadProvider(private val context: Context) {
|
|||
fun getValidChapterDirNames(chapter: Chapter): List<String> {
|
||||
return listOf(
|
||||
getChapterDirName(chapter),
|
||||
getChapterDirName(chapter, true),
|
||||
// Legacy chapter directory name used in v0.8.4 and before
|
||||
DiskUtil.buildValidFilename(chapter.name),
|
||||
)
|
||||
).distinct()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ fun syncChaptersWithSource(
|
|||
ChapterRecognition.parseChapterNumber(sourceChapter, manga)
|
||||
|
||||
if (shouldUpdateDbChapter(dbChapter, sourceChapter)) {
|
||||
if (dbChapter.name != sourceChapter.name &&
|
||||
if ((dbChapter.name != sourceChapter.name || dbChapter.scanlator != sourceChapter.scanlator) &&
|
||||
downloadManager.isChapterDownloaded(dbChapter, manga)
|
||||
) {
|
||||
downloadManager.renameChapter(source, manga, dbChapter, sourceChapter)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue