Repository: pymedusa/Medusa

Issue:
Shows shown as backlogged 2 days before airdate
**Describe the bug**
Episodes are shown as wanted / in the backlog two days before the airdate. 

Airdate offset in show advanced setting is 0:

**Expected behavior**
Shows are listed as wanted and in backlog if airdate has passed current date. 

**Screenshots**
![AD3F827F-2D86-4D2F-BA9D-059FC9F4232E](https://user-images.githubusercontent.com/24984994/168869821-d50b45d3-d143-47b1-9b90-11cd60eaf0a9.jpeg)
![B6F3C414-6FF6-48A3-9917-0023CAFB0541](https://user-images.githubusercontent.com/24984994/168869798-584c9af1-84fb-47c9-9571-e45c3f327e13.png).

**Medusa (please complete the following information):**


Medusa Info: | Branch: master Commit: e4870f8f4a322e67c77434597ccc09aa6524aa05 Version: 0.5.29 Database: 44.19
-- | --
Python Version: | 3.10.4 (main, Apr 12 2022, 17:17:33) [GCC 8.4.0]
SSL Version: | OpenSSL 1.1.1n 15 Mar 2022
OS: | Linux-4.2.8-armv7l-with-glibc2.27
Locale: | Unknown.Unknown
Timezone: | CEST

Medusa Info:	Branch: [master](https://github.com/pymedusa/Medusa/tree/master) 
Commit: [e4870f8f4a322e67c77434597ccc09aa6524aa05](https://github.com/pymedusa/Medusa/commit/e4870f8f4a322e67c77434597ccc09aa6524aa05) 
Version: [0.5.29](https://github.com/pymedusa/Medusa/releases/tag/v0.5.29) 
Database: 44.19
 Python Version:	3.10.4 (main, Apr 12 2022, 17:17:33) [GCC 8.4.0]
 SSL Version:	OpenSSL 1.1.1n 15 Mar 2022
 OS:	Linux-4.2.8-armv7l-with-glibc2.27
 Locale:	Unknown.Unknown
Timezone:	CEST




Discussion:
Is this something that reproduces each week / episode for this show?
Could you enable debug log, restart. and try reproduce the issue. I'd need to check your logs.
Will do, there are not too many shows airing atm so I’ll try to reproduce it later because it’s def happening for ST SNW
pw: RP4S9KxYX2
https://pastebin.com/dR9PLUQ7

I performed a restart with DEBUG enabled. Show backlog was empty. 
After a while it was populated again with the incorrect entries: 
![image](https://user-images.githubusercontent.com/24984994/169005781-6443437e-f34b-478a-8599-9a8f46efd333.png)

They have already been changed to wanted before you enabled debug. So you'll want to catch the moment itll change a new ep to wanted pre maturely
I just performed a full force update on one of the shows, it reverts to unaired. Debug is till on. I expect this to change to wanted in a bit. 
can confirm: 
![image](https://user-images.githubusercontent.com/24984994/169013976-2f9694b6-74ad-45ee-8eb2-b57bb9cd4954.png)
I updated the pastebin with the latest update starting with the time I pushed the force update on the show.

there are currently two other examples but I limited the log creation to one. 
Let me know if I should provide additional log entries for the next event. I’ve just kept Debug log level on for now. 
With two new EPs coming up, issue reoccurs reliably. 
I can't access your pastebin. Can you PM me on discord?
NVM, too little coffee, I just joined the medusa discord :)=

Resolving patch:
diff --git a/medusa/indexers/tvmaze/api.py b/medusa/indexers/tvmaze/api.py
--- a/medusa/indexers/tvmaze/api.py
+++ b/medusa/indexers/tvmaze/api.py
@@ -219,6 +219,11 @@ def _get_show_by_id(self, tvmaze_id, request_language='en'):  # pylint: disable=
             return
 
         mapped_results = self._map_results(results, self.series_map)
+
+        # Sanitize the airs_time. As for some shows this might be missing.
+        if not mapped_results.get('airs_time'):
+            mapped_results['airs_time'] = '0:00AM'
+
         return OrderedDict({'series': mapped_results})
 
     def _get_episodes(self, tvmaze_id, specials=False, *args, **kwargs):  # pylint: disable=unused-argument
diff --git a/medusa/tv/series.py b/medusa/tv/series.py
--- a/medusa/tv/series.py
+++ b/medusa/tv/series.py
@@ -1638,6 +1638,12 @@ def load_from_indexer(self, tvapi=None, limit_seasons=None):
         if getattr(indexed_show, 'airs_dayofweek', '') and getattr(indexed_show, 'airs_time', ''):
             self.airs = '{airs_day_of_week} {airs_time}'.format(airs_day_of_week=indexed_show['airs_dayofweek'],
                                                                 airs_time=indexed_show['airs_time'])
+        else:
+            log.info(
+                '{id}: We could not determin a specific `airs_dayofweek` or `airs_time` for the show: {show}'
+                '\n We might start searching early for episodes.',
+                {'id': self.series_id, 'show': self.name}
+            )
 
         self.status = self.normalize_status(getattr(indexed_show, 'status', None))
 


Test patch: