Spaces:
Build error
Build error
Commit
·
02fc71e
1
Parent(s):
e568f14
fix
Browse files
README.md
CHANGED
|
@@ -13,9 +13,7 @@ pinned: false
|
|
| 13 |
## Scripts
|
| 14 |
```
|
| 15 |
app.py -> main script that run flask server
|
| 16 |
-
hf_scrapper.py -> script for interacting with huggingface
|
| 17 |
indexer.py -> script to index the repo structure
|
| 18 |
-
tvdb.py -> script to interact with TheTVDB
|
| 19 |
```
|
| 20 |
## Film and TV API
|
| 21 |
|
|
@@ -29,7 +27,6 @@ This API provides endpoints for accessing and managing film and TV show data, in
|
|
| 29 |
- [Film Endpoints](#film-endpoints)
|
| 30 |
- [TV Show Endpoints](#tv-show-endpoints)
|
| 31 |
- [Cache Endpoints](#cache-endpoints)
|
| 32 |
-
- [Metadata Endpoints](#metadata-endpoints)
|
| 33 |
- [Miscellaneous Endpoints](#miscellaneous-endpoints)
|
| 34 |
- [Error Handling](#error-handling)
|
| 35 |
- [Running the Server](#running-the-server)
|
|
@@ -85,30 +82,6 @@ Replace `<server-address>` with your server's address.
|
|
| 85 |
```
|
| 86 |
- `404 Not Found`: Film store JSON not found.
|
| 87 |
|
| 88 |
-
#### `GET /api/film/metadata`
|
| 89 |
-
|
| 90 |
-
**Description:** Retrieves metadata for a film by title.
|
| 91 |
-
|
| 92 |
-
**Query Parameters:**
|
| 93 |
-
- `title` (string): The title of the film.
|
| 94 |
-
|
| 95 |
-
**Responses:**
|
| 96 |
-
- `200 OK`: Returns the metadata JSON for the film.
|
| 97 |
-
```json
|
| 98 |
-
{
|
| 99 |
-
"title": "Film Title",
|
| 100 |
-
"year": 2024,
|
| 101 |
-
"metadata": { ... }
|
| 102 |
-
}
|
| 103 |
-
```
|
| 104 |
-
- `400 Bad Request`: No title provided.
|
| 105 |
-
```json
|
| 106 |
-
{
|
| 107 |
-
"error": "No title provided"
|
| 108 |
-
}
|
| 109 |
-
```
|
| 110 |
-
- `404 Not Found`: Metadata not found.
|
| 111 |
-
|
| 112 |
### TV Show Endpoints
|
| 113 |
|
| 114 |
#### `GET /api/tv`
|
|
@@ -153,30 +126,6 @@ Replace `<server-address>` with your server's address.
|
|
| 153 |
```
|
| 154 |
- `404 Not Found`: TV store JSON not found.
|
| 155 |
|
| 156 |
-
#### `GET /api/tv/metadata`
|
| 157 |
-
|
| 158 |
-
**Description:** Retrieves metadata for a TV show by title.
|
| 159 |
-
|
| 160 |
-
**Query Parameters:**
|
| 161 |
-
- `title` (string): The title of the TV show.
|
| 162 |
-
|
| 163 |
-
**Responses:**
|
| 164 |
-
- `200 OK`: Returns the metadata JSON for the TV show.
|
| 165 |
-
```json
|
| 166 |
-
{
|
| 167 |
-
"title": "TV Show Title",
|
| 168 |
-
"seasons": [ ... ],
|
| 169 |
-
"metadata": { ... }
|
| 170 |
-
}
|
| 171 |
-
```
|
| 172 |
-
- `400 Bad Request`: No title provided.
|
| 173 |
-
```json
|
| 174 |
-
{
|
| 175 |
-
"error": "No title provided"
|
| 176 |
-
}
|
| 177 |
-
```
|
| 178 |
-
- `404 Not Found`: Metadata not found.
|
| 179 |
-
|
| 180 |
### Cache Endpoints
|
| 181 |
|
| 182 |
#### `GET /api/cache/size`
|
|
|
|
| 13 |
## Scripts
|
| 14 |
```
|
| 15 |
app.py -> main script that run flask server
|
|
|
|
| 16 |
indexer.py -> script to index the repo structure
|
|
|
|
| 17 |
```
|
| 18 |
## Film and TV API
|
| 19 |
|
|
|
|
| 27 |
- [Film Endpoints](#film-endpoints)
|
| 28 |
- [TV Show Endpoints](#tv-show-endpoints)
|
| 29 |
- [Cache Endpoints](#cache-endpoints)
|
|
|
|
| 30 |
- [Miscellaneous Endpoints](#miscellaneous-endpoints)
|
| 31 |
- [Error Handling](#error-handling)
|
| 32 |
- [Running the Server](#running-the-server)
|
|
|
|
| 82 |
```
|
| 83 |
- `404 Not Found`: Film store JSON not found.
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
### TV Show Endpoints
|
| 86 |
|
| 87 |
#### `GET /api/tv`
|
|
|
|
| 126 |
```
|
| 127 |
- `404 Not Found`: TV store JSON not found.
|
| 128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
### Cache Endpoints
|
| 130 |
|
| 131 |
#### `GET /api/cache/size`
|
TODO.md
CHANGED
|
@@ -1,4 +1,2 @@
|
|
| 1 |
## TODO
|
| 2 |
-
* add a method to register the instance to Load Balancer on ```[POST]<load_balancer_url>/api/register``` route
|
| 3 |
-
* add `[GET] /api/get/report` route to return a report consist of film_store.json, tv_store.json, cache_size
|
| 4 |
* add two api routes to delete a certain film or episode
|
|
|
|
| 1 |
## TODO
|
|
|
|
|
|
|
| 2 |
* add two api routes to delete a certain film or episode
|
app.py
CHANGED
|
@@ -115,22 +115,6 @@ def get_progress_api(id):
|
|
| 115 |
progress = instance.get_download_progress(id)
|
| 116 |
return jsonify({"id": id, "progress": progress})
|
| 117 |
|
| 118 |
-
@app.route('/api/filmid/<title>', methods=['GET'])
|
| 119 |
-
def get_film_id_by_title_api(title):
|
| 120 |
-
"""Endpoint to get the film ID by providing the movie title."""
|
| 121 |
-
if not title:
|
| 122 |
-
return jsonify({"error": "Title parameter is required"}), 400
|
| 123 |
-
film_id = instance.get_film_id(title)
|
| 124 |
-
return jsonify({"film_id": film_id})
|
| 125 |
-
|
| 126 |
-
@app.route('/api/episodeid/<title>/<season>/<episode>', methods=['GET'])
|
| 127 |
-
def get_episode_id_api(title,season,episode):
|
| 128 |
-
"""Endpoint to get the episode ID by providing the TV show title, season, and episode."""
|
| 129 |
-
if not title or not season or not episode:
|
| 130 |
-
return jsonify({"error": "Title, season, and episode parameters are required"}), 400
|
| 131 |
-
episode_id = instance.encode_episodeid(title,season,episode)
|
| 132 |
-
return jsonify({"episode_id": episode_id})
|
| 133 |
-
|
| 134 |
@app.route('/api/cache/size', methods=['GET'])
|
| 135 |
def get_cache_size_api():
|
| 136 |
total_size = 0
|
|
@@ -183,7 +167,7 @@ def get_report():
|
|
| 183 |
# Routes
|
| 184 |
@app.route('/')
|
| 185 |
def index():
|
| 186 |
-
return f"Server Running Version {instance.version}"
|
| 187 |
|
| 188 |
# Main entry point
|
| 189 |
if __name__ == "__main__":
|
|
|
|
| 115 |
progress = instance.get_download_progress(id)
|
| 116 |
return jsonify({"id": id, "progress": progress})
|
| 117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
@app.route('/api/cache/size', methods=['GET'])
|
| 119 |
def get_cache_size_api():
|
| 120 |
total_size = 0
|
|
|
|
| 167 |
# Routes
|
| 168 |
@app.route('/')
|
| 169 |
def index():
|
| 170 |
+
return f"{instance.id} Server Running Version {instance.version}"
|
| 171 |
|
| 172 |
# Main entry point
|
| 173 |
if __name__ == "__main__":
|