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

feat: Komga page-based sync #1025

Closed
wants to merge 3 commits into from
Closed

Conversation

RandomNamer
Copy link

As mentioned in issue #236
Page-level read progress sync for Komga based on the current Komga tracker. This is a preliminary implementation, every page turn would be reported to Komga (just like the Komga web app, no rate limit); to sync page progress from Komga, users have to refresh tracker manually (and to ensure the request completes with in the lifecycle of the dialog window).

I was really suprised to see unlike the web app, progress syncing does not work with page indeces when I tried to use Mihon as reader for my Komga server. As I read the code I have doubts on whether multi-device progress syncing should be implemented as a type of tracker or if we need to design new solutions for syncing, e.g. within the extension. I would really like to see your opinions on this feature.

@kanjieater
Copy link

app-dev-arm64-v8a-preview.apk.zip

I've been enjoying using this the last few days. I did notice an issue today.

Playing around with this a bit more. It seems that it didn't sync read progress on a completed volume for some reason.

so i was on ch 161 of chainsaw man. Both mihon and komga were set as page 2. I read through 162 on mihon. Opened to page 3 of 163

In komga, 161 was still left on page page 2. 162 was left unread, and 163 was on page 3. So it seems like the competed pages, and updated page count of 161 didn't sync for some reason.

Also if i mark something as read on komga, but then start reading it on mihon, it doesn't sync the change back to komga. I marked 163 as read in komga. Then I start reading 163, it doesn't seem to update the page progress.

@RandomNamer
Copy link
Author

so i was on ch 161 of chainsaw man. Both mihon and komga were set as page 2. I read through 162 on mihon. Opened to page 3 of 163

I marked 163 as read in komga. Then I start reading 163, it doesn't seem to update the page progress.

I'm not able to replicate both issues on my end. Have you tried to check the debug logs to see if the read-progress requests are sent as expected? Even if marked read in Mihon, that request is still expected to be sent when start reading it.

@kanjieater
Copy link

kanjieater commented Jul 21, 2024

I'm looking into how to provide debug logs but failing. Happy to provide them if you could tell me how (via adb somehow? or some other way ?). Also happy to debug this in real time with you if you message me on discord at kanjieater

@RandomNamer
Copy link
Author

RandomNamer commented Jul 21, 2024

You can use either adb logcat or Android Studio to inspect these. I just verified debug logs are not shrunk in that apk.

  • adb cli: adb logcat "*:S" "KomgaApi:D"
image - Android Studio: image

@kanjieater
Copy link

You can use either adb logcat or Android Studio to inspect these. I just verified debug logs are not shrunk in that apk.

  • adb cli: adb logcat "*:S" "KomgaApi:D"

image - Android Studio: image

Chainsaw man had no logs shown. Eyeshield 21 did show working logs though

D:\Program Files (x86)\scrcpy-win64>adb logcat -s "ce061716626c0b1b037e" "KomgaApi:D"
--------- beginning of main
--------- beginning of system
07-21 11:21:19.668 25012 25289 E KomgaApi: update progress to 138 with Response{protocol=h2, code=204, message=, url=https://ko.shke.xyz/api/v1/books/0GAA9F50F5PMB/read-progress}
07-21 11:21:29.577 25012 25883 E KomgaApi: update progress to 139 with Response{protocol=h2, code=204, message=, url=https://ko.shke.xyz/api/v1/books/0GAA9F50F5PMB/read-progress}
07-21 11:21:32.188 25012 25918 E KomgaApi: update progress to 138 with Response{protocol=h2, code=204, message=, url=https://ko.shke.xyz/api/v1/books/0GAA9F50F5PMB/read-progress}```

@kanjieater
Copy link

kanjieater commented Jul 21, 2024

Something i haven't read like chainsaw man 165 does show logs though. Just confirmed with a different series that i've not used on your fork yet. It doesn't track progress for something that's marked as read in mihon.

Case 1: Figured out that as long as komga thinks it's unread, you open the Tracker window, tachiyomi takes that state from komga.

I'm still unclear how I read 162 of chiansaw man, but then it didn't sync it back to komga, but I can't figure out how to reproduce yet

Case 2: If you mark it as unread in komga, then sync from mihon. Mihon will overwrite whatever komga had. I think marked it as unread in mihon and komga, and it synced together. Both are now tracking now that they are in sync for the series

Case 3:
Offline: Read a book, go on to next chapter, come back online. Komga will sync new pages read, but needs to by synced with the mihon tracker open button to sync the full read vol progress

Almost seems like the best practice for using it would be to always open the Tracker button first to make sure the server didn't get any updates, then start reading. I'm thinking across devices that the server could have been updated (unless the user were to be keeping devices in sync via something like SyncYomi)

@RandomNamer
Copy link
Author

RandomNamer commented Jul 21, 2024

Something i haven't read like chainsaw man 165 does show logs though

Currently all chapters prior to your last read are ignored from syncing. I think I can change that for page trackers.

If you mark it as unread in komga, then sync from mihon. Mihon will overwrite whatever komga had.

This is expected, since the current trakcer uses /api/v2/series/{seriesId}/read-progress/tachiyomi to update the series progress to lastBookNumberSortRead . Komga will then mark all chapters prior to that as read. I'm not changing that.

but needs to by synced with the mihon tracker open button to sync the full read vol progress

Volume read status is handled by old logic of Komga tracker and it's updated by clicking the button and open the tracker window. All updates should be completed within the lifecycle of that Window. The app won't keep a event stream connection to the server so no real-time bidirectional sync: sync to Komga is real time, sync back is triggered when open tracker window.

@kanjieater
Copy link

@RandomNamer looks like this is closed now? I'm hoping we can keep progress rolling on this! 😊 Any chance of reopening it?

@RandomNamer
Copy link
Author

Migrated to a new branch, did a overhual and it's now at #1032

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants