Skip to content

Commit

Permalink
Fix a bug with --kep-date
Browse files Browse the repository at this point in the history
  • Loading branch information
Alyetama committed Dec 6, 2023
1 parent cba99c5 commit 7056a7a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ options:
Divide the image size (WxH) by a factor of n
-S, --silent Silent mode
-O, --optimize Apply default optimization on the image(s)
-k, --keep-date Keep the original creation and modification date
-k, --keep-date Keep the original modification date
```

## 📕 Examples
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "rayim"
version = "1.8.0"
version = "1.8.1"
description = "Fast image compression for large number of images with Ray library"
authors = ["Mohammad Alyetama <[email protected]>"]
license = "MIT"
Expand Down
7 changes: 4 additions & 3 deletions rayim/rayim.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import copy
import imghdr
import io
import os
import shutil
import signal
import sys
Expand Down Expand Up @@ -84,7 +85,7 @@ def compress(file: str,
'Skipping...\033[49m')
return

_file = file
file_stats = os.stat(file)
file = Path(file)
original_file_suffix = file.suffix
size_1 = Path(file).stat().st_size
Expand Down Expand Up @@ -161,7 +162,7 @@ def compress(file: str,
size_2 = size_1

if keep_date:
shutil.copystat(_file, out_file)
os.utime(out_file, (file_stats.st_atime, file_stats.st_mtime))

took = round(time.time() - start, 2)
if sys.stdout.isatty():
Expand Down Expand Up @@ -227,7 +228,7 @@ def opts() -> argparse.Namespace:
'-k',
'--keep-date',
action='store_true',
help='Keep the original creation and modification date')
help='Keep the original modification date')
parser.add_argument(
'path',
nargs='+',
Expand Down

0 comments on commit 7056a7a

Please sign in to comment.