29 Commits

Author SHA1 Message Date
aacde5df12
Create event stream 2024-04-30 02:07:04 +02:00
deb45a4570
Make entire project async
This moves all communication with Mpv's unix socket into another tokio
task, and uses message passing through clonable mpsc channels to receive
commands to execute, and to send responses.
2024-04-19 00:59:22 +02:00
f5c9674b78
Misc: refactor + serde serialization derives
- Split content into more files
- Refactor TypeHandler impls
- Add serialization traits to public structs/enums
2024-04-16 23:11:19 +02:00
6d2575b940
Add Clone and Copy to several public structs 2024-04-16 20:54:17 +02:00
Jonas Frei
9e3ec12894 Generate JSON string with serde_json
Closes #3
2023-08-02 11:15:37 +02:00
naglis
83abe0bf62 Add support for client-message events
These events are issued [1] when clients communicate to each other using
`script-message` [2] and `script-message-to` [3] commands.

[1]: https://mpv.io/manual/stable/#command-interface-client-message
[2]: https://mpv.io/manual/stable/#command-interface-script-message
[3]: https://mpv.io/manual/stable/#command-interface-script-message-to
2023-07-30 23:14:20 +03:00
jole
9fde540089 do not panic on message without event field
intead discard it and try again
2022-07-19 21:27:02 +02:00
jole
fded248b7e minor cleanup: run_mpv_command() 2022-07-19 21:07:20 +02:00
jole
be2132735b remove comments 2022-07-19 21:06:34 +02:00
jole
cc9f2cae53 fix potential bug
could potentially return MpvError("success")
2022-07-19 21:00:30 +02:00
jole
fde2bce07d clean up get_mpv_property_string() 2022-07-19 20:54:44 +02:00
jole
8b5d3bc0fd clean up listen() 2022-07-19 20:34:11 +02:00
Jonas Frei
442f121b2e Using _isize_ instead of _usize_ for observation as per mpv documentation 2022-07-10 20:59:52 +02:00
Jonas Frei
b21f0c804b Added Observe/Unobserve MpvCommand.
Closes #2
2022-07-10 15:23:58 +02:00
Jonas Frei
cb5ad88544 Added list of supported commands as Enum. Cleaned up comments. Pushed version to 1.1.8 2019-06-24 20:11:58 +02:00
Jonas Frei
5b28c95a0a Included observation ID in PropertyChange event 2019-06-20 06:00:44 +02:00
Emmanuel Gil Peyrot
b0a62f25eb Run rustfmt on the entire crate 2019-06-19 00:51:11 +02:00
Emmanuel Gil Peyrot
2911b9bb49 Simplify user code by parsing properties ourselves 2019-06-19 00:31:17 +02:00
Emmanuel Gil Peyrot
8f105eb41f Add a logging system, using the log crate 2019-06-18 18:34:23 +02:00
Emmanuel Gil Peyrot
c429d88d1b Property id is an isize, not a usize, and can be absent if 0 2019-06-18 18:32:45 +02:00
Emmanuel Gil Peyrot
244a34057f Switch to edition 2018 2019-06-18 17:34:20 +02:00
Emmanuel Gil Peyrot
a43401b6c4 Replaced trim_right() with trim_end(), as the former is deprecated 2019-06-18 17:32:42 +02:00
Jonas Frei
c808c2171c Changed listen functions not to use Sender,Reader but to return a Event-Result. Other minor improvements. 2017-06-17 13:03:27 +02:00
Jonas Frei
1916f60dd6 Added the PropertyChange event. Implemented all variantes of MpvDataType. Documented event_listen 2017-06-06 23:08:27 +02:00
Jonas Frei
ed9f35ba5d Added Mpv type, added Event enum, removed Command trait 2017-06-01 19:30:52 +02:00
Jonas Frei
57d7226373 Replaced string errors with a proper Error struct. Changed run_command arguments to a slice instead of vector. 2017-05-31 19:32:46 +02:00
Jonas Frei
ea0e60097d Keeps the socket open for the entire lifetime of the Mpv struct. Now using channels to inform about new events (listen command). Added Readme 2017-05-29 17:54:12 +02:00
Jonas Frei
e797bd871a Changed listener to work with mpsc 2017-05-24 00:13:23 +02:00
Jonas Frei
7fffe9b1cd Initial commit 2017-05-22 18:31:20 +02:00