{"id":25039262,"url":"https://github.com/notashelf/mrc","last_synced_at":"2025-06-14T22:04:46.620Z","repository":{"id":275867411,"uuid":"903857959","full_name":"NotAShelf/mrc","owner":"NotAShelf","description":"IPC wrapper \u0026 command-line controller for MPV, the video player","archived":false,"fork":false,"pushed_at":"2025-04-10T14:40:54.000Z","size":19367,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-01T05:58:32.148Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://notashelf.github.io/mrc/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NotAShelf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-15T18:26:38.000Z","updated_at":"2025-02-05T01:04:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"aeb7a715-f6af-4dcb-b1e8-157ad93bd296","html_url":"https://github.com/NotAShelf/mrc","commit_stats":null,"previous_names":["notashelf/mrc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotAShelf%2Fmrc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotAShelf%2Fmrc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotAShelf%2Fmrc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotAShelf%2Fmrc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NotAShelf","download_url":"https://codeload.github.com/NotAShelf/mrc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252516041,"owners_count":21760710,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-06T02:20:33.911Z","updated_at":"2025-06-14T22:04:46.608Z","avatar_url":"https://github.com/NotAShelf.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MRC - MPV Remote Control\n\n[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)\n\n[mpv video player]: https://mpv.io/\n\n**MRC** is a fast, robust JSON IPC wrapper for the [mpv video player]. It\nprovides:\n\n- Type-safe MPV IPC communication\n- Command-line interface with interactive mode\n- Secure remote control over HTTPS\n- Async Support with Tokio for high performance\n\n## Features\n\n- **Complete MPV Control**: Play, pause, seek, playlist management, and property\n  access\n- **Interactive CLI**: Real-time command interface with help system\n- **Secure Remote Access**: TLS-encrypted server with token authentication\n- **Flexible Configuration**: Custom socket paths and environment-based setup\n\n## Quick Start\n\n### Prerequisites\n\n1. **Install MPV** with IPC support enabled\n2. **Install Rust** (edition 2024+)\n\n### Installation\n\n```bash\n# Clone the repository\ngit clone https://github.com/notashelf/mrc.git\ncd mrc\n\n# Build the project\ncargo build --release\n\n# Or install directly\ncargo install --path .\n```\n\n### Basic Usage\n\n1. **Start MPV with IPC socket**:\n\n   ```bash\n   mpv --idle --input-ipc-server=/tmp/mpvsocket\n   ```\n\n2. **Use the CLI**:\n\n   ```bash\n   # Basic playback control\n   cargo run --bin cli play\n   cargo run --bin cli pause\n   cargo run --bin cli next\n\n   # Load files\n   cargo run --bin cli add ~/Music/song.mp3 ~/Videos/movie.mkv\n\n   # Interactive mode\n   cargo run --bin cli interactive\n   ```\n\n## Usage Guide\n\n### CLI Commands\n\n| Command                | Description                |            Example            |\n| :--------------------- | -------------------------- | :---------------------------: |\n| `play [index]`         | Start/resume playback      |  `mrc play` or `mrc play 2`   |\n| `pause`                | Pause playback             |          `mrc pause`          |\n| `stop`                 | Stop and quit MPV          |          `mrc stop`           |\n| `next`                 | Skip to next playlist item |          `mrc next`           |\n| `prev`                 | Skip to previous item      |          `mrc prev`           |\n| `seek \u003cseconds\u003e`       | Seek to position           |        `mrc seek 120`         |\n| `add \u003cfiles...\u003e`       | Add files to playlist      | `mrc add song1.mp3 song2.mp3` |\n| `remove [index]`       | Remove playlist item       |        `mrc remove 0`         |\n| `move \u003cfrom\u003e \u003cto\u003e`     | Move playlist item         |        `mrc move 0 3`         |\n| `clear`                | Clear playlist             |          `mrc clear`          |\n| `list`                 | Show playlist              |          `mrc list`           |\n| `prop \u003cproperties...\u003e` | Get properties             |  `mrc prop volume duration`   |\n| `interactive`          | Enter interactive mode     |       `mrc interactive`       |\n\n### Interactive Mode\n\nEnter interactive mode for real-time control:\n\n```bash\n$ cargo run --bin cli interactive\nEntering interactive mode. Type 'exit' to quit.\nmpv\u003e play\nmpv\u003e seek 60\nmpv\u003e set volume 80\nmpv\u003e get filename\nmpv\u003e help\nmpv\u003e exit\n```\n\n### Library Usage\n\nBasic example:\n\n```rust\nuse mrc::{playlist_next, set_property, get_property};\nuse serde_json::json;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    // Set volume to 50%\n    set_property(\"volume\", \u0026json!(50), None).await?;\n\n    // Get current filename\n    if let Some(filename) = get_property(\"filename\", None).await? {\n        println!(\"Playing: {}\", filename);\n    }\n\n    // Skip to next track\n    playlist_next(None).await?;\n\n    Ok(())\n}\n```\n\n### Server Mode\n\nFor remote control over HTTPS:\n\n1. **Generate TLS certificates**:\n\n   ```bash\n   # Create self-signed certificate\n   openssl req -x509 -newkey rsa:4096 -keyout private_key.pem -out certificate.pem -days 365 -nodes\n\n   # Convert to PKCS#12 format\n   openssl pkcs12 -export -out identity.pfx -inkey private_key.pem -in certificate.pem\n   ```\n\n2. **Set environment variables**:\n\n   ```bash\n   export TLS_PFX_PATH=\"./identity.pfx\"\n   export TLS_PASSWORD=\"your_pfx_password\"\n   export AUTH_TOKEN=\"your_secure_token\"\n   ```\n\n3. **Start the server**:\n\n   ```bash\n   cargo run --bin server\n   # Server starts on https://127.0.0.1:8080\n   ```\n\n4. **Make requests**:\n\n   ```bash\n   # Using curl\n   curl -k -H \"Authorization: Bearer your_secure_token\" \\\n        -d \"pause\" https://127.0.0.1:8080/\n\n   # Using any HTTP client\n   POST https://127.0.0.1:8080/\n   Authorization: Bearer your_secure_token\n   Content-Type: text/plain\n\n   play\n   ```\n\n## Configuration\n\n### Environment Variables\n\n| Variable       | Description                      | Default | Required    |\n| -------------- | -------------------------------- | ------- | ----------- |\n| `TLS_PFX_PATH` | Path to PKCS#12 certificate file | -       | Server only |\n| `TLS_PASSWORD` | Password for PKCS#12 file        | -       | Server only |\n| `AUTH_TOKEN`   | Authentication token for server  | -       | Server only |\n\n### Socket Path\n\nBy default, MRC uses `/tmp/mpvsocket`. You can customize this:\n\n```rust\n// In your code\nuse mrc::set_property;\n\nset_property(\"volume\", \u0026json!(50), Some(\"/your/socket/path\")).await?;\n```\n\n## Development\n\n### Building\n\n```bash\n# Development build\ncargo build\n\n# Release build\ncargo build --release\n\n# Run tests\ncargo test\n\n# Check linting\ncargo clippy\n```\n\n### Testing MPV IPC\n\nTest IPC communication manually:\n\n```bash\n# Send raw command to MPV socket\necho '{ \"command\": [\"get_property\", \"volume\"] }' | socat - /tmp/mpvsocket\n\n# Expected response\n{\"data\":50,\"error\":\"success\",\"request_id\":0}\n```\n\n## Troubleshooting\n\n### Common Issues\n\n**Socket not found error**:\n\n- Ensure MPV is running: `mpv --idle --input-ipc-server=/tmp/mpvsocket`\n- Check socket exists: `ls -la /tmp/mpvsocket`\n\n**Server certificate errors**:\n\n- Verify certificate files exist and are readable\n- Check environment variables are set correctly\n- Test certificate: `openssl pkcs12 -info -in identity.pfx`\n\n**Permission denied**:\n\n- Check socket permissions: `ls -la /tmp/mpvsocket`\n- Run MPV with appropriate user permissions\n\n### Debug Mode\n\nEnable debug logging:\n\n```bash\nRUST_LOG=debug cargo run --bin cli interactive\n```\n\n## License\n\nThis project is licensed under the Mozilla Public License 2.0 - see the\n[LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- [MPV Media Player](https://mpv.io/) for the excellent IPC interface\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotashelf%2Fmrc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotashelf%2Fmrc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotashelf%2Fmrc/lists"}