Skip to content

Commit

Permalink
New Python function: toggle_new (for toggling episode state)
Browse files Browse the repository at this point in the history
  • Loading branch information
thp committed Jan 30, 2014
1 parent ef279bb commit 3579f4b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions main.py
Expand Up @@ -117,6 +117,7 @@ def convert_episode(self, episode):
'title': episode.trimmed_title, 'title': episode.trimmed_title,
'progress': episode.download_progress(), 'progress': episode.download_progress(),
'downloadState': episode.state, 'downloadState': episode.state,
'isNew': episode.is_new,
} }


def load_episodes(self, id): def load_episodes(self, id):
Expand Down Expand Up @@ -197,6 +198,14 @@ def delete_episode(self, episode_id):
pyotherside.send('deleted', episode_id) pyotherside.send('deleted', episode_id)
pyotherside.send('update-stats') 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 @run_in_background_thread
def check_for_episodes(self): def check_for_episodes(self):
if self._checking_for_new_episodes: if self._checking_for_new_episodes:
Expand All @@ -222,6 +231,9 @@ def check_for_episodes(self):


def play_episode(self, episode_id): def play_episode(self, episode_id):
episode = self._get_episode_by_id(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 { return {
'source': episode.local_filename(False) 'source': episode.local_filename(False)
if episode.state == gpodder.STATE_DOWNLOADED if episode.state == gpodder.STATE_DOWNLOADED
Expand Down Expand Up @@ -256,3 +268,4 @@ def show_episode(self, episode_id):
get_fresh_episodes_summary = gpotherside.get_fresh_episodes_summary get_fresh_episodes_summary = gpotherside.get_fresh_episodes_summary
download_episode = gpotherside.download_episode download_episode = gpotherside.download_episode
delete_episode = gpotherside.delete_episode delete_episode = gpotherside.delete_episode
toggle_new = gpotherside.toggle_new

0 comments on commit 3579f4b

Please sign in to comment.