|
@ -12,6 +12,15 @@ from patacrep.authors import process_listauthors |
|
|
|
|
|
|
|
|
LOGGER = logging.getLogger(__name__) |
|
|
LOGGER = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
|
|
DEFAULT_CONFIG = { |
|
|
|
|
|
'template': "default.tex", |
|
|
|
|
|
'lang': 'en', |
|
|
|
|
|
'content': [], |
|
|
|
|
|
'titleprefixwords': [], |
|
|
|
|
|
'encoding': None, |
|
|
|
|
|
'datadir': [], |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
def cached_name(datadir, filename): |
|
|
def cached_name(datadir, filename): |
|
|
"""Return the filename of the cache version of the file.""" |
|
|
"""Return the filename of the cache version of the file.""" |
|
|
fullpath = os.path.abspath(os.path.join(datadir, '.cache', filename)) |
|
|
fullpath = os.path.abspath(os.path.join(datadir, '.cache', filename)) |
|
@ -93,7 +102,10 @@ class Song: |
|
|
"_version", |
|
|
"_version", |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
def __init__(self, subpath, config, *, datadir=None): |
|
|
def __init__(self, subpath, config=None, *, datadir=None): |
|
|
|
|
|
if config is None: |
|
|
|
|
|
config = DEFAULT_CONFIG.copy() |
|
|
|
|
|
|
|
|
if datadir is None: |
|
|
if datadir is None: |
|
|
self.datadir = "" |
|
|
self.datadir = "" |
|
|
# Only songs in datadirs may be cached |
|
|
# Only songs in datadirs may be cached |
|
|