Skip to content

Commit

Permalink
refactoring of some global variables into parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
jesjimher committed Aug 17, 2018
1 parent 99f0614 commit d0b89fd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions jpegdupes/jpegdupes.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def hashcalc(path,pool,method="MD5",havejpeginfo=False):
return results

# Writes the specified dict to disk
def writecache(d,args):
def writecache(d,args,fsigs):
if not args.clean:
cache=open(fsigs,'wb')
pickle.dump(d,cache)
Expand Down Expand Up @@ -274,7 +274,7 @@ def main():
for fname in fileList:
# Update signatures cache every 100 files
if modif and ((count % 100)==0):
writecache(jpegs,args)
writecache(jpegs,args,fsigs)
modif=False
if fname.lower().endswith(extensiones):
ruta=os.path.join(dirName,fname)
Expand All @@ -291,7 +291,7 @@ def main():
count+=1

# Write hash cache to disk
if modif: writecache(jpegs,args)
if modif: writecache(jpegs,args,fsigs)

# Check for duplicates

Expand Down Expand Up @@ -374,7 +374,7 @@ def main():
print()
elif answer in ["quit","q"]:
# If asked, write changes, delete temps and quit
if modif: writecache(jpegs,args)
if modif: writecache(jpegs,args,fsigs)
rmtemps(tmpdirs)
exit(0)
elif answer in ["show","s"]:
Expand Down Expand Up @@ -417,7 +417,7 @@ def main():
print("\n", end=' ')

# Final update of the cache in order to remove signatures of deleted files
if modif: writecache(jpegs,args)
if modif: writecache(jpegs,args,fsigs)

# Delete temps
rmtemps(tmpdirs)
Expand Down

0 comments on commit d0b89fd

Please sign in to comment.