2018-05-20 22:03:57 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2019-08-15 13:31:04 +02:00
|
|
|
# Copyright 2018-2019 Mike Fährmann
|
2018-05-20 22:03:57 +02:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License version 2 as
|
|
|
|
# published by the Free Software Foundation.
|
|
|
|
|
|
|
|
"""Common classes and constants used by postprocessor modules."""
|
|
|
|
|
2019-10-06 23:12:51 +02:00
|
|
|
import logging
|
2018-06-07 22:40:59 +02:00
|
|
|
|
2018-05-20 22:03:57 +02:00
|
|
|
|
|
|
|
class PostProcessor():
|
2018-06-08 17:39:02 +02:00
|
|
|
"""Base class for postprocessors"""
|
2018-05-20 22:03:57 +02:00
|
|
|
|
2019-10-06 23:12:51 +02:00
|
|
|
def __init__(self):
|
|
|
|
name = self.__class__.__name__[:-2].lower()
|
|
|
|
self.log = logging.getLogger("postprocessor." + name)
|
2018-10-18 22:32:03 +02:00
|
|
|
|
2019-10-06 23:12:51 +02:00
|
|
|
@staticmethod
|
|
|
|
def prepare(pathfmt):
|
|
|
|
"""Update file paths, etc."""
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def run(pathfmt):
|
2018-06-08 17:39:02 +02:00
|
|
|
"""Execute the postprocessor for a file"""
|
|
|
|
|
2019-10-06 23:12:51 +02:00
|
|
|
@staticmethod
|
|
|
|
def run_after(pathfmt):
|
2019-10-06 21:58:00 +02:00
|
|
|
"""Execute postprocessor after moving a file to its target location"""
|
|
|
|
|
2019-10-06 23:12:51 +02:00
|
|
|
@staticmethod
|
2019-11-03 21:45:45 +01:00
|
|
|
def run_final(pathfmt, status):
|
|
|
|
"""Postprocessor finalization after all files have been downloaded"""
|
2019-08-15 13:31:04 +02:00
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return self.__class__.__name__
|