Skip to content

Commit

Permalink
Fixed buggy behaviour when files are misplaced
Browse files Browse the repository at this point in the history
  • Loading branch information
mananapr committed Jul 23, 2019
1 parent 9b25da3 commit a946533
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions akari/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ def update_tags(tags, db):
else:
db['akari-tags'][tag] = 1

def commit_changes(db):
with open(data_dir+'/db.json', 'w') as outfile:
json.dump(db, outfile)

def parse_result(result):
soup = BeautifulSoup(result.text, 'html.parser')
try:
Expand Down Expand Up @@ -68,8 +72,7 @@ def scan_diretory(dirname, db):
tags = parse_result(result)
db[image] = tags
update_tags(tags, db)
with open(data_dir+'/db.json', 'w') as outfile:
json.dump(db, outfile)
commit_changes(db)
print(tags)
print("-----x--x-----")

Expand Down Expand Up @@ -103,6 +106,8 @@ def loadDB():
db['akari-tags'].pop(tag, None)
print('{} tag removed'.format(tag))

commit_changes(db)

return db

def handle_flags():
Expand Down

0 comments on commit a946533

Please sign in to comment.