Skip to content

Commit

Permalink
fix(tracker): Fix tracking for enhanced services (#1355)
Browse files Browse the repository at this point in the history
  • Loading branch information
Secozzi authored Jan 26, 2024
1 parent c2ab0db commit 97467c8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

client.newCall(
POST(postUrl),
).awaitSuccess()
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()
}

return getTrackSearch(track.tracking_url)
}
Expand Down

0 comments on commit 97467c8

Please sign in to comment.