Repository: pymedusa/Medusa

Issue:
Plot information not showing (API v2)
![404](https://snapr.pw/i/c734f6177e.png)

![log](https://snapr.pw/i/3a7a146873.png)

![req](https://snapr.pw/i/da51d75987.png)

![err](https://snapr.pw/i/7c6b735b1c.png)

- Restarting does nothing.
- After a "Force Full Update" it works again (temporarily) for the updated show.
- Restarting Medusa causes the "updated" shows (see above) to lose the plot information again.
- Using "Re-scan files" makes it work again only for shows that are "Downloaded" (also lost on reboot). 


Discussion:
tested with several episodes of some shows, all good
Looks like an issue in your show and not in api v2
Happens to all shows and it was also confirmed by @OmgImAlexis 
Show 1:
![image](https://cloud.githubusercontent.com/assets/2620870/25088693/9615b670-234e-11e7-8d54-d252a10bd272.png)

Show 2:
![image](https://cloud.githubusercontent.com/assets/2620870/25088712/abf17862-234e-11e7-8441-1ab508e09f98.png)

Show 3:
![image](https://cloud.githubusercontent.com/assets/2620870/25088723/c3854594-234e-11e7-9bf5-dc9cd9226d20.png)


btw all my shows are normal shows. not anime or sports or air-by-date

and Omg also said it could be a cache issue: "Most likely some weird cache issue from the api refactoring."
@fernandog it only happens with an old DB after updating to the latest dev. Happened with both my local and remote installs.
@OmgImAlexis what do you mean by old DB? the api didn't upgrade the DB
A DB that was setup before the latest update. I'm guessing it's a cache issue somewhere along the lines. I have a feeling on first `GET` for the endpoint Medusa is still downloading TVDB info and after a few minutes Medusa then has it and all if fine. That's how @medariox and I saw it as we checked right when we first booted Medusa.
that errors points to "episode not found" as it can't create the episode object using database. That's why i said its related to the show, not the api v2 call.

Resolving patch:
diff --git a/medusa/tv/episode.py b/medusa/tv/episode.py
--- a/medusa/tv/episode.py
+++ b/medusa/tv/episode.py
@@ -280,23 +280,19 @@ def find_by_series_and_episode(cls, series, episode_number):
         :rtype: medusa.tv.Episode
         """
         if isinstance(episode_number, RelativeNumber):
-            episode = series.get_episode(season=episode_number.season, episode=episode_number.episode,
-                                         should_cache=False, no_create=True)
+            episode = series.get_episode(season=episode_number.season, episode=episode_number.episode)
         elif isinstance(episode_number, AbsoluteNumber):
-            episode = series.get_episode(absolute_number=episode_number.episode,
-                                         should_cache=False, no_create=True)
+            episode = series.get_episode(absolute_number=episode_number.episode)
 
         elif isinstance(episode_number, AirByDateNumber):
-            episode = series.get_episode(air_date=episode_number.air_date,
-                                         should_cache=False, no_create=True)
+            episode = series.get_episode(air_date=episode_number.air_date)
         else:
             # if this happens then it's a bug!
             raise ValueError
 
         if episode:
-            if not episode.loaded:
-                episode.load_from_db(episode.season, episode.episode)
-            return episode
+            if episode.loaded or episode.load_from_db(episode.season, episode.episode):
+                return episode
 
     @staticmethod
     def from_filepath(filepath):
diff --git a/medusa/tv/series.py b/medusa/tv/series.py
--- a/medusa/tv/series.py
+++ b/medusa/tv/series.py
@@ -711,7 +711,7 @@ def get_episode(self, season=None, episode=None, filepath=None, no_create=False,
         else:
             ep = Episode(self, season, episode)
 
-        if ep is not None and should_cache:
+        if ep is not None and ep.loaded and should_cache:
             self.episodes[season][episode] = ep
 
         return ep


Test patch: