129 lines
2.8 KiB
Markdown
129 lines
2.8 KiB
Markdown
Sure, here is a "leet" README for your project `SpaceInvaderz`:
|
|
|
|
# 🌌 SpaceInvaderz API 🌌
|
|
|
|
Welcome to the **SpaceInvaderz** API! Control your video playback like a true interstellar commander using this FastAPI-powered interface.
|
|
|
|
## 🚀 Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- **Python** installed
|
|
- Required Python packages: `yt-dlp`, `python-vlc`, `fastapi`, `uvicorn`
|
|
|
|
### Installation
|
|
|
|
1. **Clone the repository:**
|
|
```sh
|
|
git clone gitea.telavivmakers.space/SpaceInvaderz/spaceinvaderz.git
|
|
cd spaceinvaderz
|
|
```
|
|
|
|
2. **Install dependencies:**
|
|
```sh
|
|
pip install yt-dlp python-vlc fastapi uvicorn
|
|
# or
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
3. **Run the server:**
|
|
```sh
|
|
python main.py
|
|
```
|
|
|
|
Your SpaceInvaderz API should now be running on `http://0.0.0.0:1337`.
|
|
|
|
## 🌌 API Endpoints
|
|
|
|
### 1. Add Video to Queue
|
|
|
|
**Description:** Adds a video to the playback queue.
|
|
|
|
- **URL:** `/add`
|
|
- **Method:** `POST`
|
|
- **Body:**
|
|
```json
|
|
{
|
|
"url": "VIDEO_URL"
|
|
}
|
|
```
|
|
|
|
#### PowerShell:
|
|
```powershell
|
|
$videoUrl = "https://www.youtube.com/watch?v=u-Wi1_O3pKQ"
|
|
Invoke-RestMethod -Uri http://localhost:1337/add -Method Post -Body (@{url = $videoUrl} | ConvertTo-Json) -ContentType "application/json"
|
|
```
|
|
|
|
#### cURL:
|
|
```sh
|
|
curl -X POST "http://localhost:1337/add" -H "Content-Type: application/json" -d "{\"url\":\"YOUR_VIDEO_URL\"}"
|
|
```
|
|
|
|
### 2. Get Current Queue
|
|
|
|
**Description:** Retrieves the current queue of videos.
|
|
|
|
- **URL:** `/queue`
|
|
- **Method:** `GET`
|
|
|
|
#### PowerShell:
|
|
```powershell
|
|
Invoke-RestMethod -Uri http://localhost:1337/queue -Method Get
|
|
```
|
|
|
|
#### cURL:
|
|
```sh
|
|
curl -X GET "http://localhost:1337/queue"
|
|
```
|
|
|
|
### 3. Control Playback
|
|
|
|
**Description:** Control video playback with actions like play, pause, stop, and mute.
|
|
|
|
- **URL:** `/control/{action}`
|
|
- **Method:** `POST`
|
|
- **Actions:** `play`, `pause`, `stop`, `mute`
|
|
|
|
#### PowerShell:
|
|
```powershell
|
|
$action = "play" # Or "pause", "stop", "mute"
|
|
Invoke-RestMethod -Uri http://localhost:1337/control/$action -Method Post
|
|
```
|
|
|
|
#### cURL:
|
|
```sh
|
|
action="play" # Or "pause", "stop", "mute"
|
|
curl -X POST "http://localhost:1337/control/$action"
|
|
```
|
|
|
|
### 4. Seek Video
|
|
|
|
**Description:** Seek to a specific time in the video.
|
|
|
|
- **URL:** `/seek/{seconds}`
|
|
- **Method:** `POST`
|
|
- **Parameters:** `seconds` (Time in seconds to seek to)
|
|
|
|
#### PowerShell:
|
|
```powershell
|
|
$seconds = 120 # Time in seconds
|
|
Invoke-RestMethod -Uri http://localhost:1337/seek/$seconds -Method Post
|
|
```
|
|
|
|
#### cURL:
|
|
```sh
|
|
seconds=120 # Time in seconds
|
|
curl -X POST "http://localhost:1337/seek/$seconds"
|
|
```
|
|
|
|
## 🌌 Contribute
|
|
|
|
Feel free to submit issues, fork the repo and create pull requests. May the code be with you! 🚀
|
|
|
|
---
|
|
|
|
With **SpaceInvaderz**, you're not just watching videos, you're commanding an intergalactic fleet of multimedia! 🌠
|
|
|
|
---
|
|
|
|
Happy coding, space invaders! 👾 |