Rascalov / Anki-Simple-Forvo-Audio

Simple anki 2.1+ addon to get forvo audio into your cards for free. No Forvo account needed
https://ankiweb.net/shared/info/560814150
GNU General Public License v3.0
33 stars 3 forks source link

can not be used on version of 2.1.54 QT5 #13

Closed ZhangYan2580 closed 2 years ago

ZhangYan2580 commented 2 years ago

the old plugin can not the audio, but new version can be used on anki when i try to add audio to card, letters as follows appear.

错误 发生了一个错误。请在启动Anki时按住「Shift」键临时禁用插件加载。 如仅在插件启用时出错,请使用「工具」>「插件」功能禁用部分插件后重启Anki, 请重复上述步骤直至找到引起错误的插件。 找到引起错误的插件后,请反馈给插件作者。 调试信息: Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 5.15.2 PyQt 5.15.5 Platform: Windows 10 Flags: frz=True ao=True sv=2 Add-ons, last update check: 2022-07-18 20:07:59

Caught exception: Traceback (most recent call last): File "C:\Users\19737\AppData\Roaming\Anki2\addons21\560814150\ForvoTts.py", line 155, in addButton.clicked.connect(lambda: self.insertIntoCard(ankiAudioObject)) File "C:\Users\19737\AppData\Roaming\Anki2\addons21\560814150\ForvoTts.py", line 175, in insertIntoCard fullpath = self.getDefinteConfigPath() + AnkiAudioGlobals.TEMP_FILE_PREFIX + ankiAudioObject.getBucketFilename() File "C:\Users\19737\AppData\Roaming\Anki2\addons21\560814150\ForvoTts.py", line 203, in getDefinteConfigPath if(configPath[-1] != "\" or configPath[-1] !="/"): IndexError: string index out of range

Rascalov commented 2 years ago

Have you set your downloadPath in the configuration? 21070614024429

Rascalov commented 2 years ago

Closing this since I hear nothing back. If you still have issues after this config edit then you can create another issue

homocomputeris commented 1 year ago

Manual download path setup can be avoided if add_file is used, for example: https://github.com/realmayus/anki_forvo_dl/blob/437988962401b1a7ea2699e1230f61b92eca3665/src/Forvo.py#L35

Rascalov commented 1 year ago

Did not know that existed, thanks for the heads up! Currently, if no path is set, it downloads the file to the same spot as the example (mw.col.media). So I don't think it needs a change for now. I might use the add_file method when I decide to clean up the old stuff like downloadPath config

homocomputeris commented 1 year ago

The problem I encountered (version 2023-06-22) is similar to the original issue: audio do not play on desktop. And when I investigated, it turned out the files were not in collection.media.

The add-on I liked was, unfortunately, abandoned (while yours has the killer feature: bulk add) but it's MIT-licenced, so I believe you can use its source code in yours. For example, it somehow automatically decides between ogg and mp3.

Rascalov commented 1 year ago

Aha! I think I encountered that same issue you describe not too long ago! Were the file names prefixed with 'collection.media'? I messed up pathing which caused the issue (that may not have happened if I had used add_file all along .__.) I believe I fixed it in https://github.com/Rascalov/Anki-Simple-Forvo-Audio/commit/b2f0f20b3bd196ed08e998301aa3d5a4eb814ade , but if it still persists I welcome you to make a separate issue for it! I have time to work on the addon again on Sunday, so it should be fixed by then.

while yours has the killer feature: bulk add

I feel like I am neglecting this feature too much as apposed to how much I hear people like it (I am already glad that it still works!) I personally haven't used it since I got my residential IP address blocked for it (in hindsight using my residential IP address was stupid to begin with). I feel like

it's MIT-licenced, so I believe you can use its source code in yours.

Sounds interesting, although I am nowhere near as informed on licensing as I ought to be, it wouldn't hurt to take a closer look. Would you say a license is important to have for my addon? I personally have no problem with people copying whatever I made for their own needs, as long as I can use the better addon they made with it!

homocomputeris commented 1 year ago

Were the file names prefixed with 'collection.media'?

No, in Anki's note field files were added as [sound:word-1236876.mp3]. But I've never understood where they were downloaded to until I found this issue.

Would you say a license is important to have for my addon?

The thing is, without a licence other devs cannot reuse or distribute your code because it's a legal risk for them. So, they probably won't.

Here is a guide to select a licence: https://choosealicense.com/ And an article from Github: https://github.com/readme/guides/open-source-licensing

Eventually, the choice will probably be between MIT/BSD-like (permissive) or GPL (the changes must be published). GPL is used, for example, by https://github.com/Ajatt-Tools and https://github.com/FreeLanguageTools/vocabsieve

Rascalov commented 1 year ago

No, in Anki's note field files were added as [sound:word-1236876.mp3]. But I've never understood where they were downloaded to until I found this issue.

That makes sense, the filename on the card remained the same, for me the file itself got the collection.media prefix and was put in the folder 1 level before the actual collection.media folder, because of https://github.com/Rascalov/Anki-Simple-Forvo-Audio/commit/b2f0f20b3bd196ed08e998301aa3d5a4eb814ade

The thing is, without a licence other devs cannot reuse or distribute your code because it's a legal risk for them. So, they probably won't.

Oh dear, then I should that as soon as possible, the GPL seems to suit my wants, I would like to use and see the upgrades someone made. I see there are templates so I will quickly add it before I have to go to work