Skip to content

Commit

Permalink
Added info for this feature in the readme. Replaced "_" with "-" in t…
Browse files Browse the repository at this point in the history
…he arguments names
  • Loading branch information
ivandokov committed Nov 13, 2023
1 parent bedc5e9 commit 4e5803e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
14 changes: 6 additions & 8 deletions phockup.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,24 +298,22 @@ def parse_args(args=sys.argv[1:]):
)

parser.add_argument(
'--from_date',
'--from-date',
type=str,
default=None,
help="""\
Limit the operations to the files that are older than from_date (inclusive).
The date must be specified in format YYYY-MM-DD
Files with unknown date won't be skipped.
Limit the operations to the files that are newer than --from-date (inclusive).
The date must be specified in format YYYY-MM-DD. Files with unknown date won't be skipped.
"""
)

parser.add_argument(
'--to_date',
'--to-date',
type=str,
default=None,
help="""\
Limit the operations to the files that are newer than from_date (inclusive).
The date must be specified in format YYYY-MM-DD
Files with unknown date won't be skipped.
Limit the operations to the files that are older than --to-date (inclusive).
The date must be specified in format YYYY-MM-DD. Files with unknown date won't be skipped.
"""
)

Expand Down
23 changes: 23 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,29 @@ saving to the same central respository.

The two options above can be used to help sort/store images

#### Limit files processed by date
`--from-date` flag can be used to limit the operations to the files that are newer than the provided date (inclusive).
The date must be specified in format YYYY-MM-DD. Files with unknown date won't be skipped.

For example:
```
phockup ~/Pictures/DCIM/NIKOND40 ~/Pictures/sorted --from-date="2017-01-02"
```
`--to-date` flag can be used to limit the operations to the files that are older than the provided date (inclusive).
The date must be specified in format YYYY-MM-DD. Files with unknown date won't be skipped.

For example:
```
phockup ~/Pictures/DCIM/NIKOND40 ~/Pictures/sorted --to-date="2017-01-02"
```

`--from-date` and `--to-date` can be combined for better control over the files that are processed.

For example:
```
phockup ~/Pictures/DCIM/NIKOND40 ~/Pictures/sorted --from-date="2017-01-02" --to-date="2017-01-03"
```

### Missing date information in EXIF
If any of the photos does not have date information you can use the `-r | --regex` option to specify date format for date extraction from filenames:
```
Expand Down
4 changes: 2 additions & 2 deletions src/phockup.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ def process_file(self, filename):
if type(file_date) is dict:
file_date = file_date["date"]
if self.from_date is not None and file_date < self.from_date:
progress = f"{progress} => {filename} skipped: date {file_date} is older than from_date {self.from_date}"
progress = f"{progress} => {filename} skipped: date {file_date} is older than --from-date {self.from_date}"
skip = True
if self.to_date is not None and file_date > self.to_date:
progress = f"{progress} => {filename} skipped: date {file_date} is newer than to_date {self.to_date}"
progress = f"{progress} => {filename} skipped: date {file_date} is newer than --to-date {self.to_date}"
skip = True
if skip:
if self.progress:
Expand Down

0 comments on commit 4e5803e

Please sign in to comment.