'Reject any remembered entries from previous runs'

@plugin.priority(255)
def on_task_filter(self, task, config):

    with Session() as session:
        (task_id,) = session.query(RememberTask.id).filter((RememberTask.name == task.name)).first()
        reject_entries = session.query(RememberEntry).filter((RememberEntry.task_id == task_id))
        if reject_entries.count():
            for entry in task.entries:
                if (not entry.get(u'url')):
                    continue
                reject_entry = reject_entries.filter(and_((RememberEntry.title == entry[u'title']), (RememberEntry.url == entry[u'original_url']))).first()
                if reject_entry:
                    entry.reject((u'Rejected    on    behalf    of    %s    plugin:    %s' % (reject_entry.rejected_by, reject_entry.reason)))
