iamkroot/trakt-scrobbler

[BUG] Use absolute episode number when available

Uriei opened this issue · 1 comments

Uriei commented

Describe the bug

Some shows have an absolute episode number in their episode data, apart from the "in-season" episode number, this app seems to not be using it when it can't find the episode, right now the show I'm watching has 2 seasons of 13 episodes each on trakt.tv but I got it as a single season of 26 episodes.

Would it be possible to make it use the field "number_abs" (if present) when calling the API if it can't find it with the normal numbering?

The show I'm watching is Senyu.

     Title Senyu
      Year 2013
      Type Show
MatchScore 27.1612 (Warning! Very low score! Check your search query)
    Status Ended
  Overview In the story, a gigantic hole suddenly opened up in the world one day, and demons appeared. The
           king thinks that this portends the return of the demon king Rukimedesu, who was sealed away by the hero
           Kureashion a millenium ago. The king decreed that the descendants of the hero must take on the threat, and 75
           people showed up. Hero No. 45 (Aruba) and a sadistic palace warrior (Ross) team up, and their adventure
           begins.
  Trakt ID 68739
 Trakt URL https://trakt.tv/shows/senyu
  IMDB URL https://imdb.com/title/tt2552188

Desktop (please complete the following information):

  • OS and Version: Win10
  • Python Version: 3.11.0
  • Player and Version: mpc-be x64 1.6.3

To Reproduce
Steps to reproduce the behavior:

  1. Open any file from "season 2"
  2. Won't start scrobbling.
  3. See error in log file

Log file

Click to see log contents

2023-01-01 16:25:16,410 - INFO - MainThread - scrobbler - Started scrobbler thread.
2023-01-01 16:25:16,427 - INFO - MainThread - monitor - Started monitor for mpc-be
2023-01-01 16:25:18,435 - DEBUG - mpc-be - file_info - Raw filepath 'U:\\Anime\\Senyuu\\[HorribleSubs] Senyuu - 14 [720p].mkv'
2023-01-01 16:25:18,436 - DEBUG - mpc-be - file_info - Matched whitelist entry 'U:\\'
2023-01-01 16:25:18,521 - DEBUG - mpc-be - file_info - Guess: MatchesDict([('title', 'Senyuu'), ('release_group', 'HorribleSubs'), ('episode', 14), ('screen_size', '720p'), ('container', 'mkv'), ('mimetype', 'video/x-matroska'), ('type', 'episode')])
2023-01-01 16:25:18,521 - DEBUG - mpc-be - monitor - action=scrobble
2023-01-01 16:25:18,521 - DEBUG - mpc-be - monitor - {'state': 1, 'progress': 12.94, 'media_info': {'type': 'episode', 'title': 'Senyuu', 'season': 1, 'episode': 14}, 'updated_at': 1672586718.52137}
2023-01-01 16:25:18,522 - DEBUG - scrobbler - scrobbler - Scrobbling pause at 12.94% for Senyuu
2023-01-01 16:25:19,009 - WARNING - scrobbler - utils - Request failed
2023-01-01 16:25:19,009 - DEBUG - scrobbler - utils - Request: post {'url': 'https://api.trakt.tv/scrobble/pause', 'headers': {'Content-Type': 'application/json', 'trakt-api-key': 'XXXXXXXXXXXXXXXXXXXXXXXXXX', 'trakt-api-version': '2', 'Authorization': 'Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'}, 'json': {'show': {'ids': {'trakt': 68739}}, 'episode': {'season': 1, 'number': 14}, 'progress': 12.94}, 'timeout': 30}
2023-01-01 16:25:19,009 - DEBUG - scrobbler - utils - Response: <Response [404]> 
2023-01-01 16:25:19,009 - WARNING - scrobbler - trakt_interface - Not found on trakt. The media info is incorrect.
2023-01-01 16:25:19,009 - WARNING - scrobbler - scrobbler - Scrobble unsuccessful. Discarding it.
2023-01-01 16:25:30,526 - DEBUG - mpc-be - file_info - Raw filepath 'U:\\Anime\\Senyuu\\[HorribleSubs] Senyuu - 13 [720p].mkv'
2023-01-01 16:25:30,526 - DEBUG - mpc-be - file_info - Matched whitelist entry 'U:\\'
2023-01-01 16:25:30,534 - DEBUG - mpc-be - file_info - Guess: MatchesDict([('title', 'Senyuu'), ('release_group', 'HorribleSubs'), ('episode', 13), ('screen_size', '720p'), ('container', 'mkv'), ('mimetype', 'video/x-matroska'), ('type', 'episode')])
2023-01-01 16:25:30,534 - DEBUG - mpc-be - monitor - action=stop_previous
2023-01-01 16:25:30,535 - DEBUG - mpc-be - monitor - action=scrobble
2023-01-01 16:25:30,535 - DEBUG - scrobbler - scrobbler - Scrobbling stop at 12.94% for Senyuu
2023-01-01 16:25:30,535 - DEBUG - mpc-be - monitor - {'state': 2, 'progress': 2.42, 'media_info': {'type': 'episode', 'title': 'Senyuu', 'season': 1, 'episode': 13}, 'updated_at': 1672586730.5344381}
2023-01-01 16:25:30,951 - WARNING - scrobbler - utils - Request failed
2023-01-01 16:25:30,951 - DEBUG - scrobbler - utils - Request: post {'url': 'https://api.trakt.tv/scrobble/stop', 'headers': {'Content-Type': 'application/json', 'trakt-api-key': 'XXXXXXXXXXXXXXXXXXXXXXXXXX', 'trakt-api-version': '2', 'Authorization': 'Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'}, 'json': {'show': {'ids': {'trakt': 68739}}, 'episode': {'season': 1, 'number': 14}, 'progress': 12.94}, 'timeout': 30}
2023-01-01 16:25:30,951 - DEBUG - scrobbler - utils - Response: <Response [404]> 
2023-01-01 16:25:30,951 - WARNING - scrobbler - trakt_interface - Not found on trakt. The media info is incorrect.
2023-01-01 16:25:30,951 - WARNING - scrobbler - scrobbler - Scrobble unsuccessful. Discarding it.
2023-01-01 16:25:30,951 - DEBUG - scrobbler - scrobbler - Scrobbling start at 2.42% for Senyuu
2023-01-01 16:25:31,146 - INFO - scrobbler - scrobbler - Scrobble start successful for Senyu S01E13 at 2.42%
2023-01-01 16:25:42,543 - DEBUG - mpc-be - monitor - action=stop_previous
2023-01-01 16:25:42,543 - DEBUG - mpc-be - monitor - action=scrobble
2023-01-01 16:25:42,543 - DEBUG - scrobbler - scrobbler - Scrobbling stop at 2.42% for Senyuu
2023-01-01 16:25:42,544 - DEBUG - mpc-be - monitor - {'state': 2, 'progress': 2.09, 'media_info': {'type': 'episode', 'title': 'Senyuu', 'season': 1, 'episode': 14}, 'updated_at': 1672586742.543228}
2023-01-01 16:25:42,950 - INFO - scrobbler - scrobbler - Scrobble pause successful for Senyu S01E13 at 2.42%
2023-01-01 16:25:42,951 - DEBUG - scrobbler - scrobbler - Scrobbling start at 2.09% for Senyuu
2023-01-01 16:25:43,347 - WARNING - scrobbler - utils - Request failed
2023-01-01 16:25:43,347 - DEBUG - scrobbler - utils - Request: post {'url': 'https://api.trakt.tv/scrobble/start', 'headers': {'Content-Type': 'application/json', 'trakt-api-key': 'XXXXXXXXXXXXXXXXXXXXXXXXXX', 'trakt-api-version': '2', 'Authorization': 'Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'}, 'json': {'show': {'ids': {'trakt': 68739}}, 'episode': {'season': 1, 'number': 14}, 'progress': 2.09}, 'timeout': 30}
2023-01-01 16:25:43,347 - DEBUG - scrobbler - utils - Response: <Response [404]> 
2023-01-01 16:25:43,347 - WARNING - scrobbler - trakt_interface - Not found on trakt. The media info is incorrect.
2023-01-01 16:25:43,347 - WARNING - scrobbler - scrobbler - Scrobble unsuccessful. Discarding it.
2023-01-01 16:26:06,552 - DEBUG - mpc-be - monitor - action=scrobble
2023-01-01 16:26:06,552 - DEBUG - mpc-be - monitor - {'state': 1, 'progress': 7.44, 'media_info': {'type': 'episode', 'title': 'Senyuu', 'season': 1, 'episode': 14}, 'updated_at': 1672586766.5521164}
2023-01-01 16:26:06,552 - DEBUG - scrobbler - scrobbler - Scrobbling pause at 7.44% for Senyuu
2023-01-01 16:26:06,681 - WARNING - scrobbler - utils - Request failed
2023-01-01 16:26:06,681 - DEBUG - scrobbler - utils - Request: post {'url': 'https://api.trakt.tv/scrobble/pause', 'headers': {'Content-Type': 'application/json', 'trakt-api-key': 'XXXXXXXXXXXXXXXXXXXXXXXXXX', 'trakt-api-version': '2', 'Authorization': 'Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'}, 'json': {'show': {'ids': {'trakt': 68739}}, 'episode': {'season': 1, 'number': 14}, 'progress': 7.44}, 'timeout': 30}
2023-01-01 16:26:06,681 - DEBUG - scrobbler - utils - Response: <Response [404]> 
2023-01-01 16:26:06,682 - WARNING - scrobbler - trakt_interface - Not found on trakt. The media info is incorrect.
2023-01-01 16:26:06,682 - WARNING - scrobbler - scrobbler - Scrobble unsuccessful. Discarding it.

See #199.
For now, you can use the mediainfo remapping feature to send the correct scrobbles to Trakt. (Feel free to ask for help if you are unable to figure it out)