diff --git a/larigira/audiogen_mostrecent.py b/larigira/audiogen_mostrecent.py index 237b014..0fe0381 100644 --- a/larigira/audiogen_mostrecent.py +++ b/larigira/audiogen_mostrecent.py @@ -7,6 +7,7 @@ from tempfile import mkstemp from pytimeparse.timeparse import timeparse from larigira.fsutils import scan_dir +log = logging.getLogger(__name__) def get_mtime(fname): @@ -17,7 +18,7 @@ def recent_choose(paths, howmany, minepoch): found_files = {} for path in paths: if not os.path.exists(path): - logging.warning("Can't find requested path: %s", path) + log.warning("Can't find requested path: %s", path) continue if os.path.isfile(path): found_files[path] = get_mtime(path) @@ -66,6 +67,8 @@ def generate(spec): prefix='audiogen-randomdir-') os.close(tmp[0]) shutil.copy(path, tmp[1]) + log.info("copying %s -> %s", path, os.path.basename(tmp[1])) yield 'file://{}'.format(tmp[1]) + generate.description = 'Select most recent file inside a directory' diff --git a/larigira/audiogen_randomdir.py b/larigira/audiogen_randomdir.py index e263a4e..1c79365 100644 --- a/larigira/audiogen_randomdir.py +++ b/larigira/audiogen_randomdir.py @@ -5,6 +5,7 @@ import random from tempfile import mkstemp from larigira.fsutils import scan_dir +log = logging.getLogger(__name__) def generate(spec): @@ -23,7 +24,7 @@ def generate(spec): found_files = set() for path in spec['paths']: if not os.path.exists(path): - logging.warning("Can't find requested path: %s", path) + log.warning("Can't find requested path: %s", path) continue if os.path.isfile(path): found_files.add(path) @@ -34,9 +35,11 @@ def generate(spec): for path in picked: tmp = mkstemp(suffix=os.path.splitext(path)[-1], - prefix='audiogen-randomdir-') + prefix='randomdir-') os.close(tmp[0]) shutil.copy(path, tmp[1]) + log.info("copying %s -> %s", path, os.path.basename(tmp[1])) yield 'file://{}'.format(tmp[1]) + generate.description = 'Picks random files from a specified directory' diff --git a/larigira/audiogen_script.py b/larigira/audiogen_script.py index fdb9dc1..8e078dd 100644 --- a/larigira/audiogen_script.py +++ b/larigira/audiogen_script.py @@ -20,7 +20,7 @@ import os import subprocess from .config import get_conf -log = logging.getLogger('audioscript') +log = logging.getLogger(__name__) def generate(spec): diff --git a/larigira/audiogen_static.py b/larigira/audiogen_static.py index a495ac4..8bf88c1 100644 --- a/larigira/audiogen_static.py +++ b/larigira/audiogen_static.py @@ -2,6 +2,7 @@ import os import logging import shutil from tempfile import mkstemp +log = logging.getLogger(__name__) def generate(spec): @@ -15,11 +16,14 @@ def generate(spec): for path in spec['paths']: if not os.path.exists(path): - logging.warning("Can't find requested path: %s", path) + log.warning("Can't find requested path: %s", path) continue tmp = mkstemp(suffix=os.path.splitext(path)[-1], prefix='audiogen-static-') os.close(tmp[0]) + log.info("copying %s -> %s", path, os.path.basename(tmp[1])) shutil.copy(path, tmp[1]) yield 'file://{}'.format(tmp[1]) + + generate.description = 'Picks always the same specified file'