.gitignore | ||
main.py | ||
readme.md | ||
requirements.txt |
🌌 SpaceInvaderz API 🌌
Welcome to the SpaceInvaderz API! Control your video playback like a true interstellar commander using this FastAPI-powered interface.
this is a fork of the original project as experianced in metalab lounge
🚀 Getting Started
Prerequisites
- Python installed
- Required Python packages:
yt-dlp
,python-vlc
,fastapi
,uvicorn
Installation
-
Clone the repository:
git clone gitea.telavivmakers.space/SpaceInvaderz/spaceinvaderz.git cd spaceinvaderz
-
Install dependencies:
pip install yt-dlp python-vlc fastapi uvicorn # or pip install -r requirements.txt
-
Run the server:
python main.py
Your SpaceInvaderz API should now be running on http://0.0.0.0:1337
.
🌌 API Endpoints
1. Add Video to playlist
Description: Adds a video to the playback playlist.
- URL:
/add
- Method:
POST
- Body:
{ "url": "VIDEO_URL" }
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:
curl -X POST "http://localhost:1337/add" -H "Content-Type: application/json" -d "{\"url\":\"YOUR_VIDEO_URL\"}"
2. Get Current playlist
Description: Retrieves the current playlist of videos.
- URL:
/playlist
- Method:
GET
PowerShell:
Invoke-RestMethod -Uri http://localhost:1337/playlist -Method Get
cURL:
curl -X GET "http://localhost:1337/playlist"
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:
$action = "play" # Or "pause", "stop", "mute"
Invoke-RestMethod -Uri http://localhost:1337/control/$action -Method Post
cURL:
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:
$seconds = 120 # Time in seconds
Invoke-RestMethod -Uri http://localhost:1337/seek/$seconds -Method Post
cURL:
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! 👾