Spaces:
Sleeping
Sleeping
Commit
·
6b7b0ee
1
Parent(s):
321dbb9
fix recent endpoint
Browse files
app.py
CHANGED
|
@@ -64,13 +64,21 @@ async def get_all_films_api():
|
|
| 64 |
async def get_all_tvshows_api():
|
| 65 |
return load_balancer.get_all_tv_shows()
|
| 66 |
|
| 67 |
-
@app.get("/api/get/
|
| 68 |
-
async def
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
@app.get("/api/get/film/metadata/{title}")
|
| 76 |
async def get_film_metadata_api(title: str):
|
|
|
|
| 64 |
async def get_all_tvshows_api():
|
| 65 |
return load_balancer.get_all_tv_shows()
|
| 66 |
|
| 67 |
+
@app.get("/api/get/recent")
|
| 68 |
+
async def get_recent_items(limit: int = 5):
|
| 69 |
+
# Get sorted entries
|
| 70 |
+
recent_films = recent_list.get_sorted_entries('film')
|
| 71 |
+
recent_series = recent_list.get_sorted_entries('series')
|
| 72 |
+
|
| 73 |
+
# Slice the lists to only return the desired number of items
|
| 74 |
+
limited_films = recent_films[:limit]
|
| 75 |
+
limited_series = recent_series[:limit]
|
| 76 |
+
|
| 77 |
+
# Return combined results
|
| 78 |
+
return JSONResponse(content={
|
| 79 |
+
'recent_films': limited_films,
|
| 80 |
+
'recent_series': limited_series
|
| 81 |
+
})
|
| 82 |
|
| 83 |
@app.get("/api/get/film/metadata/{title}")
|
| 84 |
async def get_film_metadata_api(title: str):
|