コード例 #1
0
ファイル: exporting.py プロジェクト: xuze1993/anki-1
    def _exportMedia(self, z: ZipFile, files: List[str], fdir: str) -> Dict[str, str]:
        media = {}
        for c, file in enumerate(files):
            cStr = str(c)
            mpath = os.path.join(fdir, file)
            if os.path.isdir(mpath):
                continue
            if os.path.exists(mpath):
                if re.search(r"\.svg$", file, re.IGNORECASE):
                    z.write(mpath, cStr, zipfile.ZIP_DEFLATED)
                else:
                    z.write(mpath, cStr, zipfile.ZIP_STORED)
                media[cStr] = unicodedata.normalize("NFC", file)
                hooks.media_files_did_export(c)

        return media
コード例 #2
0
ファイル: exporting.py プロジェクト: glutanimate/anki
 def progress() -> None:
     while exporting_media():
         progress = self.col._backend.latest_progress()
         if progress.HasField("exporting"):
             hooks.media_files_did_export(progress.exporting)
         time.sleep(0.1)