Skip to content
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

Handle updates through merged chapters #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Zehkul
Copy link

@Zehkul Zehkul commented Oct 30, 2024

When a chapter gets new content server side through chapter merges, not only does the extension not notify the user of this update, but as long as the old data still resides in the cache, it’s straight up impossible to access the new chapter part.

This fix assumes the only way a chapter would have multiple files is through part merges.
Unless multiple files are reported, nothing is changed, so this should be fairly backwards compatible too.

See also:
Kareadita/Kavita#3272

Checklist:

  • Updated extVersionCode value in build.gradle for individual extensions
  • Updated overrideVersionCode or baseVersionCode as needed for all multisrc extensions
  • Referenced all related issues in the PR body (e.g. "Closes #xyz")
  • Added the isNsfw = true flag in build.gradle when appropriate
  • Have not changed source names
  • Have explicitly kept the id if a source's name or language were changed
  • Have tested the modifications by compiling and running the extension through Android Studio

zehkul added 2 commits October 30, 2024 21:26
For example:
ch2 1.zip
ch2 2.zip
Kavita will merge these into one big ch2.
Recognize and handle chapter merges.
Comment on lines 515 to +518
override fun pageListRequest(chapter: SChapter): Request {
return GET("$apiUrl/${chapter.url}", headersBuilder().build())
// remove potential _<part> chapter salt
val chapterId = chapter.url.substringBefore("_")
return GET("$apiUrl/$chapterId", headersBuilder().build())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@majora2007 we sure there won't ever be other underscores apart from the salt one we add, right? Otherwise seems fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the url map to? A special can technically have _ in the name.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url is defined as url = chapter.id.toString().

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So maybe I missed it, how is the underscore being sent?

Copy link
Author

@Zehkul Zehkul Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s not, I’m adding it locally.
<chapterId>_<numberOfFiles>
As ThePromidius points out, this approach would fail if the id somehow already contains an underscore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

3 participants