1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 04:02:32 +01:00
gallery-dl/gallery_dl/postprocessor/__init__.py
2024-08-31 17:04:44 +02:00

48 lines
960 B
Python

# -*- coding: utf-8 -*-
# Copyright 2018-2023 Mike Fährmann
#
# 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.
"""Post-processing modules"""
modules = [
"classify",
"compare",
"exec",
"hash",
"metadata",
"mtime",
"python",
"rename",
"ugoira",
"zip",
]
def find(name):
"""Return a postprocessor class with the given name"""
try:
return _cache[name]
except KeyError:
pass
cls = None
if name in modules: # prevent unwanted imports
try:
module = __import__(name, globals(), None, (), 1)
except ImportError:
pass
else:
cls = module.__postprocessor__
_cache[name] = cls
return cls
# --------------------------------------------------------------------
# internals
_cache = {}