vi3itor / lingualeoanki

An add-on for Anki to import words from LinguaLeo
GNU General Public License v3.0
19 stars 2 forks source link

Audio downloading #20

Open alexeyboo opened 3 years ago

alexeyboo commented 3 years ago

The audio isn't loading

vi3itor commented 3 years ago

Hi! Thank you for the feedback!

I've just tested the add-on on my Mac with the following versions of Anki: 2.40 (latest version), 2.35, and even 2.23. It works fine on all of them. I will test it on Windows tomorrow.

What version of Anki and what Operating System (Windows, macOS, Linux) are you using? If it is the latest version of Anki (2.40), can you also try the latest stable release (2.35)? Can you post an example of the word (or a sentence) for which you can't download the audio?

Thanks!

alexeyboo commented 3 years ago

Sorry for the uninformative comment above, because I thought it is a common problem. I've tried it on 2.33 and 2.35 Anki version on Windows 10 Here are lots of examples. Almost half of the audio files haven't been downloaded. Many images are also gone. It feels like it is happening because I added most of the new words (and phrases) through their chrome extension LEOANKI

alexeyboo commented 3 years ago

I also would like to have an option to update only sounds and images (separatively) in the existing notes

vi3itor commented 3 years ago

I fixed the problem, please try the latest version (2.2.8) and let me know if you experience any issues.

The problem was only with the images (and not with audio): all the words added by the Chrome extension point to the following link: https://contentcdn.lingualeo.com/uploads/1611_1361481210.jpg which returns a 403 Forbidden error. If you check the dictionary on the lingualeo website, you will not find any picture there too.

The latest reviews for the Chrome extension (sorted by date) clearly suggest that it is still broken (even after the update in November).

If you check "Update existing notes", it will remove a missing picture filename. Although, if you made some changes to the Russian translation in Anki and not in the web interface it will be overwritten.

alexeyboo commented 3 years ago

I've checked this version and all broken picture filenames are gone. Also, I've noticed an interesting behavior. If a word is added to Lingualeo dictionary through their website, its audio is being imported to Anki deck perfectly. If a word is added to dictionary through their chrome extension, it has a playable audio on the web interface, but the audio is missing in Anki deck after importing

vi3itor commented 3 years ago

@alexeyboo, on my machine the audio works when I add the word via Chrome extension. I am using the latest version of the extension (3.0.2). I also tested it in Firefox: the audio is downloaded and playable. I went further and deleted the word added by extension from the web interface, then removed it from Anki and cleaned the unused media. Then I added the same word via a web interface and downloaded it using the add-on. The audio file is identical.

alexeyboo commented 3 years ago

I found a partial solution to my problem. It all started when I tried to experiment with adding some tags to my notes externally and constantly exported and imported my deck. Somehow I forgot to tick some checkbox and all my media links were deleted. Then, I imported all Leo words again with 'update existing notes' checkbox enabled, but the audio in some of the notes was missing. I tried several cases (in all cases I enabled the checkbox 'update existing notes'): 1) when I just press import all words import all words +upd 2) when I press import from dictionaries and select the first 'My dictionary' one import from dictionaries-My Dictionary + upd import from dictionaries-My Dictionary + upd 2 3) (here starts the solution) when I press import from dictionaries and select 'Words from Content' and 'Words from the Internet' import from dictionaries-Content Internet + upd import from dictionaries-Content Internet + upd 2 4) when I press import from dictionaries and select all the dictionaries (there are several others) import from dictionaries- select all dictionaries + upd So, I couldn't see the initial 14451 words anywhere image (I deleted 2 words today) All in all, the number of audios has increased, but there are still ~1500 of them are missing

vi3itor commented 3 years ago

Oh, I see. I have never downloaded so many words at once. There might be a problem on the Lingualeo side: if they see too many requests from one IP they might cut some connections. That's why some of the media is missing. But if you repeat "Import all words" with "Update existing" flag set it will skip downloading the media if it already exists, so it will only try downloading missing files. Other thing to try: limiting the number of words to download concurrently in the config. Although it slows down the process, it decreases the number of requests sent to the server at once.

alexeyboo commented 3 years ago

Both cases didn't help. I set "wordsPerRequest": 100 and "parallelDownloads": 0. I've noticed that it determines the number of words to download at the beginning and it always matches the final number of downloaded words. Also, it always less than my number of words in Lingualeo

vi3itor commented 3 years ago

I remember that after Lingualeo's major update many users complained that the words and translations were lost. As far as I know, they were not restored. It's the issue not only of their web interface but also API: it was simply impossible to retrieve those words. Some users confirmed that even when the category showed, e.g., 28 words they could count only 25 or so. It affected mostly the users who had a lot of words and who joined the service a long time ago. It was easier to spot such discrepancies after the update in 2019 before the earlier words were grouped by years. But I can only hope LinguaLeo fixed issues with showing the correct number of words in the web interface.

If you really want to get your missing words, I suggest trying the following Chrome extension and counting the number of lines in the CSV file. I haven't been following it for some time, so I don't know if the author uses the old or the new API (that might make some difference).

alexeyboo commented 3 years ago

I've tried this extension and it shows 14455 words, each with the audio link, while there are 14457 words on the web interface. I can work with that by writing some kludge maybe

vi3itor commented 3 years ago

Good. When I have time, I'll check what is done differently in the Chrome extension and make some improvements to the current add-on.

alexeyboo commented 3 years ago

Great. But I still beg you to make an option to update at least only images in the existing notes. You see, there are some bigheads who add an image to the word that contains the same word written on it. I deleted them in cards I encountered with, but now they are all here again