Esempio n. 1
0
    def _format_published_section(self, now, tnow, published):
        diff = (tnow - published)

        if diff < 60 * 60 * 24 * 7:
            return util.format_date(published)

        dt = datetime.datetime.fromtimestamp(published)
        if dt.year == now.year:
            return dt.strftime('%B %Y')

        return dt.strftime('%Y')
Esempio n. 2
0
    def _format_published_section(self, now, tnow, published):
        diff = (tnow - published)

        if diff < 60 * 60 * 24 * 7:
            return util.format_date(published)

        dt = datetime.datetime.fromtimestamp(published)
        if dt.year == now.year:
            return dt.strftime('%B %Y')

        return dt.strftime('%Y')
Esempio n. 3
0
 def convert_episode(self, episode):
     now = datetime.datetime.now()
     tnow = time.time()
     return {
         'id': episode.id,
         'title': episode.trimmed_title,
         'progress': episode.download_progress(),
         'downloadState': episode.state,
         'isNew': episode.is_new,
         'playbackProgress': self._get_playback_progress(episode),
         'published': util.format_date(episode.published),
         'section': self._format_published_section(now, tnow, episode.published),
         'hasShownotes': episode.description != '',
     }
Esempio n. 4
0
 def convert_episode(self, episode):
     now = datetime.datetime.now()
     tnow = time.time()
     return {
         'id': episode.id,
         'title': episode.trimmed_title,
         'progress': episode.download_progress(),
         'downloadState': episode.state,
         'isNew': episode.is_new,
         'playbackProgress': self._get_playback_progress(episode),
         'published': util.format_date(episode.published),
         'section': self._format_published_section(now, tnow,
                                                   episode.published),
         'hasShownotes': episode.description != '',
     }
Esempio n. 5
0
 def convert_episode(self, episode):
     now = datetime.datetime.now()
     tnow = time.time()
     return {
         'id': episode.id,
         'title': episode.trimmed_title,
         'subtitle': self._get_subtitle(episode),
         'progress': episode.download_progress(),
         'downloadState': episode.state,
         'isNew': episode.is_new,
         'playbackProgress': self._get_playback_progress(episode),
         'published': util.format_date(episode.published),
         'section': self._format_published_section(now, tnow,
                                                   episode.published),
         'hasShownotes': episode.description != '',
         'mime_type': episode.mime_type,
         'total_time': episode.total_time,
         'episode_art': self._get_episode_art(episode),
         'cover_art': self._get_cover(episode.podcast),
         'podcast_title': episode.podcast.title
     }