fix(tracker): Fix tracking for enhanced services (#1355)

This commit is contained in:
Secozzi 2024-01-26 14:24:44 +00:00 committed by GitHub
parent c2ab0db7a2
commit 97467c84d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 20 deletions

View file

@ -30,9 +30,9 @@ class RefreshAnimeTracks(
.map { (track, service) ->
async {
return@async try {
val updatedTrack = service!!.animeService.refresh(track.toDbTrack())
insertTrack.await(updatedTrack.toDomainTrack()!!)
syncEpisodeProgressWithTrack.await(animeId, track, service.animeService)
val updatedTrack = service!!.animeService.refresh(track.toDbTrack()).toDomainTrack()!!
insertTrack.await(updatedTrack)
syncEpisodeProgressWithTrack.await(animeId, updatedTrack, service.animeService)
null
} catch (e: Throwable) {
service to e

View file

@ -30,9 +30,9 @@ class RefreshMangaTracks(
.map { (track, service) ->
async {
return@async try {
val updatedTrack = service!!.mangaService.refresh(track.toDbTrack())
insertTrack.await(updatedTrack.toDomainTrack()!!)
syncChapterProgressWithTrack.await(mangaId, track, service.mangaService)
val updatedTrack = service!!.mangaService.refresh(track.toDbTrack()).toDomainTrack()!!
insertTrack.await(updatedTrack)
syncChapterProgressWithTrack.await(mangaId, updatedTrack, service.mangaService)
null
} catch (e: Throwable) {
service to e

View file

@ -132,24 +132,27 @@ class JellyfinApi(
.awaitSuccess()
.parseAs<ItemsDto>()
}.items
episodes.first {
episodes.firstOrNull {
it.indexNumber!!.equalsTo(track.last_episode_seen)
}.id
}?.id
}
val time = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(Date())
val postUrl = httpUrl.newBuilder().apply {
fragment(null)
removePathSegment(3)
removePathSegment(2)
addPathSegment("PlayedItems")
addPathSegment(itemId)
addQueryParameter("DatePlayed", time)
}.build().toString()
if (itemId != null) {
val time = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(Date())
val postUrl = httpUrl.newBuilder().apply {
fragment(null)
removePathSegment(3)
removePathSegment(2)
addPathSegment("PlayedItems")
addPathSegment(itemId)
addQueryParameter("DatePlayed", time)
}.build().toString()
client.newCall(
POST(postUrl),
).awaitSuccess()
client.newCall(
POST(postUrl),
).awaitSuccess()
}
return getTrackSearch(track.tracking_url)
}