-
Notifications
You must be signed in to change notification settings - Fork 149
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
Fix: Sync progress to library when no runtime info #479
Conversation
TVDB does not provide runtime metadata for episodes. If this can not then be filled by Kodi introspecting the file for the item (e.g. library item that is a .STRM file) the info label will be `0`. Meaning the resume position set by Trackt will be `0` as the calculation is `runtime * progress_pct`. Episode runtime metadata exists in the metadata provided by Trakt for episodes so this can be queried in these cases to calculate a resume time that is reasonably accurate. This depends on fuzeman/trakt.py#69 being merged and propagated to Razzeee/script.module.trakt
1 similar comment
First of all, thank you :) Does this affect movies too, as you only updated the episode code? |
It may potentially though I have not seen it in practice as TMDB provides
I didn't notice any perceptible major slowdown but my Trakt account doesn't have |
Now that you repeat it, tvdb has runtime data, but only on the show level. So is your scraper having problems or did you find an episode where the show was just recently created? |
I'm using the metadata scraper I'd still say there is some logic to be fixed here even if it's to simply skip Not sure what connection this GitHub project has to Trakt itself, but being |
After investigating the plugin I paused a few episodes that produce this issue in an attempt to increase the The code used to produce the following log is additional_calls = []
episodes = []
for show in kodiShowsUpdate['shows']:
for season in show['seasons']:
for episode in season['episodes']:
if not episode['runtime']:
starttime = time.time()
episode['runtime'] = Trakt['shows'].episode(show['ids']['trakt'], season['number'], episode['number'], extended='full').runtime
additional_calls.append(time.time() - starttime)
episodes.append({'episodeid': episode['ids']['episodeid'], 'progress': episode['progress'], 'runtime': episode['runtime']})
xbmc.log('Extra API Calls N: ' + str(len(additional_calls)), xbmc.LOGERROR)
xbmc.log('Extra API Calls SUM: ' + str(sum(additional_calls)), xbmc.LOGERROR)
xbmc.log('Extra API Calls AVG: ' + str(sum(additional_calls)/float(len(additional_calls))), xbmc.LOGERROR)
def pct(p, nums):
x = (p / 100.0) * (len(nums) + 1)
if x >= len(nums):
return nums[-1]
a, b = nums[int(x-1):int(x+1)]
return a + x % 1 * (b - a)
additional_calls.sort()
xbmc.log('Extra API Calls P50: ' + str(pct(50, additional_calls)), xbmc.LOGERROR)
xbmc.log('Extra API Calls P90: ' + str(pct(90, additional_calls)), xbmc.LOGERROR)
xbmc.log('Extra API Calls P95: ' + str(pct(95, additional_calls)), xbmc.LOGERROR)
Then taking into account
|
Did you check if you actually have cases where |
I can confirm the tag is set in the cases where it is parsable from the source, and is preferred https://github.com/xbmc/xbmc/blob/35a72fdf51cde38de22505799533f50abc460a74/xbmc/video/VideoInfoTag.cpp#L1232-L1243 |
Thank you, I'll merge for now even if we're waiting for upstream to align. |
TVDB does not provide runtime metadata for episodes. If this can not then be
filled by Kodi introspecting the file for the item (e.g. library item that is
a .STRM file) the info label will be
0
. Meaning the resume position set byTrackt will be
0
as the calculation isruntime * progress_pct
.Episode runtime metadata exists in the metadata provided by Trakt for episodes
so this can be queried in these cases to calculate a resume time that is
reasonably accurate.
This depends on fuzeman/trakt.py#69 being merged and propagated to
Razzeee/script.module.trakt