Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local Audio Server #137

Closed
penguinbrew opened this issue Dec 4, 2022 · 7 comments
Closed

Local Audio Server #137

penguinbrew opened this issue Dec 4, 2022 · 7 comments
Labels
question Further information is requested

Comments

@penguinbrew
Copy link

Would it be possible to playback sound from a local audio server like this one for yomichan:
https://github.com/Aquafina-water-bottle/jmdict-english-yomichan/tree/master/local_audio
And if so, how?

@ripose-jp ripose-jp added the question Further information is requested label Dec 4, 2022
@ripose-jp
Copy link
Owner

It should work. Just follow the instructions as normal, except use this URL instead of the one provided under OptionsAudio Sources. Make sure you choose JSON and not File for the type.

http://localhost:5050/?sources=jpod,jpod_alternate,nhk16&term={expression}&reading={reading}

@penguinbrew
Copy link
Author

penguinbrew commented Dec 4, 2022

Thank you :)
It seems to work when creating cards anki, but i can't get the sound to play in memento when clicking the sound icon in the dictionary. Any idea why that could be?

@ripose-jp
Copy link
Owner

I need more information. Does the no audio icon get shown when you click it?

@penguinbrew
Copy link
Author

I just click the sound icon, and then it goes gray for a moment, and then turns back to the original look, but i can't click it again.

@ripose-jp
Copy link
Owner

I've verified the behavior you were referring to and have determined it's because the plugin you're using doesn't send the content-length HTTP header with audio files. You'll have to ask the creator of the plugin to fix it.

All he has to do is add this line

self.send_header('Content-length', str(len(os.stat(audio_file).st_size)))

To the get_jpod_audio, get_jpod_alternative_audio, and get_nhk16_audio methods.

@ripose-jp
Copy link
Owner

I'm closing this since I've found the cause of the issue and there's been no activity in a week.

@wandero
Copy link

wandero commented Apr 16, 2024

I encountered the same issue and resolved it by modifying /Local Audio Server/server.py.
The main changes were adding import os and appending the following line after self.send_header("Content-type", mime_type):
self.send_header('Content-length', str(os.stat(audio_file).st_size)) # no len()

The plugin works great, thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants