Add the media_check_did_finish hook (#1889)

This commit is contained in:
Abdo 2022-05-27 09:25:34 +03:00 committed by GitHub
parent 96bacf792c
commit 5fe9447dcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -13,6 +13,7 @@ import aqt.progress
from anki.collection import Collection, SearchNode
from anki.errors import Interrupted
from anki.media import CheckMediaResponse
from aqt import gui_hooks
from aqt.operations import QueryOp
from aqt.qt import *
from aqt.utils import (
@ -96,6 +97,7 @@ class MediaChecker:
return
output: CheckMediaResponse = future.result()
gui_hooks.media_check_did_finish(output)
report = output.report
# show report and offer to delete

View file

@ -762,6 +762,13 @@ gui_hooks.webview_did_inject_style_into_page.append(mytest)
Note that the media sync did not necessarily finish at this point.""",
),
Hook(name="media_check_will_start", args=[]),
Hook(
name="media_check_did_finish",
args=["output: anki.media.CheckMediaResponse"],
doc="""Called after Media Check finishes.
`output` provides access to the unused/missing file lists and the text output that will be shown in the Check Media screen.""",
),
# Dialog Manager
###################
Hook(