mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 06:07:11 -05:00
don't leave stale entries in media db if just scanning
This commit is contained in:
parent
4e5b725166
commit
acb72327b2
1 changed files with 2 additions and 1 deletions
|
|
@ -161,10 +161,11 @@ def rebuildMediaDir(deck, delete=False, dirty=True):
|
||||||
unused.append(file)
|
unused.append(file)
|
||||||
# optionally delete
|
# optionally delete
|
||||||
if delete:
|
if delete:
|
||||||
removeUnusedMedia(deck)
|
|
||||||
for f in unused:
|
for f in unused:
|
||||||
path = os.path.join(mdir, f)
|
path = os.path.join(mdir, f)
|
||||||
os.unlink(path)
|
os.unlink(path)
|
||||||
|
# remove entries in db for unused media
|
||||||
|
removeUnusedMedia(deck)
|
||||||
# check md5s are up to date
|
# check md5s are up to date
|
||||||
update = []
|
update = []
|
||||||
for (file, created, md5) in deck.s.all(
|
for (file, created, md5) in deck.s.all(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue