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.