trakt / script.trakt

Trakt.tv movie and TV show scrobbler for Kodi
GNU General Public License v2.0
318 stars 149 forks source link

Endless while-loop when PVR scrobbling option is enabled #595

Open thomazz-nl opened 2 years ago

thomazz-nl commented 2 years ago

When PVR scrobbling is enabled and playing a recording that misses some fields in the infolabel (year), the code tries to lookup the show/seasons and match each of their episode titles with the one from the recording. It get's stuck in an endless loop, resulting in a huge logfile and spamming Trakt with requests.

Expected Behavior

I'd expect the script to do one round of matching the recording title to each season's episode titles, but give up if it fails to find a match.

Current Behavior

The while loop here keeps repeating in an endless loop if the recording title does not match any title of the episode titles provided by Trakt (perhaps because it's a localized title on the recording, a wrong title on Trakt or result of bad EPG info). Since the call to "globals.traktapi.getShowWithAllEpisodesList()" is inside the loop, the script is pretty much flooding Trakt with requests...

Possible Solution

The purpose for the while loop seems to be to retry the trakt request if it fails (but with ill side-effects), I suggest just removing the while loop so the code inside only executes once. On a side note, why is the option called "scrobble_mythtv_pvr"? It seems to be more generic than that (I use Tvheadend), so perhaps renaming it to just "scrobble_pvr" makes more sense?

Steps to Reproduce (for bugs)

  1. Enable Kodi debug logging.
  2. Enable Trakt logging.
  3. Enable Trakt PVR scrobbling.
  4. Play a recording with the following info in the infolabel: VideoPlayer.EpisodeName, VideoPlayer.Season, VideoPlayer.Episode (but not VideoPlayer.Year).
  5. For completeness the Player.Filename value is Gold Rush s12e24 (1601) Buckets Full of Gold, TV (Discovery HD), 20220404_182000, 1891807697.pvr (I'm contacting Kodi team to find out why it puts the year 1601 there).
  6. Check the log fast before it grows into millions of lines length.

Context

I'll let the summarized log (last part repeats continuously) provide the context: tvheadend-trakt-log.txt

Your Environment

razzeee commented 2 years ago

On a side note, why is the option called "scrobble_mythtv_pvr"? It seems to be more generic than that (I use Tvheadend), so perhaps renaming it to just "scrobble_pvr" makes more sense?

Has been the case, since I inherited this addon, but I really haven't used this with pvr, so I wouldn't know, that it works with other pvr addons or not.