FooSoft / yomichan

Japanese pop-up dictionary extension for Chrome and Firefox.
https://foosoft.net/projects/yomichan
Other
1.06k stars 213 forks source link

[Feature Request] Wildcard with custom audio URL #898

Closed SpongebobSquamirez closed 3 years ago

SpongebobSquamirez commented 3 years ago

It seems like oftentimes a custom URL source will include the expression and/or reading of a word in its path, but will also include a random string or identifier of some sort. To be able to use these sources, having a wildcard like an asterisk, or being able to specify a regex would be convenient. Does yomichan already something like this?

toasted-nutbread commented 3 years ago

Can you give an example of what you mean by this? Are you trying to do something like, for example, {random:a-zA-Z0-9,32} in the URL format to generate a random string?

SpongebobSquamirez commented 3 years ago

I just mean being able to match a regex or wildcard. So if the URL has something in it you can't predict, but it has something you can predict, then as long as you give it something it can use a regex to match, it'll find the (first) URL/file you're looking for. E.g., I have a bunch of local files formatted like this: 合成酒.yomi0005497C_0050.wav, where I really only care about searching for the word and would otherwise (were the other information not useful) be happy throwing away the remaining data. Forvo support would be awesome, but since that seems like a lot of trouble unless someone shares the URL scheme for it, I'd be happy using the URL for my local files.

toasted-nutbread commented 3 years ago

Unfortunately, regex cannot be used to look up the URL for a file. There would need to be some sort of index that lists all the files available at minimum, but that's beyond the scope of what Yomichan is currently designed to do. It sounds like what you're asking for would require a middleware server that handles the requests to local files, in which case the middleware server would be handling that lookup and pattern matching.

toasted-nutbread commented 3 years ago

Closing as the requested feature is not able to be supported, at least not without some sort of additional functionality external to Yomichan. #544 is related and could potentially provide a solution in the long term, but again still requires some setup outside the scope of Yomichan.