Giter VIP home page Giter VIP logo

anki_forvo_dl's Introduction

Hi 👋, I'm Marius

Tech I use:

  • Rust
  • Python
  • JavaScript/TypeScript (frontend and backend development)
    • React
    • NodeJS
  • Kotlin
  • ...and more

Current interests:

  • Graphics Programming (Vulkan)
  • Rust
  • Game Development
  • Systems programming

realmayus

anki_forvo_dl's People

Contributors

elizagamedev avatar realmayus avatar rowantran avatar univerio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

anki_forvo_dl's Issues

Documentation on config.json

Hello,
Could the author provide an example on how to change the source/destination field sin the JSON file? Thank you

RegEx

Allow users to define RegExes which get applied to the query string before sending the request. Also, change this to .replaceAll:

query = query.replace(char, "")

[Feature Request] Ignore the brackets and inside contents when searching

Hi Marius,

I am currently learning Japanese and in order to add furigana to kanji, as the pictures shows, I need to add brackets after the kanji as well as enter the kana inside.

Obviously, this makes it impossible to search for pronunciations even if they exist when searching Forvo.

I would like to know if there is currently a way to ignore the brackets and the contents inside when searching?

20210628133043

20210628132852

Remove bulk-add dialog

Because a large number of people reported issues with their IPs being blocked by CloudFlare, the bulk add dialog will be removed from the add-on. It's not sustainable since no matter how I tweak the delays, CloudFlare's algorithm figures out that the add-on is scraping the website.

I completely understand that this change is controversial, as it was one of the main selling features of the plugin. However, I think it's only morally acceptable to remove the feature, as many people have gotten their IPs banned by using it (despite various delays I've implemented). I think it's a fair compromise to keep the core functionality, which is getting audio files automatically from Forvo. Scraping each audio file individually is more justifiable than shoving a 30,000 cards deck through the plugin, overloading Forvo's servers and risk getting people's IPs banned.

Updated Version doesnt work

When I originally downloaded forvo dl it worked perfectly but when I updated it the updated version doesn't work Could you give me the code for an older version please

screen-21 45 15 25 09 2021

Exception

Any idea how to fix this? MacOS

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.46 (94913ec2) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.16
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-08-28 15:21:16
Add-ons possibly involved: ⁨anki-forvo-dl  Forvo Pronunciation Downloader fully automatic⁩

Caught exception:
Traceback (most recent call last):
  File "aqt/webview.py", line 41, in cmd
  File "aqt/webview.py", line 139, in _onCmd
  File "aqt/webview.py", line 592, in _onBridgeCmd
  File "aqt/editor.py", line 430, in onBridgeCmd
  File "/Users/ryan/Library/Application Support/Anki2/addons21/858591644/__init__.py", line 164, in on_editor_btn_click
    proceed(config_lang.value)
  File "/Users/ryan/Library/Application Support/Anki2/addons21/858591644/__init__.py", line 99, in proceed
    raise Exception()
Exception

I think I'm being blocked by forvo. Tried a vpn but no cigar

Ability to apply automatic transformations to text if Forvo lookup fails

I'm learning Russian, and a lot of my source-material words are accented to show emphasis (which is important to the pronunciation and for learners, but isn't shown in general text for the most part — and which isn't included on Forvo.)

For instance, the word прекра́сно (prikrasna) yields no results, because on Forvo, it's included without the accent: прекрасно yields 7 results.

It'd be wonderful if there were some sort of way to add automated(ish?) transformations for particular languages — in this instance, applying a script like the following before searching Forvo (or, perhaps, after searching Forvo, and then searching with the filtered-version as well):

str.normalize("NFD").replace(/\p{Diacritic}/gu, "")

Preferences dialog not opening

After pressing the Tools->Preferences button this error appears:

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.47 (dc156f34) Python 3.9.7 Qt 5.15.2 PyQt 5.15.4
Platform: Linux
Flags: frz=False ao=True sv=2
Add-ons, last update check: 2021-09-30 21:41:54
Add-ons possibly involved: ⁨anki-forvo-dl - Forvo Pronunciation Downloader fully automatic⁩

Caught exception:
Traceback (most recent call last):
  File "/home/yannicko/.local/share/Anki2/addons21/858591644/__init__.py", line 226, in on_pref_btn_click
    config_manager = ConfigManager(config)
  File "/home/yannicko/.local/share/Anki2/addons21/858591644/src/ConfigManager.py", line 123, in __init__
    self.nt_selector.addItem(str(next(nt.name for nt in self.mw.col.models.all_names_and_ids() if nt.id == nt_id)), nt_id)
StopIteration

Caught exception

This is a fresh install, using Anki Version ⁨2.1.44 (b2b3275f)⁩
I just click the Forvo button and answer the questions and it produces this:

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.44 (b2b3275f) Python 3.8.1 Qt 5.15.1 PyQt 5.15.1
Platform: Linux
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-07-15 14:31:22
Add-ons possibly involved: ⁨anki-forvo-dl  Forvo Pronunciation Downloader fully automatic⁩

Caught exception:
Traceback (most recent call last):
  File "/home/k/.local/share/Anki2/addons21/858591644/__init__.py", line 172, in handle_lang_select
    proceed(d.selected_lang)
  File "/home/k/.local/share/Anki2/addons21/858591644/__init__.py", line 99, in proceed
    raise Exception()
Exception

This is the deck I'm attempting to use the plugin with:
https://ankiweb.net/shared/info/638411848

How to download several recordings onto the same card

I found this addon super helpful in my Persian studies but was disappointed at the fact it doesn't allow you to get multiple recordings on the same note for different fields
For example the field 'Infinitive' with 'Infinitive Recording' budan
and the field 'Stem' with 'Stem Recording' bud

Config migration, What's New

Implement a type checker for migrating older configs to newer versions of the plugin. Currently, the plugin yields an error when it finds a config option in an older configuration file that's not the same type it expects.

Feature request: input box

Hi,

Current situation:
At the moment, if I understand correctly the only way to search for a word using this add-on is to put it as is in a field.

The problem:
Sometimes the form that is written in the field doesn’t match the forms that exist on Forvo. Say you learn English and write all infinitives with ‘to’. Your field should have ‘to celebrate’, but Forvo has only ‘celebrate’.

Proposed solution:
The solution I propose is to add the option for users to input an arbitrary string for search. I think it is best if the default value of the search will be the current value of the relevant field, selected. This way the user has a basis to build upon, and it is easy to replace the whole string with something else. This is the behaviour used in browsers when hitting ctrl+L.

Random crash

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.38 (355e4cd5) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.15.5
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2021-02-26 18:40:51
Add-ons possibly involved: ⁨anki_forvo_dl⁩

Caught exception:
Traceback (most recent call last):
File "aqt/editor.py", line 368, in checkFocus
File "/Users/redacted/Library/Application Support/Anki2/addons21/anki_forvo_dl/init.py", line 203, in
shortcuts.append(("Ctrl+Shift+F", lambda: on_editor_btn_click(editor, True)))
File "/Users/redacted/Library/Application Support/Anki2/addons21/anki_forvo_dl/init.py", line 160, in on_editor_btn_click
proceed(config_lang.value)
File "/Users/redacted

/Library/Application Support/Anki2/addons21/anki_forvo_dl/init.py", line 93, in proceed
results = Forvo(query, language, editor.mw)
AttributeError: 'NoneType' object has no attribute 'get_pronunciations'

Screenshot 2021-02-26 at 22 08 07

Ignore Formatting in Search Field

When using the search function, formatting such as bold do not return any results. I assumed this is because of the html code <b> </b> in search request.

For example
双子 return correct pronunciation but 双子 do not return any results.

New button for 2.1.45

Discussed in #29

Originally posted by quangnd159 July 11, 2021
Hi Marius! Thank you for this awesome addon! I know that 2.1.45 is still in beta as of writing, but it'd be great if you could implement a new button for the new refined button rows on the "Add" window. Something as simple as the word Forvo (no icon) would be great.

You must be very busy, so a No would be totally fine. I'd figured I'd just ask.

Regards,

Quang

Select Language Each Time

Hello,
I have a deck with multiple languages, so forcing a default doesn't work for me. Could the plugin have a "map language by tag" feature or simply let me choose the language each time?

Crash after adding first recordings

I can use the add-on with one or two words but then it stops working. I use it to import Uzbek pronunciation.

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools>Add-ons menu item to disable some add-ons and restart Anki, repeat until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-ons section of our support site.
Debug info:
Anki 2.1.40 (cf446733) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2021-03-03 10:52:31

Caught exception:
Traceback (most recent call last):
File "aqt\webview.py", line 35, in cmd
File "aqt\webview.py", line 124, in onCmd
File "aqt\webview.py", line 569, in onBridgeCmd
File "aqt\editor.py", line 443, in onBridgeCmd
File "C:\Users\ioann\AppData\Roaming\Anki2\addons21\858591644_init
.py", line 158, in on_editor_btn_click
proceed(config_lang.value)
File "C:\Users\ioann\AppData\Roaming\Anki2\addons21\858591644_init
.py", line 91, in proceed
results = Forvo(query, language, editor.mw)
File "C:\Users\ioann\AppData\Roaming\Anki2\addons21\858591644\Forvo.py", line 77, in load_search_query
self.html = BeautifulSoup(page, "html.parser")
UnboundLocalError: local variable 'page' referenced before assignment

Error when loading in Expression

Hi,

I tried using this add-on but ran into an Error. I am not sure if I need a forvo account or need to change anything in the config, but could you may be look at the error message and suggest what I could try to do? Appreciate your help :)

Bearclaw

Message - Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.44 (b2b3275f) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-06-27 14:54:31

Caught exception:
Traceback (most recent call last):
File "aqt\webview.py", line 36, in cmd
File "aqt\webview.py", line 135, in onCmd
File "aqt\webview.py", line 580, in onBridgeCmd
File "aqt\editor.py", line 466, in onBridgeCmd
File "C:\Users\B3ARCLAW\AppData\Roaming\Anki2\addons21\858591644_init.py", line 164, in on_editor_btn_click
proceed(config_lang.value)
File "C:\Users\B3ARCLAW\AppData\Roaming\Anki2\addons21\858591644_init.py", line 99, in proceed
raise Exception()
Exception

Ability to default to a certain user's pronunciation

Hi! Thanks for this great add-on to Anki. I know that, currently, when batch downloading audios, it's possible to auto-select the most popular pronunciation, but would it be possible to have an alternate option to prefer a particular user's pronunciation where it's available? There's a user that has good pronunciations for most of the common words in my target language and it would be great to have the pronunciations consistently from the same person where possible. Thanks!

Add option for disabling .ogg fallback

Sometimes random (my longer?) audio clips auto download as .ogg, if reviewing on the anki ios app these do not play.

Can I force the add on to always download in mp3 or is this on forvo?

Prepend the audio string to the existing contents of the audio field

Hi Marius,

Thank you for making such an easy-to-use plugin!

I have a question: How to set it up to add the audio file to the beginning of the field? (The default is to add to the end of the field).

By default, anki-forvo-dl will append the audio string to the existing contents of the audio field. If you want to change that, see the "Editing the config" section.

I checked and tried to modify the configuration file, but there doesn't seem to be an option for this.

Ability to choose among English variants: American & British

Hello ! Would it be possible to add the choice of selecting:

  • American English
  • British English

Forvo also has a category for "Other" variants.

Would it be nice if we could choose among the desired variant because it is confusing for second language learners to mix British and American pronunciations.

Error: Forvo Crashes

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.36 (c505894b) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2021-07-16 12:38:58

Caught exception:
Traceback (most recent call last):
File "C:\Users\jingx\AppData\Roaming\Anki2\addons21\858591644_init_.py", line 51, in
d.finished.connect(lambda: handle_field_select(d, note_type_id, field_type, editor))
File "C:\Users\jingx\AppData\Roaming\Anki2\addons21\858591644_init
.py", line 44, in handle_field_select
on_editor_btn_click(editor, False)
File "C:\Users\jingx\AppData\Roaming\Anki2\addons21\858591644_init
.py", line 164, in on_editor_btn_click
proceed(config_lang.value)
File "C:\Users\jingx\AppData\Roaming\Anki2\addons21\858591644_init_.py", line 99, in proceed
raise Exception()
Exception

Error message when launching Anki and addon not working

When loading '⁨anki-forvo-dl Forvo Pronunciation Downloader fully automatic⁩':
⁨Traceback (most recent call last):
File "aqt\addons.py", line 210, in loadAddons
File "C:\Users\aedan\AppData\Roaming\Anki2\addons21\858591644_init_.py", line 36, in
config = Config(os.path.join(user_files_dir, "config.json"),
File "C:\Users\aedan\AppData\Roaming\Anki2\addons21\858591644\Config.py", line 27, in load_config
self.config = json.loads(f.read())
File "json_init_.py", line 357, in loads
File "json\decoder.py", line 337, in decode
File "json\decoder.py", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Basic (type in the answer cards)

I learn languages on Anki and I put English on the Front with the French on the Back.

Where should I insert the forvo pronunciation so that I do not hear it with the English but after I have attempted the French word.

No Results Found :( error message

It seems that I get this error code every time I try to use the addon. I confirmed on Fovo that the word does have sound files available.

Is there a limitation to the addon for say, people using Cloze-Deletion cards?

I'm currently using AnKing's massive deck right now. Thanks for any help!

Button doesn't appear and shortcut doesn't work in the QT6 beta of Anki

Problem description

Dae's posted a QT6 beta of Anki. Most of my addons work fine, but unfortunately, that doesn't include anki-forvo-dl.

The blue 'search forvo' button doesn't appear on the "add" interface; and the ⌃F shortcut doesn't function either.

Information about your Anki set-up

    Anki 2.1.50 (abd671d4) Python 3.9.7 Qt 6.2.0 PyQt 6.2.0
    Platform: Mac 12.0.1
    Flags: frz=True ao=True sv=3
    Add-ons, last update check: 2021-12-02 08:37:14
    
    ===Add-ons (active)===
    (add-on provided name [Add-on folder, installed at, version, is config changed])
    
    ===IDs of active AnkiWeb add-ons===
    
    ===Add-ons (inactive)===
    (add-on provided name [Add-on folder, installed at, version, is config changed])

Ability to specify country

Hi,
I think the ability to specify the country you want, as well as the language, would be very useful. For example, if you only wanted European Spanish audio rather than having a mix of Latin and European Spanish. Same idea with European and Brazilian Portuguese, Canadian and European French, etc.

Bug

When I press "Forvo" button an error ocurrs

Debug info:
Anki 2.1.43 (0fbae6bc) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 8.1
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-05-03 18:25:37

Caught exception:
Traceback (most recent call last):
File "aqt\webview.py", line 36, in cmd
File "aqt\webview.py", line 135, in onCmd
File "aqt\webview.py", line 580, in onBridgeCmd
File "aqt\editor.py", line 466, in onBridgeCmd
File "C:\Users\OK\AppData\Roaming\Anki2\addons21\858591644_init
.py", line 164, in on_editor_btn_click
proceed(config_lang.value)
File "C:\Users\OK\AppData\Roaming\Anki2\addons21\858591644_init
.py", line 99, in proceed
raise Exception()
Exception

Crash after changing field name

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.40 (cf446733) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2021-02-21 17:33:39

Caught exception:
Traceback (most recent call last):
File "anki\notes.py", line 106, in _fieldOrd
KeyError: 'Kanji'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "aqt\webview.py", line 35, in cmd
File "aqt\webview.py", line 124, in _onCmd
File "aqt\webview.py", line 569, in onBridgeCmd
File "aqt\editor.py", line 443, in onBridgeCmd
File "C:\Users\REDACTED\AppData\Roaming\Anki2\addons21\858591644_init
.py", line 77, in on_editor_btn_click
if editor.note is not None and editor.note[search_field] is not None and len(editor.note[search_field]) != 0:
File "anki\notes.py", line 111, in getitem
File "anki\notes.py", line 108, in _fieldOrd
KeyError: 'Kanji'

Doesn't select current note type

How to reproduce the bug:

  • Open Add Cards window
  • Change note type
  • Click Forvo button

Expected behaviour:
Note type should be the selected note type

Actual behaviour:
Note type was 'Basic'. (Instead of the selected one) Selecting a field led me back to the field selection window again, not letting me proceed.

I band-aided the problem by changing the line __init__.py:63 to note_type_id = editor.note.mid if editor.note is not None else editor.card.note().mid if editor.card is not None else editor.mw.col.models.current()["id"]

Anki: v2.1.47
Using the latest update of the add-on

Add audio when reviewing?

Would be cool if one could just press the shortcut and add the top pronunciation while reviewing. Don't know if this is possible?

Bold, underline blocks finding on Forvo

In my Russian study I use bold or underline to signify which syllable has stress. Forvo_dl takes this string as is apparently, because if any character is bold or underlined Forvo doesn't return any results.

If possible, clean the input from such marking before offering to Forvo.

Add more than one audio at a time?

Hey!
Would be cool if one could select an option to have multiple audios for a word, so one can hear the same word with different voices. This is especially useful for languages like Chinese.

Some audios wont play on IOS app

Hello! Firstly thanks for your great add on. I am not very techy so please excuse me if this is something very simple. I normally make my cards on my laptop then practise on my phone using the iPhone app. Weirdly, a lot of the audio files wont play and this message comes up. Any idea why or how I could fix it? Thanks

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.