From 67cfcd5bddad9c56172855f6a4be67d5bcaf20eb Mon Sep 17 00:00:00 2001 From: danielerl <64637430+danielerl@users.noreply.github.com> Date: Mon, 4 Sep 2023 10:03:16 +0200 Subject: [PATCH] Fall back to Trakt runtime when calculating movie progress --- resources/lib/syncMovies.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/lib/syncMovies.py b/resources/lib/syncMovies.py index 8218a104..89bf500e 100644 --- a/resources/lib/syncMovies.py +++ b/resources/lib/syncMovies.py @@ -329,6 +329,12 @@ def __addMovieProgressToKodi(self, traktMovies, kodiMovies, fromPercent, toPerce self.sync.UpdateProgress(fromPercent, line1='', line2=kodiUtilities.getString( 32126) % len(kodiMoviesToUpdate)) + # If library item doesn't have a runtime set get it from + # Trakt to avoid later using 0 in runtime * progress_pct. + for movie in kodiMoviesToUpdate: + if not movie['runtime']: + movie['runtime'] = self.sync.traktapi.getMovieSummary( + movie['ids']['trakt'], extended='full').runtime * 60 # need to calculate the progress in int from progress in percent from Trakt # split movie list into chunks of 50 chunksize = 50