Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mikf
GitHub Repository: mikf/gallery-dl
Path: blob/master/gallery_dl/postprocessor/__init__.py
8753 views
1
# -*- coding: utf-8 -*-
2
3
# Copyright 2018-2025 Mike Fährmann
4
#
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License version 2 as
7
# published by the Free Software Foundation.
8
9
"""Post-processing modules"""
10
11
modules = [
12
"classify",
13
"compare",
14
"directory",
15
"exec",
16
"hash",
17
"metadata",
18
"mtime",
19
"python",
20
"rename",
21
"ugoira",
22
"zip",
23
]
24
25
26
def find(name):
27
"""Return a postprocessor class with the given name"""
28
try:
29
return _cache[name]
30
except KeyError:
31
pass
32
33
cls = None
34
if name in modules: # prevent unwanted imports
35
try:
36
module = __import__(name, globals(), None, None, 1)
37
except ImportError:
38
pass
39
else:
40
cls = module.__postprocessor__
41
_cache[name] = cls
42
return cls
43
44
45
# --------------------------------------------------------------------
46
# internals
47
48
_cache = {}
49
50