This binary will get your ip and start an http server which is used to forward requests to mpv to control the socket
- run binary
- open mpv
- host index.html that it makes
- connect to index hosted and send commands
- Refactor Crate to have:
- Example binaries of how to use the library
- Finish Type State Validation
- Request::Get struct variant
- Request::Post
- Rest of HTTP Options
- Look @ good http parsers in go / other languages and see how they do it(get inspired)
- Use Rust to Host HTTP server( maybe axum )
- Or install renders in the .config/loaf-king directory
- Use a logger in rust
- Use ~/.config/loaf-king for configs( Port, Log Mode, Database, SSL?)
- Database for last watched anime in given directories to resume from
- Make binary play files in linear order while checking the last watched
- Add back button (makes the seek value negative)
- Add skip button to go to end of the video
- DualSense support
Build Socket to Connect To MPV IPC IPC should exposed
- Skip / Forward
- Add to queue of videos
HTML frontend
- To skip / control
- Add videos to queue and control playback
C API that control over playback (libmpv) https://github.com/mpv-player/mpv/blob/master/libmpv/client.h Rust Bindings Option is Available with libmpv-rs
here Not really sure how this differs from libmpv, apparently it uses libmpv Potential use case for Zig here if C Plugin route is taken I can also write rust code to compile to .so file here and be used as a plugin
I believe these use libmpv as the backend so I could just use that instead
Loafer needs an rest server and a frontend/ui to trigger ipc events. Simplest approach is a website hosted on an http server with an API endpoint(currently also http)
The **REST** server needs to parse HTTP data to make sure this is valid The approach I am taking is using a buffer reader to read lines But this made me realize the actual lines need to be parsed, raising concerns
- regex is hacky and shameful
- string functions is morally wrong
So is the only solution lexical analysis? 2 Solutions are Lexical Analysis and State Machines Look @ some http crates to see how they do it
Chatgpt Notes
The current design tries to take advantage of some of these features. It does a terrible job at it, and in the end is a glorified string checker. The code isn’t made to be touched by anyone including myself. Currently the steps to run this program are:
- Get the ip address from `iproute2`
- use this ip to render the html template( sending forms to proper address )
- start http api server
- host the rendered template
- Start mpv with
“`bash
mpv episode.mkv --input-ipc-server=/tmp/loafer.sock
Currently as described there are 2 HTTP Servers needed
- One for Hosting the UI(form to communicate to Control Center(tool that sends messages to mpv))
- One for parsing the ui and sending the data to msg mpv
The code for the 1st parser is currently being hosted by python3 -m http.server -b 0.0.0.0 8080. Combine this python process into the rust main code(either by launching with process::Command or by real http server rust)