Permalink
Browse files

New Python function: toggle_new (for toggling episode state)

  • Loading branch information...
thp committed Jan 30, 2014
1 parent ef279bb commit 3579f4bfe2891852bbd357dc786a4ee6783fded9
Showing with 13 additions and 0 deletions.
  1. +13 −0 main.py
View
13 main.py
@@ -117,6 +117,7 @@ def convert_episode(self, episode):
'title': episode.trimmed_title,
'progress': episode.download_progress(),
'downloadState': episode.state,
+ 'isNew': episode.is_new,
}
def load_episodes(self, id):
@@ -197,6 +198,14 @@ def delete_episode(self, episode_id):
pyotherside.send('deleted', episode_id)
pyotherside.send('update-stats')
+ @run_in_background_thread
+ def toggle_new(self, episode_id):
+ episode = self._get_episode_by_id(episode_id)
+ episode.is_new = not episode.is_new
+ episode.save()
+ self.core.save()
+ pyotherside.send('is-new-changed', episode_id, episode.is_new)
+
@run_in_background_thread
def check_for_episodes(self):
if self._checking_for_new_episodes:
@@ -222,6 +231,9 @@ def check_for_episodes(self):
def play_episode(self, episode_id):
episode = self._get_episode_by_id(episode_id)
+ episode.playback_mark()
+ self.core.save()
+ pyotherside.send('is-new-changed', episode_id, episode.is_new)
return {
'source': episode.local_filename(False)
if episode.state == gpodder.STATE_DOWNLOADED
@@ -256,3 +268,4 @@ def show_episode(self, episode_id):
get_fresh_episodes_summary = gpotherside.get_fresh_episodes_summary
download_episode = gpotherside.download_episode
delete_episode = gpotherside.delete_episode
+toggle_new = gpotherside.toggle_new

0 comments on commit 3579f4b

Please sign in to comment.