core/stats: enable processing input files, report first and last filename

can be useful for quick investigation/testing setup
This commit is contained in:
karlicoss 2023-10-22 00:07:48 +01:00
parent c335c0c9d8
commit 86ea605aec
2 changed files with 26 additions and 20 deletions

View file

@ -474,15 +474,19 @@ def _stat_iterable(it: Iterable[C], quick: bool = False) -> Any:
if errors > 0:
res['errors'] = errors
if first_item is not None:
dt = guess_datetime(first_item)
if dt is not None:
res['first'] = dt
def stat_item(item):
if item is None:
return None
if isinstance(item, Path):
return str(item)
return guess_datetime(item)
if (stat_first := stat_item(first_item)) is not None:
res['first'] = stat_first
if (stat_last := stat_item(last_item)) is not None:
res['last'] = stat_last
if last_item is not None:
dt = guess_datetime(last_item)
if dt is not None:
res['last'] = dt
return res