Closed shiki-tm closed 1 month ago
Another use case:
I'm using this addon for Spanish and there are multiple types of pronunciation from different countries, I want to filter out pronunciations by Spain and prioritize audio from Mexico. I think something that responds to a url query would be great, like http://localhost:8770/?reading=leer&country[]=mx&country[]=col for filtering only mexico and colombia. I think a similar interface in configs would be great too similar to preferred_usernames.
I can implement this if I can get a go-ahead from the maintainer on what the interface would look like
With your update, if there's no users found from the specified country will the server fallback on any pronunciation instead? Thanks for adding this!
@shiki-tm @jamesmaa 's fix should be deployed now. When testing, it did fallback on any pronunciation
Nice. I think there's a typo in the changelog here and on ankiweb. Instead of countries it says usernames. Also I can't get this working it seems. Do I only need to add a country to the anki config window or also the yomitan custom url? Can there be more than one? Also what's the list of country names? Neither "China" or "Taiwan" seems to be prioritized. The forvo user at the top of the list is not in my preferred usernames
@shiki-tm Thanks, fixed the typo. You should just need to set preferred_countries
in the Anki config, there were no changes to the URL. Can you give an example? I just tested with 你好 and tried the following configs:
"preferred_usernames": ["jizhen"],
"preferred_countries": ["Taiwan"],
jizhen's pronunciation from China shows up first, then the rest are from Taiwan, then the rest are unordered.
"preferred_usernames": [],
"preferred_countries": ["Taiwan"],
All Taiwanese pronunciations show up first, then the rest are unordered
"preferred_usernames": ["jizhen"],
"preferred_countries": ["Taiwan","China"],
jizhen's pronunciation from China shows up first, then the rest are from Taiwan, then from China, then the rest are unordered.
Ah it was those square brackets that were missing! Thank you it works so well! Since the preferred usernames doesn't need the square brackets(right?) and it's only this new feature that needs the square brackets I think it could be a good idea to include that format in the description too. I had no idea (I guess I deleted them at the beginning)
Oh wait I just realized something. Maybe you already knew but I'll mention it just in case. For preferred usernames and country priority to both work I had to keep my previous config of not having square brackets around preferred user names list. If I do it like the examples you gave, I lose the username priority. Thanks for everything!
Hmm that's weird. Preferred usernames are supposed to be a list with square brackets as well. Can you show me your config and an example word that demonstrates username priority and country priority?
tbh its only ever worked for me without square brackets since before. i was testing 你好 for this specific issue. i have a lot of preferred usernames but heres some:
"preferred_countries": [ "Taiwan", "China" ], "preferred_usernames": "MarvinMeow,chihchao,uzni,sundayright,darren8221",
oh sorry bad example, try this longer list
"MarvinMeow,chihchao,uzni,sundayright,darren8221,DonDonChiang,JiaLing,openyoureyes,Rei1110,FuLian,xgirl5477,FangDe,milk1127",
Interesting. I'm surprised there are no errors with that format, but I guess since Python lets you index strings, it still kind of works. What happens if you try this config?
"preferred_countries": [
"Taiwan",
"China"
],
"preferred_usernames": [
"MarvinMeow",
"chihchao",
"uzni",
"sundayright",
"darren8221",
"DonDonChiang",
"JiaLing",
"openyoureyes",
"Rei1110",
"FuLian",
"xgirl5477",
"FangDe",
"milk1127"
],
Oh wow I never knew that was the intended way. It works as intended now. Each country name and username need to have quotes around them. Well now I know how its supposed to work. Thanks for your help!
Hoping these amazing features can come to ankiconnect for Android one day...well id like to try doing it myself but I have a lot to learn. I know it's beyond this project but as far as adding preferred usernames and preferred countries features, were they relatively easy to implement into this add on?
@shiki-tm Yeah they're fairly simple, I just wrote a sort function to determine if a preferred user should go before or after a non-preferred user, then sort the list. Closing since your issue is fixed! https://github.com/jamesnicolas/yomichan-forvo-server/commit/c846070f75f1d6c5db8eb564cec478300c4f236e
Now that showing the country is possible in the config, it would be very beneficial for users focusing on a certain accent to sort by the country desired, kind of like there is a preferred usernames option. Just showing, if available, the selected countries users first. Some examples of languages that could take advantage of this are Chinese, Cantonese, English, Spanish, Arabic.
Thank you for all the updates and hard work on this add on🙏