Ejemplo n.º 1
0
 async def get(self, *args, **kwargs):
     await self.run_task(History().trim)
     sickrage.app.alerts.message(
         _('Removed history entries older than 30 days'))
     return self.redirect("/history/")
Ejemplo n.º 2
0
 async def get(self, *args, **kwargs):
     await self.run_task(History().clear)
     sickrage.app.alerts.message(_('History cleared'))
     return self.redirect("/history/")
Ejemplo n.º 3
0
    def get(self, *args, **kwargs):
        limit = self.get_argument('limit', None)

        if limit is None:
            if sickrage.app.config.gui.history_limit:
                limit = int(sickrage.app.config.gui.history_limit)
            else:
                limit = 100
        else:
            limit = int(limit)

        if sickrage.app.config.gui.history_limit != limit:
            sickrage.app.config.gui.history_limit = limit
            sickrage.app.config.save()

        compact = []

        for row in History().get(limit):
            action = {
                'action': row['action'],
                'provider': row['provider'],
                'release_group': row['release_group'],
                'resource': row['resource'],
                'time': row['date']
            }

            if not any(
                (history['series_id'] == row['series_id'] and history['season']
                 == row['season'] and history['episode'] == row['episode']
                 and history['quality'] == row['quality'])
                    for history in compact):

                history = {
                    'actions': [action],
                    'quality': row['quality'],
                    'resource': row['resource'],
                    'season': row['season'],
                    'episode': row['episode'],
                    'series_id': row['series_id'],
                    'show_name': row['show_name']
                }

                compact.append(history)
            else:
                index = [
                    i for i, item in enumerate(compact)
                    if item['series_id'] == row['series_id'] and item['season']
                    == row['season'] and item['episode'] == row['episode']
                    and item['quality'] == row['quality']
                ][0]

                history = compact[index]
                history['actions'].append(action)

                history['actions'].sort(key=lambda d: d['time'], reverse=True)

        submenu = [
            {
                'title': _('Clear History'),
                'path': '/history/clear',
                'icon': 'fas fa-trash',
                'class': 'clearhistory',
                'confirm': True
            },
            {
                'title': _('Trim History'),
                'path': '/history/trim',
                'icon': 'fas fa-cut',
                'class': 'trimhistory',
                'confirm': True
            },
        ]

        return self.render('history.mako',
                           historyResults=History().get(limit),
                           compactResults=compact,
                           limit=limit,
                           submenu=submenu,
                           title=_('History'),
                           header=_('History'),
                           topmenu="history",
                           controller='root',
                           action='history')
Ejemplo n.º 4
0
 def get(self, *args, **kwargs):
     History().clear()
     sickrage.app.alerts.message(_('History cleared'))
     return self.redirect("/history/")
Ejemplo n.º 5
0
 def handle_get(self):
     History().trim()
     sickrage.app.alerts.message(
         _('Removed history entries older than 30 days'))
     return self.redirect("/history/")
Ejemplo n.º 6
0
 def handle_get(self):
     History().clear()
     sickrage.app.alerts.message(_('History cleared'))
     return self.redirect("/history/")