feat: enhance ADB path resolution and update HTTP request handling for improved flexibility

This commit is contained in:
Nixevol
2026-09-27 14:37:51 +08:00
parent 3449adb721
commit fdb1f73968
8 changed files with 373 additions and 20 deletions
+9 -5
View File
@@ -10,6 +10,7 @@ from server.services.sessions import sessions
CLASSIFY_MAX_PAGES = 50
RECOMMEND_MAX_PAGES = 80
FIXED_SECTIONS = (
{"key": "trending", "name": "Trending Now", "note": "", "loading": True},
{"key": "new_releases", "name": "New Releases", "note": "", "loading": True},
{"key": "recommend", "name": "Recommend", "note": "", "loading": True},
)
@@ -25,7 +26,7 @@ class CatalogService:
return rows
def _categories(self, token: str, device: DeviceProfile) -> list[dict]:
data = http.request_data("POST", API_BASE + "/app/open/classifyv2", token, device, {})
data = http.request_data("GET", API_BASE + "/app/open/classifyv2", token, device, None)
rows = []
if isinstance(data, list):
for item in data:
@@ -72,14 +73,15 @@ class CatalogService:
f"type-{item['id']}",
item["label"],
"/app/open/classify_video",
"POST",
lambda page, type_id=item["id"]: {"page": page, "limit": 10, "type": type_id},
"GET",
lambda page, type_id=item["id"]: {"type": type_id, "page": page},
CLASSIFY_MAX_PAGES,
"",
)
for item in categories
]
jobs.append(("new_releases", "New Releases", "/app/open/orgin", "GET", None, 1, ""))
jobs.append(("trending", "Trending Now", "/app/open/orgin?class=trending_now", "GET", None, 1, ""))
jobs.append(("new_releases", "New Releases", "/app/open/orgin?class=new_releases", "GET", None, 1, ""))
jobs.append((
"recommend",
"Recommend",
@@ -148,7 +150,9 @@ class CatalogService:
page = 1
sent = False
while page <= max_pages:
data = http.request_data(method, API_BASE + path, token, device, body(page) if body else None)
query = body(page) if body and method == "GET" else None
payload = body(page) if body and method != "GET" else None
data = http.request_data(method, API_BASE + path, token, device, payload, query)
batch = data if isinstance(data, list) else []
if not batch and isinstance(data, dict) and isinstance(data.get("list"), list):
batch = data["list"]