Audio Files addon support

Please provide as much detail as possible when reporting an issue as that will help me to be able to resolve it.

Hi, could you add the link to the shared add-on here ?

Addon page is at Audio Files - AnkiWeb

1 Like

Hello!

First of all, thank you for your add-on!

I take the time today to write you down as Iā€™m currently learning French, English and German, I would love to have some kind of drop-down to choose from to select the right ā€œlocaleā€ before the query is made. Iā€™ll be willing to contribute. Is your add-on on GitHub?

And one last thing, I donā€™t know if itā€™s a bug but when I search for with some text selected, the text is replaced by the ā€œ[sound:example.mp3]ā€. Is it the expected behavior?

Thank you

Thank you, Iā€™d be glad for you to contribute ā€“ the repo is at https://github.com/r-appleton/addons

The behaviour that you indicate looks like a bug ā€“ ā€œ[sound:example.mp3]ā€ should be appended to the end of the text, not overwrite selected text. Could you look at fixing that when making your changes?

And thank you for your appreciation of the addin!

regards,

Richard Appleton

The behavior that I described maybe OS-related. Iā€™m using MacOS for info.

For the rest, right now I have your repo cloned and I tweaked a bit here and there. Much left to do!

i was wondering if there was a way to display the files if there are more than one?
in forvo for example some times there are more than one files with varying qualities, it would be amazing if we could select the best one.
the add on is really helpfull, i was just wondering about this one thing.
have a nice day

Thank you for your suggestion. I would not want to spoil the simplicity of using this addin, but will look into how your idea can be doneā€¦

Unfortunately I wonā€™t be able to do that for a couple of months.

To begin, thanks for this addon, it saves me a lot of time.
I have a (simple) feature request : could the addon clean the word for the accent marks before looking for the audio files?

Usually, I paste the Russian word from wiktionary and the accent mark which is useful for learning prevent the addon to find the audio file.
I am not completely ignorant of python so if you explain me where to look to, I may me able to do it.
TIA

It should be simple to implement this request if youā€™d like to try to do it yourself.

Iā€™d added some rules that change the text used for the lookup - these are in rules.py, so to do this you just need to add a new entry to the RULES map. The string key is the text that appears in the configuration dialog.

Thanks,
Will try to have a look next week-end
Best Regards.

OK, it seems to work.
RULES = {
ā€˜unchangedā€™:{ā€˜descriptionā€™:ā€˜leave unchangedā€™, ā€˜functionā€™:lambda w: w},
ā€˜lower caseā€™:{ā€˜descriptionā€™:ā€˜convert to lower caseā€™, ā€˜functionā€™:lambda w: w.lower()},
ā€˜capitalizeā€™:{ā€˜descriptionā€™:ā€˜capitalize first wordā€™, ā€˜functionā€™:lambda w: w.capitalize()},
ā€˜replace \u0451 with \u0435ā€™:{ā€˜descriptionā€™:ā€™(Russian) replace \u0451 with \u0435ā€™, ā€˜functionā€™:lambda w: w.replace(ā€™\u0451ā€™, ā€˜\u0435ā€™)},
ā€˜suppress \u0301ā€™:{ā€˜descriptionā€™:ā€™(Russian) suppress \u0301ā€™, ā€˜functionā€™:lambda w:w.replace(ā€™\u0301ā€™, ā€˜ā€™)}

}

Could you add this modification in your code ?

Best regards,

Ping. :wink:

I have a couple of colleagues that may be interested by Anki with your addon but it would be difficult for me to explain them that they have to edit by hand rules.py to have it working properly.
It was very nice from you to explain me how to get the feature I wanted, I just hope that anybody could use it just the same;
Best regards,

Alain

Hi. Thanks for reading this!

Iā€™m wondering if your add-on could be used to link sound files in cards to their associated audio file in the collection.media folder and perform some action on them. Iā€™m learning Mandarin and have a huge deck, over 8,000 sentences (called Spoonfed) and would like to find and extract the audio files of the cards Iā€™ve studied so far, some 3,000 or so.

Unfortunately, the media files would have to be found manually, one by one, by doing individual searches for the ā€˜code nameā€™ in the sound file field on each card (e.g. sound:tmp4ghvjq.mp3 or sound:334818.mp3). If I try to do this manually, I will most likely be in a retirement home before I finish or even pushing up daisies. :weary:

So Iā€™m hoping there might be a way to have your add-on do the following:

  1. find ALL the sound file fields of the SELECTED cards (in my case, the first 3,000 cards)
  2. locate the associated audio files in the collection.media folder
  3. copy those to a designated folder (e.g. on my desktop) without deleting the originals in the folder
  4. add a numerical value at the start of each ā€˜newā€™ copied audio file so that they remain in the same order (this desk is progressive and needs to be studied in the order provided by its author)

Okay, that sounds a lot, right? Sorry about that. Like others here, Iā€™d be happy to make a contribution. My aim is to build larger audio file tracks from these individual files, with lots of repeition, to listen to as I go about my day or walk on the nearby hills. In my efforts to find a solution to this Iā€™ve come across numerous others online who seem to have the same problem i.e. finding the associated audio files in the collection.media folder.

Finally, may I make a suggestion as to the name of your add-on? It seems such a valuable tool and I know that Iā€™ve passed over it several times before without checking it out. I wonder if calling it something like ā€˜Find Audio Filesā€™ (or something similar) might not more effectively get the attention of those scanning down the list of add-ons?

Whether or not you can help me, many thanks for at least reading this longish post.

All the best!

Randal.

Apologies for the delay in updating the addon with your rule change - unfortunately personal circumstances got in the way.

Iā€™ve now added that, so your colleagues should be able to use it without needing to edit the code themselves.

I think that your requirement does not really fit what this addon is about - I wrote this to lookup sound files from external data sources in order to save myself time.

Iā€™d suggest that you try writing your own addon for your specific purpose - look at the code for this and other addons to help you if you need. You can find the sound file names in a card using a regexp (it will contain ā€˜[sound:ā€¦]ā€™), and the collection.media folder location is available from Anki - so I donā€™t think that it should be too complicated to write what you need.

No need for apologies. It is me that is grateful for your work and your answers to my feature request.
All the best
A.

Many thanks for getting back to me. I wasnā€™t sure if it would align with your add-on. No worries! And all the best! Cheers.

Hello,
There are some pages where Wiktionary has a sound file and Audiofiles canā€™t get it. For example : ŠæŠµŃ€ŠµŠ²ŠµŃ€Š½ŃƒŃ‚ŃŒŃŃ - Wiktionary
How could I debug this problem?
Best regards,

It have always had this issue, or maybe the target website has changed a little.

To fox it you need to inspect the web page to see what URL the site uses to play the sound, then check that the same URL is generated by the Python code in the addon.

Unfortunately Iā€™m personally very tied up at the moment, so wonā€™t be able to look at it myself for some months. If you are able to fix it that would much appreciated.