BinaryONe commited on
Commit ·
0616e4e
1
Parent(s): 87159d4
APP -API Modifications-sparkdrive
Browse files- FileStream/server/routes_api.py +23 -23
FileStream/server/routes_api.py
CHANGED
|
@@ -90,29 +90,29 @@ async def list_all_files_tmdb(request):
|
|
| 90 |
db = Database(Telegram.DATABASE_URL, Telegram.SESSION_NAME)
|
| 91 |
files= await db.get_all_files()
|
| 92 |
#print(files)
|
| 93 |
-
response=[]
|
| 94 |
-
async
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
return web.json_response(json.loads(dumps(response)))
|
| 116 |
|
| 117 |
#api.router.add_get('/tmdb/files', list_all_files)
|
| 118 |
async def list_all_files(request):
|
|
|
|
| 90 |
db = Database(Telegram.DATABASE_URL, Telegram.SESSION_NAME)
|
| 91 |
files= await db.get_all_files()
|
| 92 |
#print(files)
|
| 93 |
+
#response=[]
|
| 94 |
+
async def data_generator():
|
| 95 |
+
async for row in files:
|
| 96 |
+
#print(row['file']['caption'])
|
| 97 |
+
try :
|
| 98 |
+
#print("* Response",search_tmdb(row['file']['caption'] if row['file']['caption'] else row['file']['file_name']))
|
| 99 |
+
resp = search_tmdb_any( str(row['file']['caption']) if str(row['file']['caption']) else str(row['file']['file_name']))
|
| 100 |
+
if resp != None :
|
| 101 |
+
#resp= dict(resp)
|
| 102 |
+
#print("TMDB Response :",resp)
|
| 103 |
+
#response.append(resp)
|
| 104 |
+
yield json.dumps(resp) + + '\n'
|
| 105 |
+
|
| 106 |
+
else:
|
| 107 |
+
print("\n * Skipped:",row['file']['caption'],str(row['file']['file_name']))
|
| 108 |
+
continue
|
| 109 |
+
|
| 110 |
+
except Exception as e:
|
| 111 |
+
print("Error ",e)
|
| 112 |
+
break
|
| 113 |
+
|
| 114 |
+
return web.Response(body=data_generator(), content_type='application/json')
|
| 115 |
+
#return web.json_response(json.loads(dumps(response)))
|
| 116 |
|
| 117 |
#api.router.add_get('/tmdb/files', list_all_files)
|
| 118 |
async def list_all_files(request):
|