# Path: elodie/compatability.py
# def _bytes(string):
#     if constants.python_version == 3:
#         return bytes(string, 'utf8')
#     else:
#         return bytes(string)
# 
# Path: elodie/config.py
# def load_config_for_plugin(name):
#     # Plugins store data using Plugin%PluginName% format.
#     key = 'Plugin{}'.format(name)
#     config = load_config()
# 
#     if key in config:
#         return config[key]
# 
#     return {}
# 
# def load_plugin_config():
#     config = load_config()
# 
#     # If plugins are defined in the config we return them as a list
#     # Else we return an empty list
#     if 'Plugins' in config and 'plugins' in config['Plugins']:
#         return config['Plugins']['plugins'].split(',')
# 
#     return []
# 
# Path: elodie/constants.py

# 
# Path: elodie/log.py
# def all(message):
# def info(message):
# def info_json(payload):
# def progress(message='.', new_line=False):
# def warn(message):
# def warn_json(payload):
# def error(message):
# def error_json(payload):
# def _print_debug(string):
# def _print(s):


from builtins import object
from json import dumps, loads
from importlib import import_module
from os.path import dirname, dirname, isdir, isfile
from os import mkdir
from sys import exc_info
from traceback import format_exc
from elodie.compatability import _bytes
from elodie.config import load_config_for_plugin, load_plugin_config
from elodie.constants import application_directory
from elodie import log
import io




class ElodiePluginError(Exception):
    """Exception which can be thrown by plugins to return failures.
    """
    pass


class PluginBase(object):
    """Base class which all plugins should inherit from.
       Defines stubs for all methods and exposes logging and database functionality
    """
    __name__ = 'PluginBase'

    def __init__(self):
        # Loads the config for the plugin from config.ini
        self.config_for_plugin = load_config_for_plugin(self.__name__)
        self.db = PluginDb(self.__name__)

    def after(self, file_path, destination_folder, final_file_path, metadata):
        pass

    def batch(self):
        pass

    def before(self, file_path, destination_folder):
        pass


# Path: elodie/compatability.py
# def _bytes(string):
#     if constants.python_version == 3:
#         return bytes(string, 'utf8')
#     else:
#         return bytes(string)
# 
# Path: elodie/config.py
# def load_config_for_plugin(name):
#     # Plugins store data using Plugin%PluginName% format.
#     key = 'Plugin{}'.format(name)
#     config = load_config()
# 
#     if key in config:
#         return config[key]
# 
#     return {}
# 
# def load_plugin_config():
#     config = load_config()
# 
#     # If plugins are defined in the config we return them as a list
#     # Else we return an empty list
#     if 'Plugins' in config and 'plugins' in config['Plugins']:
#         return config['Plugins']['plugins'].split(',')
# 
#     return []
# 
# Path: elodie/constants.py

# 
# Path: elodie/log.py
# def all(message):
# def info(message):
# def info_json(payload):
# def progress(message='.', new_line=False):
# def warn(message):
# def warn_json(payload):
# def error(message):
# def error_json(payload):
# def _print_debug(string):
# def _print(s):


# Path: elodie/plugins/plugins.py
from builtins import object
from json import dumps, loads
from importlib import import_module
from os.path import dirname, dirname, isdir, isfile
from os import mkdir
from sys import exc_info
from traceback import format_exc
from elodie.compatability import _bytes
from elodie.config import load_config_for_plugin, load_plugin_config
from elodie.constants import application_directory
from elodie import log
import io





class ElodiePluginError(Exception):
    """Exception which can be thrown by plugins to return failures.
    """
    pass


class PluginBase(object):
    """Base class which all plugins should inherit from.
       Defines stubs for all methods and exposes logging and database functionality
    """
    __name__ = 'PluginBase'

    def __init__(self):
        # Loads the config for the plugin from config.ini
        self.config_for_plugin = load_config_for_plugin(self.__name__)
        self.db = PluginDb(self.__name__)

    def after(self, file_path, destination_folder, final_file_path, metadata):
        pass

    def batch(self):
        pass

    def before(self, file_path, destination_folder):
        pass


    def log(self, msg):