Giter Site home page Giter Site logo

rascalov / anki-simple-forvo-audio Goto Github PK

View Code? Open in Web Editor NEW
30.0 3.0 3.0 1.16 MB

Simple anki 2.1+ addon to get forvo audio into your cards for free. No Forvo account needed

Home Page: https://ankiweb.net/shared/info/560814150

License: GNU General Public License v3.0

Python 100.00%
anki python3 forvo free

anki-simple-forvo-audio's Introduction

Fetch Gif SHould be here

Installation

Either clone this repository to your Anki-Addons folder or download the zip in Releases, unzip it, and put in your addon folder

You should be good to go. But should the audio not play, you might need to set the download path:

  • Go to Anki>Tools>Add-ons
  • Select the addon
  • Click on Config
  • set your downloadPath to the path anki uses to save media

On linux, mine looked like:
/home/user/.local/share/Anki2/User 1/collection.media/

On windows you need to use forward slashes or double backslashes for your path, otherwise the program will return an invalid configuration error message. Eg.
C:\\Users\\Administrator\\AppData\\Roaming\\Anki2\\yourankiaccountname\\collection.media

Result:
On Linux

On Windows

Anki Simple Forvo Audio

Main goal of this addon is to make forvo audio easy to apply to your anki cards (and doing so for free ).
No forvo account is needed.

AwesomeTTS supports forvo, but only if you pay for an API key or subscribe to their patreon.
I wrote this to avoid monthly payments.

The addon has 2 functionalities:

Select and fetch

Gif should make it straightforward. Select your word, rightclick on * Add Forvo Audio*.
This brings you to a pop up where you can quickly search for your word, choose your language, and the destination field. Fetch Gif SHould be here You can also also preview the audios before you choose one.















Auto Fetch (NOT RECOMMENDED (yet))

My deformed son. You can find it in tools>Add Forvo TTS to deck
It takes in a deck and, depending on the fields you select, downloads audios from either forvo or my own CDN that uses forvo when needed.

It can save you some time and effort on large decks, BUT
Warning: Can get you ip banned if you overuse it!

Forvo is cracking down on IP's that download too many audios from her site in bulks. I set a limit of 100 audios. You can edit this limit in the config, if you feel lucky.

Use this feature at your own risk, I might find a safer way get the audios in bulks later on that's still free.

Generator Gif SHould be here

anki-simple-forvo-audio's People

Contributors

rascalov avatar rc-ops 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

Watchers

 avatar  avatar  avatar

anki-simple-forvo-audio's Issues

Preview audio and choose audio causes error

I'm on the latest anki version and when I click the preview audio and choose audio, it comes up with an error.
I'm on a mac btw trying to use Japanese audio.

Screenshot 2022-08-04 at 00 26 32

Screenshot 2022-08-04 at 00 26 56

Idk if these screenshots help? First one is for "preview audio", second is for "choose and close"

Дополнение перестало работать

Снимок экрана (67)
Вчера я активно использовал прекрасное дополнение, но сегодня оно перестало выдавать результаты для абсолютно любых языков. Буду очень благодарен, если поможете решить проблему. Я переустановил дополнение, но это все равно не помогло, вчера я добавил аудио примерно к 150 карточкам, лимиты настроек я не менял со 100. Никаких ошибок не появлялось, все работало отлично

No Brazilian Portuguese results

The add-on doesn't seem to recognize Portuguese audio with a Brazilian pronunciation.

It only returns audio from Portugal, if it exists; otherwise it returns "no results found".

The latter happens maybe 50% of the time, since Forvo has way more clips from Brazil.

Search doesn't find anything?

I have Anki 2.1.65 and have just installed this addon, but I get no results for even the simplest words, e.g. hola in Spanish. I see this was fixed before. Is there a new bug?

Bug when adding audio, deleting it, and then adding it do a different field

Caught exception:
Traceback (most recent call last):
  File "C:\Users\Andrew\AppData\Roaming\Anki2\addons21\560814150\ForvoTts.py", line 173, in <lambda>
    addButton.clicked.connect(lambda: self.insertIntoCard(ankiAudioObject))
  File "C:\Users\Andrew\AppData\Roaming\Anki2\addons21\560814150\ForvoTts.py", line 196, in insertIntoCard
    os.rename(fullpath, self.getDefinteConfigPath() + ankiAudioObject.getBucketFilename())
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'C:\\Users\\Andrew\\AppData\\Roaming\\Anki2\\User 1\\collection.media\\TEMP_AUDIO_FILE-立場-869928.mp3' -> 'C:\\Users\\Andrew\\AppData\\Roaming\\Anki2\\User 1\\collection.media\\立場-869928.mp3'

Context: I have accidentally added the audio to the wrong field. I deleted it, and then tried adding it to a different field, then got this error. Deleting the file from the media folder and restarting Anki helped.

No "Add forvo audio" option

Hi. I'm trying to use the addon, but there's no option to add audio when I right click. Tried via the Add new card dialog and through the Edit an existing one. I've installed through ankiweb and directly from the repository, same result.
2021-04-23 21_47_12-Greenshot

I'm using Anki 2.1.43 on Windows 10.

Autofill for selected text not supported on WIndows

The solution I used to get the selected text to autofill on the Forvo TTS popup is supported on linux but has no support on Windows and macOS.

Per the QClipboard documentation

Windows and macOS do not support the global mouse selection; they only supports the global clipboard, i.e. they only add text to the clipboard when an explicit copy or cut is made.

So I'll have to find another way of using selected text. Though from the looks of it, windows and macOS dug their own grave in terms of supporting this kind of feature.

can not be used on version of 2.1.54 QT5

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

Forvo scraping is dead (long live forvo?) aka: No results found

Before you read

There seems to have been a hopeful change since I wrote this post.
This Bot check that prevents the extension from working does not always occur.
Now that I have visited the site again through my actual browser, the check did not occur and the extension does not face a problem.

What happened?

As explained in #28 (comment), Forvo has made it very tedious to obtain audios in a smooth manner for the average Anki extension. You may notice a small "Cloudflare" check when you visit forvo.com

That check will go off without much of a hassle for you and your fully functional browser, but the scraper is a simple thing that cannot handle the dynamic nature of that browser check. Even if it could, it would not be able to automatically solve the captcha that might appear when cloudflare suspects a bot is trying to access the site.

Any way to still get audios?

The extension does support another website: lingualibre.org
If you go to your anki addon config, you can change this value to true:
image

Disclaimer

LinguaLibre is by far not a replacement of forvo, it has a very limited selection of words (at least, in Russian). Results may vary per language.

What now?

The only real path forward is to implement something I was recommended some time ago by #5. A dictionary of audios (scraped from Forvo) that can be called upon for audio lookups. This would mean that the extension would no longer use Forvo as a direct source for audios and would rely on an audio dictionary downloaded by the individual user.
Including all of these audio dictionaries inside the extension is super impractical, given 1 language can have multiple gigabytes of audios alone.

Will you actually do it?

Thing is, this is basically a rewrite of the entire extension, save for the user interface.
On top of that, it also forces the user to take extra actions, which is downloading the dump of forvo audios from (for example) this archive:
https://cloud.freemdict.com/index.php/s/pgKcDcbSDTCzXCs

Another major thing is time, I have not been around to fix much of anything related to this project in a while. I try to respond to most issues posted out of courtesy (and a sort of guilt), but that has been the extend of my participation.

I don't plan to kill the project, but I probably won't continue the Forvo route when I eventually have time to work on it.

Fix deprecation warnings

Presumably with QT6, a lot of used methods became deprecated.
Luckily these are all shown in the cli output:
image

This should be fixed with some haste as to avoid future compatibility issues.
The warnings explain exactly what to use instead, but everything must be tested regardless.

Remember language and destination field for each deck

Suppose I have deck A and deck B with different languages. Right now when I want to add audio to a card from deck A, I have to select the destination field and the language, and if afterwards I want to audio to a card from deck B, I have to re-select the language and teh destination field.
Solution: add a "Save preferences" button. It will save the destination field and language (for this deck) in the add-on configuration. That way users won't have to switch back and forth between languages and destination fields if they are learning 2 or more languages, or using 2 or more different decks with different field names.

Search comes up with no results?

I'm on the latest anki version and this used to work fine, but when I search for something now it just says no results found. I tried with words that worked before but it has no results for them either.
I'm on a mac btw.

this addon is what i need but i cant embed the audio at the last step

错误
发生了一个错误。请在启动Anki时按住「Shift」键临时禁用插件加载。 如仅在插件启用时出错,请使用「工具」>「插件」功能禁用部分插件后重启Anki, 请重复上述步骤直至找到引起错误的插件。 找到引起错误的插件后,请反馈给插件作者。 调试信息:
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-08-27 22:59:21

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

A method to scrape all Forvo pronunciations to use the add-on offline

A method to scrape all Forvo pronunciations is now available :

https://ankiweb.net/shared/info/560814150#:~:text=11%2F21%2F2021-,a%20method%20to%20scrape,-all%20Forvo%20pronunciations

The scraping method works perfectly. It can scrape absolutely all the audio files for each language.

For example, there are more than 500.000 russian audios to scrape easily.

Would it be possible to download the audios of one's target language and then bulk add into Anki with the add-on ?

No longer working for English language only

Hello,

Any time I search for a word, it will not show any results if it's in english even after confirming it's on Fovo. However; the other languages still work.

I think maybe Fovo changed something for english?

Anyways, if there's a solution or something i can edit in the ini files please let me know, I love your addon!

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.