Skip to content

Commit

Permalink
updated get_mtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Barakudum committed Feb 4, 2024
1 parent dab9a46 commit 67cf103
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/jarklin/cache/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def get_mtime(path: PathSource) -> float:
if path.is_file():
return path.stat().st_mtime
elif path.is_dir():
return max(p.stat().st_mtime for p in path.iterdir() if p.is_file())
times = [p.stat().st_mtime for p in path.iterdir() if p.is_file()]
minimum = min(times)
maximum = max(times)
# assume that it took at least one hour for the gallery to be created (e.g. download-time)
return maximum if maximum > (minimum + 3600) else minimum
else:
raise ValueError(f"can't get mtime for {str(path)!r}")

0 comments on commit 67cf103

Please sign in to comment.