warn about subfolders
This commit is contained in:
parent
226bb2bc83
commit
3faa82571c
@ -259,16 +259,18 @@ create table meta (dirMod int, lastUsn int); insert into meta values (0, 0);
|
||||
allRefs.update(noteRefs)
|
||||
# loop through media folder
|
||||
unused = []
|
||||
invalid = []
|
||||
if local is None:
|
||||
files = os.listdir(mdir)
|
||||
else:
|
||||
files = local
|
||||
renamedFiles = False
|
||||
dirFound = False
|
||||
warnings = []
|
||||
for file in files:
|
||||
if not local:
|
||||
if not os.path.isfile(file):
|
||||
# ignore directories
|
||||
dirFound = True
|
||||
continue
|
||||
if file.startswith("_"):
|
||||
# leading _ says to ignore file
|
||||
@ -301,7 +303,11 @@ create table meta (dirMod int, lastUsn int); insert into meta values (0, 0);
|
||||
self.findChanges()
|
||||
except DBError:
|
||||
self._deleteDB()
|
||||
return (nohave, unused, invalid)
|
||||
|
||||
if dirFound:
|
||||
warnings.append(
|
||||
_("Anki does not support files in subfolders of the collection.media folder."))
|
||||
return (nohave, unused, warnings)
|
||||
|
||||
def _normalizeNoteRefs(self, nid):
|
||||
note = self.col.getNote(nid)
|
||||
|
@ -975,13 +975,12 @@ will be lost. Continue?"""))
|
||||
|
||||
def onCheckMediaDB(self):
|
||||
self.progress.start(immediate=True)
|
||||
(nohave, unused, invalid) = self.col.media.check()
|
||||
(nohave, unused, warnings) = self.col.media.check()
|
||||
self.progress.finish()
|
||||
# generate report
|
||||
report = ""
|
||||
if invalid:
|
||||
report += _("Invalid encoding; please rename:")
|
||||
report += "\n" + "\n".join(invalid)
|
||||
if warnings:
|
||||
report += "\n".join(warnings) + "\n"
|
||||
if unused:
|
||||
if report:
|
||||
report += "\n\n\n"
|
||||
|
Loading…
Reference in New Issue
Block a user