Skip to content

Conversation

pigoz
Copy link

@pigoz pigoz commented Feb 23, 2020

Hello. I've been working on https://github.com/pigoz/lat using this gem as a base to write a Ruby mpv script. I'm in the process of upstreaming the features I've added (key bindings, observers), automated tests, and simplifications to the event loop. I'm still figuring out an API to deal with generic events and one to wait for a certain event. The idea is to allow people to write mpv scripts in ruby instead of Lua / JavaScript.

The exciting part is mpv recently added a way to run any kind of executable script, so you can do stuff like mpv --script=/path/to/ruby-script (See: mpv-player/mpv@e2ab6b7)

It's not ready to merge yet. But I wanted to start collecting some feedback. If the breaking changes are too many, please say so :)

pigoz added 11 commits February 23, 2020 20:37
this allows to run commands like bundle install if theres a syntax error
in the codebase
100ms is way too high of a timeframe
mpv recently added new infrastructure to handle generic executable
scripts. Instead of unix sockets it uses file descriptor inheritance.

See: mpv-player/mpv@e2ab6b7
this stuff seems pointless if not worse. alive makes the methods fail
silently.
This makes the code way easier to follow.
This allows the main thread to block until mpv has quit, allowing the
event loop to continue pumping.
@pigoz pigoz force-pushed the master branch 2 times, most recently from 4fbfdc1 to 2a7cbbe Compare February 26, 2020 21:40
@woodruffw
Copy link
Owner

Thanks for hacking at this! Let me know when it's ready for review.

pigoz added 2 commits March 1, 2020 17:04
previous code would run client-message/property-change on the event loop
thread, generating a deadlock if the observer callback invoked another
command.
I use the provided request_id mechanism provided by mpv's ipc interface.
Sadly it's a bit more code than I'd like to, but it doesn't seem like it
can be implemented in a shorter/simpler fashion.
pigoz added 6 commits March 1, 2020 22:06
I'm sure concurrent-ruby's authors are better at coding than me.

I hate to add a dependency to an otherwise minimalistic gem, but it
kinda felt wrong to NIH this kind of stuff, and anyway it's kind of Ruby's
fault for not providing these utilities in the stdlib.
@pigoz
Copy link
Author

pigoz commented Mar 1, 2020

I should have backported everything from my original gem (while making it much nicer/robust). Next Sunday I will port my "user gem" to use this version of the library in order to dogfood it a little bit.

Still unsure about the Ass:: APIs. I'll think about something better because it's a bit 💩 right now.

pigoz added 3 commits March 3, 2020 21:54
It can also be used in non test code as a synchronization mechanism, so
this name makes a little more sense.
@pigoz pigoz force-pushed the master branch 2 times, most recently from cc666d0 to 5f1b898 Compare March 4, 2020 21:34
pigoz added 5 commits April 28, 2020 15:54
Since this is such a common operation that it is worth to make it more
convenient by trading some safety.

This was the original behavior before introducing the new event loop,
so it only makes sense to add this programming style back.
@woodruffw
Copy link
Owner

I just realized that this has been sitting idle for a bit. Is there anything else it needs before I do some review @pigoz?

@pigoz
Copy link
Author

pigoz commented Sep 24, 2020

Yes, sorry. My fault. I was not happy at all with the API for drawing to the OSD but my short attention span prevented me from coming up with something. I might actually remove from this PR so it can move forward.

@woodruffw
Copy link
Owner

woodruffw commented Sep 24, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants