Repository: pymedusa/Medusa

Issue:
Show not getting updated from TMDB
**Describe the bug**
Had another instance where a show did not get updated with new season information from TMDB in Medusa
`Locke & Key` only showed the first season for me today, after clicking on `Full Update` did it go out and fetch the season 2 information.

<html><body>
<!--StartFragment--><h1 class="header">Medusa Configuration</h1> <div data-v-84755812="" id="config-content">

Medusa Info: | Branch:                 master                  Commit:                 729ab4f066034709137edb43440dba7c84959626                  Version:                 0.5.20                  Database:                 44.18
-- | --
Python Version: | 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)]
SSL Version: | OpenSSL 1.1.1l  24 Aug 2021
OS: | Windows-10-10.0.17763-SP0
Locale: | nl_NL.cp1252
Timezone: | W. Europe Standard Time

</div><!--EndFragment-->
</body>
</html>

Don't really have any log files.


Discussion:
`Locke & Key` is the show you're looking for. Always check spelling :)
The spelling was right in Medusa just typed it wrong myself in Github.

@p0psicles Just had another instance of this happening.
Show `Hightown (2020)` did not show second season until I did a Mass Update. Afterwards, it started to download episodes.

Do actually have the old DB that I can share to validate this.

How long was the update overdue?
Did you try looking for some logs related to the show update or season update?
Have you only seen this issues when a new season was added? Like does it properly update now for each week?
Will try to find some time this weekend to look at it.
I think the Locke & Key one was already more than a month, this one a few weeks I think.

What would be the Log section to look for?
Always run with debug enabled and have around 100MB of them 🙂

Have the feeling it is only new seasons that don't get updated.
Does it have issues with anything else related not updating? When Medusa snatches and imports a new episode are thumbnail metadata photos (Kodi 12+) updated fine for new seasons? Please verify this. 
> Does it have issues with anything else related not updating? When Medusa snatches and imports a new episode are thumbnail metadata photos (Kodi 12+) updated fine for new seasons? Please verify this.

I don't generate nfo files so can't really look at that.
Adding new shows will pull all metadata with issues.
No issues with images or anything else.
> show did not get updated with new season information from TMDB in Medusa `Locke & Key` only showed the first season for me 

The next time this happens try refreshing the page in your browser. I've experienced this behavior today and a page refresh fixed it.
Will do but In my case the episodes of the missing season were not snatched because Medusa didn't know to download.
Just had another instance of the Show `Temple`, it did not have a second season, and after I changed the setting `Choose hour to update shows` it triggered a show update for all shows resulting in adding the second season.

The second season was already entered in TMDB 
https://www.themoviedb.org/tv/93177-temple/season/2/changes?filter_key=key&filter=episode
![image](https://user-images.githubusercontent.com/4103090/143248387-947df7eb-d598-4ca0-a26b-209c27032edd.png)

I suspect this is an issue with the api. 
We query this api. https://developers.themoviedb.org/3/changes/get-tv-change-list

So somehow new seasons are not returned in this list? 
So far it's new seasons that did not show up, not sure if that is consistently the case though. I think weekly episode are done okay.

Resolving patch:
diff --git a/medusa/schedulers/show_updater.py b/medusa/schedulers/show_updater.py
--- a/medusa/schedulers/show_updater.py
+++ b/medusa/schedulers/show_updater.py
@@ -38,7 +38,7 @@ def run(self, force=False):
         # Refresh the exceptions_cache from db.
         refresh_exceptions_cache()
 
-        logger.info(u'Started periodic show updates')
+        logger.info('Started periodic show updates')
 
         # Cache for the indexers list of updated show
         indexer_updated_shows = {}
@@ -48,7 +48,7 @@ def run(self, force=False):
         # Loop through the list of shows, and per show evaluate if we can use the .get_last_updated_seasons()
         for show in app.showList:
             if show.paused:
-                logger.info(u'The show {show} is paused, not updating it.', show=show.name)
+                logger.info('The show {show} is paused, not updating it.', show=show.name)
                 continue
 
             indexer_name = indexerApi(show.indexer).name
@@ -56,8 +56,8 @@ def run(self, force=False):
             try:
                 indexer_api = indexerApi(show.indexer).indexer(**indexer_api_params)
             except IndexerUnavailable:
-                logger.warning(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
-                               u'connectivity issues. While trying to look for show updates on show: {show}',
+                logger.warning('Problem running show_updater, Indexer {indexer_name} seems to be having '
+                               'connectivity issues. While trying to look for show updates on show: {show}',
                                indexer_name=indexer_name, show=show.name)
                 continue
 
@@ -78,30 +78,30 @@ def run(self, force=False):
                         last_updates[indexer_name], update_max_weeks
                     )
                 except IndexerUnavailable:
-                    logger.warning(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
-                                   u'connectivity issues while trying to look for show updates on show: {show}',
+                    logger.warning('Problem running show_updater, Indexer {indexer_name} seems to be having '
+                                   'connectivity issues while trying to look for show updates on show: {show}',
                                    indexer_name=indexer_name, show=show.name)
                     continue
                 except IndexerException as error:
-                    logger.warning(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
-                                   u'issues while trying to get updates for show {show}. Cause: {cause!r}',
+                    logger.warning('Problem running show_updater, Indexer {indexer_name} seems to be having '
+                                   'issues while trying to get updates for show {show}. Cause: {cause!r}',
                                    indexer_name=indexer_name, show=show.name, cause=error)
                     continue
                 except RequestException as error:
-                    logger.warning(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
-                                   u'issues while trying to get updates for show {show}. Cause: {cause!r}',
+                    logger.warning('Problem running show_updater, Indexer {indexer_name} seems to be having '
+                                   'issues while trying to get updates for show {show}. Cause: {cause!r}',
                                    indexer_name=indexer_name, show=show.name, cause=error)
 
                     if isinstance(error, HTTPError):
                         if error.response.status_code == 503:
-                            logger.warning(u'API Service offline: '
-                                           u'This service is temporarily offline, try again later.')
+                            logger.warning('API Service offline: '
+                                           'This service is temporarily offline, try again later.')
                         elif error.response.status_code == 429:
-                            logger.warning(u'Your request count (#) is over the allowed limit of (40).')
+                            logger.warning('Your request count (#) is over the allowed limit of (40).')
                     continue
                 except Exception as error:
-                    logger.exception(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
-                                     u'issues while trying to get updates for show {show}. Cause: {cause!r}.',
+                    logger.exception('Problem running show_updater, Indexer {indexer_name} seems to be having '
+                                     'issues while trying to get updates for show {show}. Cause: {cause!r}.',
                                      indexer_name=indexer_name, show=show.name, cause=error)
                     continue
 
@@ -109,15 +109,15 @@ def run(self, force=False):
             # or were not updated within the last X weeks
             if show.indexerid not in indexer_updated_shows.get(show.indexer, []):
                 if show.last_update_indexer > time.time() - 604800 * update_max_weeks:
-                    logger.debug(u'Skipping show update for {show}. Show was not in the '
-                                 u'indexers {indexer_name} list with updated shows and it '
-                                 u'was updated within the last {weeks} weeks.', show=show.name,
+                    logger.debug('Skipping show update for {show}. Show was not in the '
+                                 'indexers {indexer_name} list with updated shows and it '
+                                 'was updated within the last {weeks} weeks.', show=show.name,
                                  indexer_name=indexer_name, weeks=update_max_weeks)
                     continue
 
             # If indexer doesn't have season updates.
             if not hasattr(indexer_api, 'get_last_updated_seasons'):
-                logger.debug(u'Adding the following show for full update to queue: {show}', show=show.name)
+                logger.debug('Adding the following show for full update to queue: {show}', show=show.name)
                 refresh_shows.append(show)
 
             # Else fall back to per season updates.
@@ -127,46 +127,52 @@ def run(self, force=False):
                     updated_seasons = indexer_api.get_last_updated_seasons(
                         [show.indexerid], show.last_update_indexer, update_max_weeks)
                 except IndexerUnavailable:
-                    logger.warning(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
-                                   u'connectivity issues while trying to look for show updates for show: {show}',
+                    logger.warning('Problem running show_updater, Indexer {indexer_name} seems to be having '
+                                   'connectivity issues while trying to look for show updates for show: {show}',
                                    indexer_name=indexer_name, show=show.name)
                     continue
                 except IndexerException as error:
-                    logger.warning(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
-                                   u'issues while trying to get updates for show {show}. Cause: {cause!r}',
+                    logger.warning('Problem running show_updater, Indexer {indexer_name} seems to be having '
+                                   'issues while trying to get updates for show {show}. Cause: {cause!r}',
                                    indexer_name=indexer_name, show=show.name, cause=error)
                     continue
                 except Exception as error:
-                    logger.exception(u'Problem running show_updater, Indexer {indexer_name} seems to be having '
-                                     u'issues while trying to get updates for show {show}. Cause: {cause!r}',
+                    logger.exception('Problem running show_updater, Indexer {indexer_name} seems to be having '
+                                     'issues while trying to get updates for show {show}. Cause: {cause!r}',
                                      indexer_name=indexer_name, show=show.name, cause=error)
                     continue
 
                 if updated_seasons[show.indexerid]:
-                    logger.info(u'{show_name}: Adding the following seasons for update to queue: {seasons}',
+                    logger.info('{show_name}: Adding the following seasons for update to queue: {seasons}',
                                 show_name=show.name, seasons=updated_seasons[show.indexerid])
                     season_updates.append((show.indexer, show, updated_seasons[show.indexerid]))
+                elif show.indexerid in indexer_updated_shows.get(show.indexer, []):
+                    # This show was marked to have an update, but it didn't get a season update. Let's fully
+                    # update the show anyway.
+                    logger.debug('Could not detect a season update, but an update is required. \n'
+                                 'Adding the following show for full update to queue: {show}', show=show.name)
+                    refresh_shows.append(show)
 
         pi_list = []
         # Full refreshes
         for show in refresh_shows:
-            logger.info(u'Full update on show: {show}', show=show.name)
+            logger.info('Full update on show: {show}', show=show.name)
             try:
                 pi_list.append(app.show_queue_scheduler.action.updateShow(show))
             except (CantUpdateShowException, CantRefreshShowException) as e:
-                logger.warning(u'Automatic update failed. Error: {error}', error=e)
+                logger.warning('Automatic update failed. Error: {error}', error=e)
             except Exception as e:
-                logger.error(u'Automatic update failed: Error: {error}', error=e)
+                logger.error('Automatic update failed: Error: {error}', error=e)
 
         # Only update expired season
         for show in season_updates:
-            logger.info(u'Updating season {season} for show: {show}.', season=show[2], show=show[1].name)
+            logger.info('Updating season {season} for show: {show}.', season=show[2], show=show[1].name)
             try:
                 pi_list.append(app.show_queue_scheduler.action.updateShow(show[1], season=show[2]))
             except CantUpdateShowException as e:
-                logger.warning(u'Automatic update failed. Error: {error}', error=e)
+                logger.warning('Automatic update failed. Error: {error}', error=e)
             except Exception as e:
-                logger.error(u'Automatic update failed: Error: {error}', error=e)
+                logger.error('Automatic update failed: Error: {error}', error=e)
 
         ui.ProgressIndicators.setIndicator('dailyUpdate', ui.QueueProgressIndicator('Daily Update', pi_list))
 
@@ -176,20 +182,20 @@ def run(self, force=False):
             try:
                 app.show_queue_scheduler.action.refreshShow(show, True)
             except CantRefreshShowException as e:
-                logger.warning(u'Show refresh on show {show_name} failed. Error: {error}',
+                logger.warning('Show refresh on show {show_name} failed. Error: {error}',
                                show_name=show.name, error=e)
             except Exception as e:
-                logger.error(u'Show refresh on show {show_name} failed: Unexpected Error: {error}',
+                logger.error('Show refresh on show {show_name} failed: Unexpected Error: {error}',
                              show_name=show.name, error=e)
 
         if refresh_shows or season_updates:
             for indexer in set([s.indexer for s in refresh_shows] + [s[1].indexer for s in season_updates]):
                 indexer_api = indexerApi(indexer)
                 self.update_cache.set_last_indexer_update(indexer_api.name)
-                logger.info(u'Updated lastUpdate timestamp for {indexer_name}', indexer_name=indexer_api.name)
-            logger.info(u'Completed scheduling updates on shows')
+                logger.info('Updated lastUpdate timestamp for {indexer_name}', indexer_name=indexer_api.name)
+            logger.info('Completed scheduling updates on shows')
         else:
-            logger.info(u'Completed scheduling updates on shows, but there was nothing to update')
+            logger.info('Completed scheduling updates on shows, but there was nothing to update')
 
         self.amActive = False
 


Test patch: