https://github.com/kamui-fin/yomi-audio
A custom yomichan audio server with local files
https://github.com/kamui-fin/yomi-audio
audio-server yomichan
Last synced: 5 months ago
JSON representation
A custom yomichan audio server with local files
- Host: GitHub
- URL: https://github.com/kamui-fin/yomi-audio
- Owner: kamui-fin
- License: gpl-3.0
- Created: 2022-10-21T18:25:07.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-22T16:24:38.000Z (over 3 years ago)
- Last Synced: 2025-09-01T04:56:19.962Z (10 months ago)
- Topics: audio-server, yomichan
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Yomichan Audio Server
Although Yomichan does support custom audio URLs, it doesn't solve the problem of using a local directory.
Instead of having to mess with nginx configs, with yomi-audio, you can easily start an audio server and
pass it to Yomichan to pull pronunciation directly from your local filesystem.
## Setup
Python and pip are required to run the server. Clone the repository and install the necessary dependencies:
```
git clone https://github.com/kamui-fin/yomi-audio && cd yomi-audio
pip install -r requirements.txt
```
### Running locally
The script offers a CLI that customizes the behavior of the server and starts it. The main required option is `-d` or `--directories` to specify the location of one or more directories containing the audio files. For example:
```
python app.py -d /home/user/audio_bank
```
### Sorting
By default, the original order in which they were specified is retained without any sorting.
With the `-s` flag, the directories passed in are sorted in ascending order by name. This can be leveraged to prioritize results from directories that contain higher quality audio.
### Pattern matching
The default pattern for matching audio files is `{term}.mp3`.
Obviously, this may not suffice depending on the naming scheme.
As a result, there are two different ways to customize the way the _correct_ file is found.
With both ways, the `term` and `reading` must be surrounded by `{}` as a template literal, where they will be later replaced during matching.
One way is to use `-p` to directly match using a completely static/pre-defined naming pattern. This can be useful if the underlying naming scheme of the directory does not vary. For example, if all the files are named like `pronunciation_喜欢.mp3`, you can simply use the static pattern `pronunciation_{term}.mp3`.
The other way with `-g` utilizes powerful [glob]() functionality. An example would be `???{term}???.mp3` to match `{term}` with 3 leading and trailing characters.
## Connecting to Yomichan
Once you have the server running, open Yomichan settings. Click "Configure audio playback sources" under the Audio section and add the following custom URL:
```
http://localhost:5000/?expression={term}&reading={reading}
```