File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -226,8 +226,16 @@ def reload(self, display=None) -> None:
226226 else :
227227 new_feed = Feed (file = feed .key )
228228
229+ # keep user metadata for episodes intact
230+ new_episodes = new_feed .parse_episodes ()
231+ old_episodes = self .episodes (feed )
232+ for new_ep in new_episodes :
233+ matching_olds = [old_ep for old_ep in old_episodes if old_ep .title == new_ep .title ]
234+ if len (matching_olds ) == 1 :
235+ new_ep .replace_from (matching_olds [0 ])
236+
229237 self .replace_feed (new_feed )
230- self .replace_episodes (new_feed , new_feed . parse_episodes () )
238+ self .replace_episodes (new_feed , new_episodes )
231239
232240 if display is not None :
233241 display .change_status ("Feeds successfully reloaded" )
Original file line number Diff line number Diff line change @@ -170,6 +170,14 @@ def check_downloaded(self) -> bool:
170170 self ._downloaded = True
171171 return self ._downloaded
172172
173+ def replace_from (self , episode ) -> None :
174+ """Replace user-specific metadata from the given episode.
175+
176+ Args:
177+ episode: the source Episode
178+ """
179+ self ._played = episode ._played
180+
173181 @property
174182 def downloaded (self ) -> bool :
175183 """Determines whether the episode is downloaded.
You can’t perform that action at this time.
0 commit comments