-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add advanced Library setting to allow library manga's titles to update from source #1182
base: main
Are you sure you want to change the base?
Conversation
I was considering putting this under the "Automatically update metadata" setting under Library settings; unsure whether it should go there or under Advanced, given how it's a slightly more dangerous setting when it comes to Download handling. I need advice on better download handling for this PR before I move it out of draft, as while a simple rename works for some cases, it doesn't handle the edge case of existing folder nor do I do any cache handling yet. Another discussion that came up is changing the Auto-update metadata setting (or this setting) to be a multiselect preference with the various metadata fields as options, such that a user can choose to e.g. update Title but preserve Cover (for whatever purpose). Unsure if that's overdoing it here. |
eee3ad2
to
8f6e3b9
Compare
056a194
to
88fb20d
Compare
* @param manga the manga to rename | ||
* @param newTitle the new manga title. | ||
*/ | ||
fun renameManga(source: Source, manga: Manga, newTitle: String) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen with downloading
entries, all those _tmp
files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user gets "an unknown error occured" and has to retry the download. This is an existing case if a user tries to download manga that isn't in their library and then refreshes the info so the title changes, as well.
The exception is:
Failed to createFile
java.lang.IllegalArgumentException: Failed to determine if primary:Tachi/downloads/MangaDex (EN)/pants/Puzzle Kings_Ch.54_tmp is child of primary:Tachi: java.io.FileNotFoundException: Missing file for primary:Tachi/downloads/MangaDex (EN)/pants/Puzzle Kings_Ch.54_tmp at /storage/emulated/0/Tachi/downloads/MangaDex (EN)/pants/Puzzle Kings_Ch.54_tmp
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
at android.content.ContentProviderProxy.call(ContentProviderNative.java:732)
at android.content.ContentResolver.call(ContentResolver.java:2450)
at android.provider.DocumentsContract.createDocument(DocumentsContract.java:1380)
at com.hippo.unifile.DocumentsContractApi21.createFile(DocumentsContractApi21.java:56)
at com.hippo.unifile.TreeDocumentFile.createFile(TreeDocumentFile.java:86)
at eu.kanade.tachiyomi.data.download.Downloader$downloadImage$2.invokeSuspend(Downloader.kt:478)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:113)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:820)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made it so that a manga gets removed from queue if it's getting renamed; this will handle both the new case of in-library manga as well as the existing case of non-library manga that are being downloaded when the name change happens.
Needs cache handling before this can be merged; right now, if a manga gets renamed in this way, the download cache doesn't know about it and the cache still thinks the old manga dir has the downloads, not the new one. |
Time to migrate to use something like |
7a48484
to
50a4479
Compare
This adds a setting under Advanced > Library to allow any entry, not just favorites, to update their titles from source.
It attempts to move the downloaded files as well by renaming the entry's download folder. It does not currently attempt to move downloaded files into an existing folder (if another title exists/conflicts).
A bit of context from the previous change to allow non-favorites to update title from source: 58a871c
Tested cases:
Images