mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 14:17:13 -05:00
add download missing action
This commit is contained in:
parent
938abea109
commit
2f0009da3e
2 changed files with 19 additions and 1 deletions
|
|
@ -16,7 +16,7 @@ from anki import DeckStorage
|
||||||
from anki.errors import *
|
from anki.errors import *
|
||||||
from anki.sound import hasSound, playFromText, clearAudioQueue
|
from anki.sound import hasSound, playFromText, clearAudioQueue
|
||||||
from anki.utils import addTags, deleteTags, parseTags, canonifyTags, stripHTML
|
from anki.utils import addTags, deleteTags, parseTags, canonifyTags, stripHTML
|
||||||
from anki.media import rebuildMediaDir
|
from anki.media import rebuildMediaDir, downloadMissing
|
||||||
from anki.db import OperationalError, SessionHelper
|
from anki.db import OperationalError, SessionHelper
|
||||||
from anki.stdmodels import BasicModel
|
from anki.stdmodels import BasicModel
|
||||||
from anki.hooks import runHook, addHook, removeHook, _hooks, wrap
|
from anki.hooks import runHook, addHook, removeHook, _hooks, wrap
|
||||||
|
|
@ -2226,6 +2226,7 @@ it to your friends.
|
||||||
self.connect(m.actionFullDatabaseCheck, s, self.onCheckDB)
|
self.connect(m.actionFullDatabaseCheck, s, self.onCheckDB)
|
||||||
self.connect(m.actionOptimizeDatabase, s, self.onOptimizeDB)
|
self.connect(m.actionOptimizeDatabase, s, self.onOptimizeDB)
|
||||||
self.connect(m.actionCheckMediaDatabase, s, self.onCheckMediaDB)
|
self.connect(m.actionCheckMediaDatabase, s, self.onCheckMediaDB)
|
||||||
|
self.connect(m.actionDownloadMissingMedia, s, self.onDownloadMissingMedia)
|
||||||
self.connect(m.actionCram, s, self.onCram)
|
self.connect(m.actionCram, s, self.onCram)
|
||||||
self.connect(m.actionOpenPluginFolder, s, self.onOpenPluginFolder)
|
self.connect(m.actionOpenPluginFolder, s, self.onOpenPluginFolder)
|
||||||
self.connect(m.actionEnableAllPlugins, s, self.onEnableAllPlugins)
|
self.connect(m.actionEnableAllPlugins, s, self.onEnableAllPlugins)
|
||||||
|
|
@ -2674,6 +2675,17 @@ Consider backing up your media directory first."""))
|
||||||
ngettext("%d unused file removed.", "%d unused files removed.",
|
ngettext("%d unused file removed.", "%d unused files removed.",
|
||||||
unused) % unused)
|
unused) % unused)
|
||||||
|
|
||||||
|
def onDownloadMissingMedia(self):
|
||||||
|
res = downloadMissing(self.deck)
|
||||||
|
if res is None:
|
||||||
|
ui.utils.showInfo(_("No media URLs defined for this deck."),
|
||||||
|
help="MediaSupport")
|
||||||
|
ui.utils.showInfo(_("%(a)d missing files found.<br>"
|
||||||
|
"%(b)d successfully retrieved.") % {
|
||||||
|
'a': res[0],
|
||||||
|
'b': res[1],
|
||||||
|
}, parent=self)
|
||||||
|
|
||||||
def addHook(self, *args):
|
def addHook(self, *args):
|
||||||
addHook(*args)
|
addHook(*args)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2792,6 +2792,7 @@
|
||||||
<addaction name="actionCheckMediaDatabase"/>
|
<addaction name="actionCheckMediaDatabase"/>
|
||||||
<addaction name="actionCacheLatex"/>
|
<addaction name="actionCacheLatex"/>
|
||||||
<addaction name="actionUncacheLatex"/>
|
<addaction name="actionUncacheLatex"/>
|
||||||
|
<addaction name="actionDownloadMissingMedia"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionRecordNoiseProfile"/>
|
<addaction name="actionRecordNoiseProfile"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
|
@ -3455,6 +3456,11 @@
|
||||||
<string>Ctrl+R</string>
|
<string>Ctrl+R</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionDownloadMissingMedia">
|
||||||
|
<property name="text">
|
||||||
|
<string>Download Missing Media</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>newPerDay</tabstop>
|
<tabstop>newPerDay</tabstop>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue