Back

Audio Download - Anki plugin for downloading JDIC audio

#19
cb4960 Wrote:
nest0r Wrote:Also: Something to keep in mind when you're, or if you're, working on making this work for adding new cards, might be a good idea to find identifying markers for the 'The audio for this clip is not available' (such as size/length) mp3s so those can be automatically eliminated? (51.0 or 52.0kb?) Might turn up a few false positives but worth it, methinks.
Of the 128,275 available sounds clips, only three are greater than 52kb (重症急性呼吸器症候群, 選択的セロトニン再取り込み阻害薬, and プログラム制御式及びキーボード制御式のアドレス指定可能な記憶域をもつ計算器) so that should be a pretty good test.
It's probably easier/safer just to check the checksum of the file though.
Code:
import hashlib
if hashlib.md5( open( filepath ).read() ).digest() in knownBads:
   # handle case of no audio available
Reply

Messages In This Thread