Merge pull request #218 from aakatov/master

Fix play sound with HTML special symbols in its filename
This commit is contained in:
Damien Elmes 2017-12-24 10:43:44 +10:00 committed by GitHub
commit 110fe33b64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import html
import re, sys, threading, time, subprocess, os, atexit
import random
from anki.hooks import addHook
@ -14,6 +15,8 @@ _soundReg = "\[sound:(.*?)\]"
def playFromText(text):
for match in allSounds(text):
# filename is html encoded
match = html.unescape(match)
play(match)
def allSounds(text):