sort media list

This commit is contained in:
Damien Elmes 2020-02-10 18:50:27 +10:00
parent 6f158c8555
commit c347c9aee8

View File

@ -106,18 +106,18 @@ def describe_output(output: MediaCheckOutput) -> str:
buf.append(_("Some files have been renamed for compatibility:")) buf.append(_("Some files have been renamed for compatibility:"))
buf.extend( buf.extend(
_("Renamed: %(old)s -> %(new)s") % dict(old=k, new=v) _("Renamed: %(old)s -> %(new)s") % dict(old=k, new=v)
for (k, v) in output.renamed.items() for (k, v) in sorted(output.renamed.items())
) )
buf.append("") buf.append("")
if output.oversize: if output.oversize:
buf.append(_("Files over 100MB can not be synced with AnkiWeb.")) buf.append(_("Files over 100MB can not be synced with AnkiWeb."))
buf.extend(_("Over 100MB: {}").format(f) for f in output.oversize) buf.extend(_("Over 100MB: {}").format(f) for f in sorted(output.oversize))
buf.append("") buf.append("")
if output.dirs: if output.dirs:
buf.append(_("Folders inside the media folder are not supported.")) buf.append(_("Folders inside the media folder are not supported."))
buf.extend(_("Folder: {}").format(f) for f in output.dirs) buf.extend(_("Folder: {}").format(f) for f in sorted(output.dirs))
buf.append("") buf.append("")
if output.missing: if output.missing:
@ -126,7 +126,7 @@ def describe_output(output: MediaCheckOutput) -> str:
"The following files are referenced by cards, but were not found in the media folder:" "The following files are referenced by cards, but were not found in the media folder:"
) )
) )
buf.extend(_("Missing: {}").format(f) for f in output.missing) buf.extend(_("Missing: {}").format(f) for f in sorted(output.missing))
buf.append("") buf.append("")
if output.unused: if output.unused:
@ -135,7 +135,7 @@ def describe_output(output: MediaCheckOutput) -> str:
"The following files were found in the media folder, but do not appear to be used on any cards:" "The following files were found in the media folder, but do not appear to be used on any cards:"
) )
) )
buf.extend(_("Unused: {}").format(f) for f in output.unused) buf.extend(_("Unused: {}").format(f) for f in sorted(output.unused))
buf.append("") buf.append("")
return "\n".join(buf) return "\n".join(buf)