Spaces:
Paused
A newer version of the Gradio SDK is available:
5.27.1
title: Instance 2
emoji: π
colorFrom: yellow
colorTo: red
sdk: gradio
sdk_version: 4.36.1
app_file: app.py
pinned: false
Scripts
app.py -> main script that run flask server
indexer.py -> script to index the repo structure
Film and TV API
This API provides endpoints for accessing and managing film and TV show data, including downloading, caching, and retrieving metadata.
Table of Contents
Base URL
All endpoints are accessed through the base URL:
http://<server-address>:7860
Replace <server-address>
with your server's address.
Endpoints
Film Endpoints
GET /api/film
Description: Starts the download of a film if it's not already cached.
Query Parameters:
title
(string): The title of the film.
Responses:
200 OK
: Download started successfully.{ "status": "Download started", "film_id": "film_id_here" }
400 Bad Request
: Title parameter is required.{ "error": "Title parameter is required" }
404 Not Found
: Movie not found.
GET /api/film/store
Description: Retrieves the JSON data for the film store.
Responses:
200 OK
: Returns the film store JSON data.{ "film_title": "cache_path_here" }
404 Not Found
: Film store JSON not found.
TV Show Endpoints
GET /api/tv
Description: Starts the download of a TV show episode if it's not already cached.
Query Parameters:
title
(string): The title of the TV show.season
(string): The season number.episode
(string): The episode number.
Responses:
200 OK
: Download started successfully.{ "status": "Download started", "episode_id": "episode_id_here" }
400 Bad Request
: Title, season, and episode parameters are required.{ "error": "Title, season, and episode parameters are required" }
404 Not Found
: TV show or episode not found.
GET /api/tv/store
Description: Retrieves the JSON data for the TV store.
Responses:
200 OK
: Returns the TV store JSON data.{ "show_title": { "season": { "episode": "cache_path_here" } } }
404 Not Found
: TV store JSON not found.
Cache Endpoints
GET /api/cache/size
Description: Retrieves the total size of the cache.
Responses:
200 OK
: Returns the cache size in a human-readable format.{ "cache_size": "10.5 MB" }
POST /api/cache/clear
Description: Clears the entire cache.
Responses:
200 OK
: Cache cleared successfully.{ "status": "Cache cleared" }
Metadata Endpoints
GET /api/filmid
Description: Retrieves the film ID by title.
Query Parameters:
title
(string): The title of the film.
Responses:
200 OK
: Returns the film ID.{ "film_id": "film_id_here" }
400 Bad Request
: Title parameter is required.{ "error": "Title parameter is required" }
GET /api/episodeid
Description: Retrieves the episode ID by title, season, and episode.
Query Parameters:
title
(string): The title of the TV show.season
(string): The season number.episode
(string): The episode number.
Responses:
200 OK
: Returns the episode ID.{ "episode_id": "episode_id_here" }
400 Bad Request
: Title, season, and episode parameters are required.{ "error": "Title, season, and episode parameters are required" }
Miscellaneous Endpoints
GET /api/film/all
Description: Retrieves a list of all films.
Responses:
200 OK
: Returns a list of film paths.[ "film_path_1", "film_path_2" ]
GET /api/tv/all
Description: Retrieves a list of all TV shows.
Responses:
200 OK
: Returns a list of TV shows with their episodes.{ "show_title": [ { "season": "season_number", "episode": "episode_title" } ] }
Error Handling
All endpoints return standard HTTP status codes:
200 OK
for successful requests.400 Bad Request
for invalid requests.404 Not Found
for missing resources.
Errors are returned in the following format:
{
"error": "Error message here"
}
Running the Server
To run the server, ensure you have all required dependencies installed and use the following command:
python app.py
The server will start on http://0.0.0.0:7860
by default.