FooSoft / yomichan

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

Ideal setup for websites when using yomichan's Custom Audio Source URL #2185

Closed OliverSpeak closed 2 years ago

OliverSpeak commented 2 years ago

Hi. I'm new here and learning a bunch. I want to hold a website that hosts audio files for yomichan to pull from. What would be the most ideal setup for that?

toasted-nutbread commented 2 years ago

Depends on what you mean by "ideal" and what you're trying to do, but Yomichan has two different ways of supporting audio servers. For example purposes, I'll assume the base URL is http://localhost/, but it could be anything you choose to set up.

  1. Using a simple URL to request audio. This generally looks something like http://localhost/audio.mp3?term={term}&reading={reading}, and the server would find the proper audio file using the term and reading query parameters, or throw an error if it doesn't exist.
  2. Using a JSON URL to request one or more audio files. This generally looks something like http://localhost/audio.json?term={term}&reading={reading}, and it would return a JSON object according to this schema: custom-audio-list-schema.json. This supports returning multiple audio sources for a term.

    • This feature was added in #1303.
    • 1386 shows some info about it being used.

If you're trying to set this up as a local service, you can create localhost servers using python, node.js, and a variety of other tools.

OliverSpeak commented 2 years ago

Thank you. This gives me a good place to start. Hopefully in the not-so-distant future I'll be able to share what I come up with.

OliverSpeak commented 2 years ago

I've made a small library in which people can easily connect yomichan to: https://github.com/OliverSpeak/opl