Compare commits
2 Commits
e5086bf0af
...
7361dc6f1f
Author | SHA1 | Date | |
---|---|---|---|
|
7361dc6f1f | ||
|
ea244ce76c |
@ -3,6 +3,7 @@ import imagehash
|
||||
import os
|
||||
import numpy as np
|
||||
import csv
|
||||
import requests
|
||||
|
||||
def writeCSV(i1, i2):
|
||||
with open("duplicates.csv", "a") as file:
|
||||
@ -15,7 +16,7 @@ class DuplicateRemover:
|
||||
self.dirname = dirname
|
||||
self.hash_size = hash_size
|
||||
|
||||
def find_duplicates(self, verbose=True, exportCSV=True):
|
||||
def find_duplicates(self, verbose=True, exportCSV=False, exportAPI=True):
|
||||
"""
|
||||
Find and Delete Duplicates
|
||||
"""
|
||||
@ -36,6 +37,8 @@ class DuplicateRemover:
|
||||
print("Duplicate {} \nfound for Image {}!\n".format(os.path.join(path,image),os.path.join(path,hashes[temp_hash])))
|
||||
if exportCSV:
|
||||
writeCSV(os.path.join(path,image), os.path.join(path,hashes[temp_hash]))
|
||||
if exportAPI:
|
||||
requests.post('http://your-server.domain/duplicate_api.php?insertDuplicate', json={"file1":os.path.join(path,image),"file2":os.path.join(path,hashes[temp_hash])})
|
||||
duplicates.append(os.path.join(path,image))
|
||||
else:
|
||||
hashes[temp_hash] = os.path.join(path,image)
|
||||
|
2
main.py
2
main.py
@ -1,6 +1,6 @@
|
||||
from DuplicateRemover import DuplicateRemover
|
||||
|
||||
dirname = "images"
|
||||
dirname = "/image/path/"
|
||||
|
||||
# Remove Duplicates
|
||||
dr = DuplicateRemover(dirname)
|
||||
|
@ -4,3 +4,4 @@ Pillow==8.1.2
|
||||
PyWavelets==1.1.1
|
||||
scipy==1.6.2
|
||||
six==1.15.0
|
||||
requests
|
Loading…
Reference in New Issue
Block a user