-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo_gui.py
40 lines (32 loc) · 1.04 KB
/
demo_gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os,subprocess
import eel,json
import FindDuplicateFiles
@eel.expose
def GetDuplicateFiles():
print("GetDuplicateFiles called")
return json.dumps(results,ensure_ascii=False,default=vars)
@eel.expose
def OpenFileWithDefaultApp(fn:str):
try:
os.startfile(fn)
except AttributeError:
subprocess.call(['open', fn])
@eel.expose
def DeleteSelectedFiles(fns:list[str]):
for fn in fns:
print(f"deleting {fn} ...");
os.remove(fn);
###############################################
Folders_to_scan=[r"c:\DCIM\photos1",r"c:\DCIM\photos2"]
cfg=FindDuplicateFiles.FDFConfig()
#cfg.hashFile=False #set this to False to skip MD5 hashing
results=FindDuplicateFiles.FindDuplicateFiles(Folders_to_scan, cfg)
for group in results: #print out the results
print(f"file length={group.length} MD5={group.md5_hash}")
for f in group.filenames:
print(" ",f)
if 0==len(results):
print("Not startiong GUI because no potential duplicate files were found")
else:
eel.init("web")
eel.start('index.html')