jdlorimer / chinese-support-redux

Anki add-on providing support for Chinese study
https://ankiweb.net/shared/info/1128979221
GNU General Public License v3.0
101 stars 50 forks source link

Not getting audio clips while trying to use Google Mandarin speech engine #213

Open PisoMojado opened 1 year ago

PisoMojado commented 1 year ago

I have selected "Google Mandarin (Taiwan)" as my speech engine, and for new clips recently nothing happens - the note mentions a file by the right name, but no file is downloaded by that name.

I don't know how to produce error logs (I tried to find a way online), but if someone can show me, I'm happy to.

Anki Version Info:

Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 6.3.1 PyQt 6.3.1
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-10-11 08:45:29

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Chinese Support Redux v0142 ['1128979221', 2021-03-28T21:19, 'None', mod]

===IDs of active AnkiWeb add-ons===
1128979221

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
PisoMojado commented 1 year ago

On further review, it looks like every speech engine has this issue for me. I still can't figure out how to elevate the log level for the addon, or if debug logging is present. It does not come up in the console while running Anki.

MTH88 commented 1 year ago

Hi! Same thing happens to me, it has been a couple of weeks since my new cards do not get the audio.

The field "sound" is filled out (for example: [sound:话题_google_zh-CN.mp3]), however, when I review the card it does not reproduce any sound. For older cards, they reproduce the sound, so I guess it's something that only happens to the new cards created.

I tried to add new cards in another computer with another account but I had the same problem. I have selected the "Google mandarin (PRC)" speech engine.

If someone could look it up it would be great!! :). Just let me know if I can send any log or something that helps to identify the problem.

Thanks a lot!

PisoMojado commented 1 year ago

I did some deeper digging, and I was able to identify the issue. google.cn is no longer accepting requests for TTS via gTTS. You can reproduce this with that project's CLI:

PS C:\Users\michael> gtts-cli '超' --tld cn --lang zh-TW --output 超.mp3 Error: 404 (Not Found) from TTS API. Probable cause: Unknown PS C:\Users\michael>

This project is currently directing traffic to google.cn via the tld argument in gTTS. Changing it to google.com resolves the issue.

Please see push request #215 for the fix. While working on this, I also noticed a lot of the APIs in Anki have been marked deprecated, so I opened #216 to address these changes, as well.

PisoMojado commented 1 year ago

I'd also like to go ahead and compliment the author(s) for their documentation in the README.md. I should have read it at the very beginning, it was very helpful for getting setup to debug the add on and figure this out, so thanks!

MTH88 commented 1 year ago

This worked! I am very grateful, I wouldn't have been able to identify the problem myself :). Thanks a lot!!

thechesu commented 1 year ago

I'm getting the issue with all the speech engines.

As a non-programmer, I do not understand how to implement the fixes that you suggest. Would you be able to explain in simple terms, on how to implement these fixes please?