themoeway / local-audio-yomichan

Anki add-on to run a local audio server for Yomichan.
MIT License
73 stars 10 forks source link

Minor modification for creating cards with Memento (an excellent video player based on MPV) #28

Open wandero opened 3 months ago

wandero commented 3 months ago

When using Local Audio Server in conjunction with Memento (an excellent video player based on MPV) for card creation, the service was ineffective due to the lack of the Content-length parameter.

Following guidance from @ripose-jp, I modified the server.py code to resolve the issue and hope this modification can be incorporated into the plugin to benefit more users:

Added import os

after self.send_header("Content-type", mime_type) Appended the line

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

The plugin is very useful, thanks a lot