Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.py[oc]
.DS_Store
/*.egg-info/
/dist/
__pycache__/
difPy_*.json
difPy_*_lower_quality.txt
Thumbs.db
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ difPy.search(difpy_obj, similarity='duplicates', rotate=True, same_dim=True, sho
## CLI Usage
difPy can also be invoked through the CLI by using the following commands:

### From Source
```python
python dif.py #working directory

Expand All @@ -164,6 +165,15 @@ python dif.py -D 'C:/Path/to/Folder/'
python dif.py -D 'C:/Path/to/Folder_A/' 'C:/Path/to/Folder_B/' 'C:/Path/to/Folder_C/'
```

### Installed Package
```shell
pip install difPy

difpy
# or
python -m difpy
```

> :point_right: Windows users can add difPy to their [PATH system variables](https://www.computerhope.com/issues/ch000549.htm) by pointing it to their difPy package installation folder containing the [`difPy.bat`](https://github.com/elisemercury/Duplicate-Image-Finder/difPy/difPy.bat) file. This adds `difPy` as a command in the CLI and will allow direct invocation of `difPy` from anywhere on the device.

difPy CLI supports the following arguments:
Expand Down
4 changes: 4 additions & 0 deletions difPy/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .dif import cli

if __name__ == '__main__':
cli()
9 changes: 6 additions & 3 deletions difPy/dif.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,8 +971,8 @@ def _strtobool(v):
return False
else:
raise argparse.ArgumentTypeError('Boolean value expected')
if __name__ == '__main__':

def cli():
# Parameters for when launching difPy via CLI
parser = argparse.ArgumentParser(description='Find duplicate or similar images with difPy - https://github.com/elisemercury/Duplicate-Image-Finder')
parser.add_argument('-D', '--directory', type=str, nargs='+', help='Paths of the directories to be searched. Default is working dir.', required=False, default=[os.getcwd()])
Expand Down Expand Up @@ -1040,4 +1040,7 @@ def _strtobool(v):
# delete search.lower_quality files
se.delete(silent_del=args.silent_del)

print(f'''\n{result_file}\n{lq_file}\n{stats_file}\n\nsaved in '{dir}'.''')
print(f'''\n{result_file}\n{lq_file}\n{stats_file}\n\nsaved in '{dir}'.''')

if __name__ == '__main__':
cli()
33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[project]
name = "difpy"
dynamic = ["version"]
description = "Duplicate Image Finder - Python package for finding duplicate and similar images"
readme = "README.md"
keywords = ["duplicate", "image", "finder", "similarity", "pictures"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Build Tools"
]
requires-python = ">=3.11"
dependencies = [
"numpy>=1.26.4",
"pillow>=10.2.0",
]

[project.urls]
homepage = "https://github.com/elisemercury/Duplicate-Image-Finder"
documentation = "https://difpy.readthedocs.io"
repository = "https://github.com/elisemercury/Duplicate-Image-Finder"

[project.scripts]
difpy = "difPy.dif:cli"

[tool.setuptools]
packages = ["difPy"]

[tool.setuptools.dynamic]
version = {attr = "difPy.version.__version__"}
Loading