dillonwall / generate-batch-audio-anki-addon

An addon that downloads and attaches audio to flashcards in bulk from URLs. Made for Anki, an SRS flashcard application
Apache License 2.0
14 stars 6 forks source link

bugged on ⁨anki 23.12.1 #19

Closed phamthaison1207 closed 1 month ago

phamthaison1207 commented 2 months ago

when I try to add audio to a WordAudio field using the word from the Key field it gives this error message. Does this have to do with the version? image

dillonwall commented 1 month ago

Hello, and thank you for using the addon!

I personally have this same Anki version, and it seems to work alright for me, though a couple things stand out to me from your screenshot:

  1. Though likely not the root cause, it's worth mentioning: have you tried running the problem card(s) with "Dangerously fast" unchecked?
  2. The "Add-ons possibly involved" from the error message includes Local Audio Server for Yomichan. This addon hosts a "url" for you to connect to and should provide audio files when requesting from that "url". I am wondering if the error somehow is produced due to a bug or setup issue with this addon?
  3. In order to get more information about exactly what is going on here, if you could reproduce this error, click "Copy Debug Info", and paste the results as a comment on this issue, I would highly appreciate it as it would likely provide some valuable insights!

Also, for some added context I would like to know; does this error only happen on a specific card / Many cards / All cards, or even at random?

Many thanks for posting this issue here, I hope we can get it resolved quickly. -Dillon

phamthaison1207 commented 1 month ago

Hello Dillon, thank you for trying to fix this bug, I will try to reproduce the errors like you mentioned with the added details you wanted to know. Also, yes, they don't work on ALL cards.

phamthaison1207 commented 1 month ago

Here's the debug info that I can reproduce very easily with the addon, and yes, it doesn't work with all of the cards Anki 23.12.1 (1a1d4d54) (ao) Python 3.9.15 Qt 6.6.1 PyQt 6.6.1 Platform: Windows-10-10.0.22000


Exception occurred during processing of request from ('127.0.0.1', 58402) Traceback (most recent call last): File "socketserver", line 683, in process_request_thread File "socketserver", line 360, in finish_request File "http.server", line 658, in init File "socketserver", line 747, in init File "http.server", line 432, in handle File "http.server", line 420, in handle_one_request File "C:\Users\Admin\AppData\Roaming\Anki2\addons21\1045800357\server.py", line 166, in do_GET qcomps = self.parse_query_components() File "C:\Users\Admin\AppData\Roaming\Anki2\addons21\1045800357\server.py", line 107, in parse_query_components raise Exception(f"Cannot find term or expression in query: {self.path}") Exception: Cannot find term or expression in query: /?sources=nhk16&term=&reading=%7Breading%7D


Exception occurred during processing of request from ('127.0.0.1', 58403) Traceback (most recent call last): File "socketserver", line 683, in process_request_thread File "socketserver", line 360, in finish_request File "http.server", line 658, in init File "socketserver", line 747, in init File "http.server", line 432, in handle File "http.server", line 420, in handle_one_request File "C:\Users\Admin\AppData\Roaming\Anki2\addons21\1045800357\server.py", line 166, in do_GET qcomps = self.parse_query_components() File "C:\Users\Admin\AppData\Roaming\Anki2\addons21\1045800357\server.py", line 107, in parse_query_components raise Exception(f"Cannot find term or expression in query: {self.path}") Exception: Cannot find term or expression in query: /?sources=shinmeikai8&term=&reading=%7Breading%7D


Exception occurred during processing of request from ('127.0.0.1', 58404) Traceback (most recent call last): File "socketserver", line 683, in process_request_thread File "socketserver", line 360, in finish_request File "http.server", line 658, in init File "socketserver", line 747, in init File "http.server", line 432, in handle File "http.server", line 420, in handle_one_request File "C:\Users\Admin\AppData\Roaming\Anki2\addons21\1045800357\server.py", line 166, in do_GET qcomps = self.parse_query_components() File "C:\Users\Admin\AppData\Roaming\Anki2\addons21\1045800357\server.py", line 107, in parse_query_components raise Exception(f"Cannot find term or expression in query: {self.path}") Exception: Cannot find term or expression in query: /?sources=forvo&term=&reading=%7Breading%7D

===Add-ons (active)=== (add-on provided name [Add-on folder, installed at, version, is config changed]) AJT Card Management ['1021636467', 2024-03-16T08:51, 'None', mod] AJT Japanese ['1344485230', 2024-06-17T06:12, 'None', mod] Add Tag and Move 21 ['1923996023', 2021-11-22T00:16, 'None', mod] Advanced Browser ['874215009', 2023-10-21T21:34, 'None', ''] Advanced Copy Fields ['1898445115', 2024-01-09T00:01, 'v0.4.01', ''] AnkiConnect ['2055492159', 2024-06-18T09:37, 'None', mod] AnkiRestart - Quick Aniki Rebooter for Customize Develop Created by Shige ['237169833', 2024-02-06T20:21, 'None', mod] AnkiWebView Inspector ['31746032', 2023-06-28T02:26, 'None', ''] Audiovisual Feedback ['231569866', 2023-07-09T10:34, '0.8', mod] BetterSearch ['1052724801', 2024-03-06T23:25, 'None', ''] Bulk Image Downloader - GoogleAPI-Webp-DuringReview Created by Shige ['8280891', 2024-04-12T20:30, 'None', mod] CSS Injector - Change default editor styles ['181103283', 2023-02-22T04:15, 'None', ''] Custom Background Image and Gear Icon ['1210908941', 2023-04-19T08:19, 'None', mod] EdgeTTS Japanese Text To Speech Audio Generator ['edge-tts-generate', 0, 'None', mod] FSRS Helper Postpone Advance Load Balance Easy Days Disperse Siblings ['759844606', 2024-07-09T19:54, 'None', mod] FieldReporter ['569864517', 2023-04-09T22:00, 'None', mod] Generate Batch Audio ['1156270186', 2024-03-07T20:28, 'None', ''] Image Occlusion Enhanced ['1374772155', 2022-04-09T14:15, 'None', ''] JPMN Manager with prereleases ['1732829476', 2023-07-12T14:12, 'None', mod] Japanese Readings and Pitch Accent ['1845503807', 2023-01-02T07:38, 'None', ''] Japanese Support ['3918629684', 2023-10-19T10:13, 'None', ''] Kanji Grid 2310 ['1469765093', 2023-11-02T09:07, 'None', ''] Local Audio Server for Yomichan ['1045800357', 2023-06-19T10:57, 'None', ''] PassFail 2 Remove the Easy and Hard buttons ['876946123', 2024-06-04T08:56, 'None', ''] Paste Images As WebP ['1151815987', 2024-04-23T17:42, 'None', mod] Progress Graphs and Stats for Learned and Matured Cards ['266436365', 2020-03-29T13:26, 'None', ''] Review Heatmap ['1771074083', 2022-06-30T08:43, 'None', ''] True Retention by Card Maturity Simplified ['1779060522', 2020-06-28T20:45, 'None', ''] Web Browser - Search terms Import texts and images automatically ['864545277', 2023-11-18T02:28, 'None', mod] Yomichan Forvo Server ['580654285', 2024-07-16T05:36, 'None', '']

===IDs of active AnkiWeb add-ons=== 1021636467 1045800357 1052724801 1151815987 1156270186 1210908941 1344485230 1374772155 1469765093 1732829476 1771074083 1779060522 181103283 1845503807 1898445115 1923996023 2055492159 231569866 237169833 266436365 31746032 3918629684 569864517 580654285 759844606 8280891 864545277 874215009 876946123

===Add-ons (inactive)=== (add-on provided name [Add-on folder, installed at, version, is config changed]) AnkiCraft ['ankicraft', 0, 'None', mod] Batch Editing ['291119185', 2023-10-26T07:38, 'None', ''] More Flags - Add card flags with custom names and colors ['146757953', 2023-10-17T16:14, 'None', mod] Puppy Reinforcement ['puppy-reinforcement-anime-girls', 2023-11-16T19:56, 'None', mod] Study Time Stats ['1247171202', 2024-02-24T23:59, 'None', '']

phamthaison1207 commented 1 month ago

I ran this with the dangerously fast box unchecked too image

dillonwall commented 1 month ago

Can you please send a screenshot of your card fields as well? This is found under: Manage Note Types -> (select the card type you use) -> Fields

Also, on any one of the notes that don't work, could you send a picture of the word and reading fields?

dillonwall commented 1 month ago

My current thought is-- It seems that the term query parameter is not getting populated. I am wondering if this has to do with the card configuration or not.

Either way, as a future enhancement/bug fix, it would be wise to add some validation in the code so that empty parameters are brought to the user's attention.

phamthaison1207 commented 1 month ago

sorry for waiting so long to write an update on my stuff: my note type is the jpmn note type:

image image

dillonwall commented 1 month ago

Ah yes, as thought, your card field is named "WordReading" but in the urls of the addon, for the last part, the reading parameter is only set to "{reading}".

Change all 4 of these to the name of your card field and it should work as expected, e.g. "{wordreading}" or "{WordReading}", either will work as it is case-insensitive.

I will open an issue for an enhancement to warn users if this is the case, to avoid a similar situation in the future.

Marking this as closed for now, but feel free to comment further as needed!

phamthaison1207 commented 1 month ago

Thank you Dillon, appreciate your diagnosis

On Tue, Jul 30, 2024, 14:42 Dillon Wall @.***> wrote:

Ah yes, as thought, your card field is named "WordReading" but in the urls of the addon, for the last part, the reading parameter is only set to "{reading}".

Change all 4 of these to the name of your card field and it should work as expected, e.g. "{wordreading}" or "{WordReading}", either will work as it is case-insensitive.

I will open an issue for an enhancement to warn users if this is the case, to avoid a similar situation in the future.

Marking this as closed for now, but feel free to comment further as needed!

— Reply to this email directly, view it on GitHub https://github.com/DillonWall/generate-batch-audio-anki-addon/issues/19#issuecomment-2257685980, or unsubscribe https://github.com/notifications/unsubscribe-auth/APFD2IAS2DIHUMYX3AM4GILZO47VRAVCNFSM6AAAAABKPBSZXKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJXGY4DKOJYGA . You are receiving this because you authored the thread.Message ID: @.*** com>