SpaceInvaderz/readme.md

129 lines
2.9 KiB
Markdown
Raw Normal View History

2024-06-01 21:24:06 +03:00
# 🌌 SpaceInvaderz API 🌌
Welcome to the **SpaceInvaderz** API! Control your video playback like a true interstellar commander using this FastAPI-powered interface.
2024-06-02 01:18:04 +03:00
this is a fork of the [original project](https://github.com/screeninvader/ScreenInvader_old) as experianced in [metalab lounge](https://metalab.at/wiki/Lounge)
2024-06-01 21:24:06 +03:00
## 🚀 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
2024-06-02 01:14:24 +03:00
### 1. Add Video to playlist
2024-06-01 21:24:06 +03:00
2024-06-02 01:14:24 +03:00
**Description:** Adds a video to the playback playlist.
2024-06-01 21:24:06 +03:00
- **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\"}"
```
2024-06-02 01:14:24 +03:00
### 2. Get Current playlist
2024-06-01 21:24:06 +03:00
2024-06-02 01:14:24 +03:00
**Description:** Retrieves the current playlist of videos.
2024-06-01 21:24:06 +03:00
2024-06-02 01:14:24 +03:00
- **URL:** `/playlist`
2024-06-01 21:24:06 +03:00
- **Method:** `GET`
#### PowerShell:
```powershell
2024-06-02 01:14:24 +03:00
Invoke-RestMethod -Uri http://localhost:1337/playlist -Method Get
2024-06-01 21:24:06 +03:00
```
#### cURL:
```sh
2024-06-02 01:14:24 +03:00
curl -X GET "http://localhost:1337/playlist"
2024-06-01 21:24:06 +03:00
```
### 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! 👾