BinaryONe
commited on
Commit
·
7c3e0de
1
Parent(s):
265dfab
Changes in Database
Browse files
FileStream/bot/plugins/FileHandlers/callback.py
CHANGED
|
@@ -22,6 +22,7 @@ from FileStream.Database import Database
|
|
| 22 |
from FileStream.config import Telegram, Server
|
| 23 |
from FileStream.bot import FileStream
|
| 24 |
from FileStream.bot import MULTI_CLIENTS
|
|
|
|
| 25 |
from FileStream.Exceptions import FileNotFound # Corrected the import statement
|
| 26 |
from FileStream.utils.FileProcessors.translation import LANG, BUTTON
|
| 27 |
from FileStream.utils.FileProcessors.human_readable import humanbytes
|
|
@@ -196,7 +197,6 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
| 196 |
name = getattr(message, "caption", f"{get_name(message)}" ) or "None/Unknown"
|
| 197 |
#file_name = get_name(message)
|
| 198 |
#name = file_caption if (file_caption) != "None/Unknown" else file_name
|
| 199 |
-
from FileStream.Tools.cleanup import Get_Title_Year
|
| 200 |
title, year = Get_Title_Year(name)
|
| 201 |
print(f"** ANY SEARCH :{name} \nFinal :{title} YEAR :{year}")
|
| 202 |
get_imdb_id = json.loads(imdb.search(title, year=int(year)))
|
|
@@ -259,10 +259,33 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
| 259 |
user_id = str(usr_cmd[1])
|
| 260 |
message_id = int(usr_cmd[2])
|
| 261 |
message = await FileStream.get_messages(user_id, message_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
instruction = {
|
| 263 |
"privacy_type": "PRIVATE",
|
| 264 |
"user_id": user_id,
|
| 265 |
-
"user_type": "TELEGRAM"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
}
|
| 267 |
file_info = get_file_info(message, instruction)
|
| 268 |
# Here we are Adding the File Into the database First
|
|
|
|
| 22 |
from FileStream.config import Telegram, Server
|
| 23 |
from FileStream.bot import FileStream
|
| 24 |
from FileStream.bot import MULTI_CLIENTS
|
| 25 |
+
from FileStream.Tools.cleanup import Get_Title_Year
|
| 26 |
from FileStream.Exceptions import FileNotFound # Corrected the import statement
|
| 27 |
from FileStream.utils.FileProcessors.translation import LANG, BUTTON
|
| 28 |
from FileStream.utils.FileProcessors.human_readable import humanbytes
|
|
|
|
| 197 |
name = getattr(message, "caption", f"{get_name(message)}" ) or "None/Unknown"
|
| 198 |
#file_name = get_name(message)
|
| 199 |
#name = file_caption if (file_caption) != "None/Unknown" else file_name
|
|
|
|
| 200 |
title, year = Get_Title_Year(name)
|
| 201 |
print(f"** ANY SEARCH :{name} \nFinal :{title} YEAR :{year}")
|
| 202 |
get_imdb_id = json.loads(imdb.search(title, year=int(year)))
|
|
|
|
| 259 |
user_id = str(usr_cmd[1])
|
| 260 |
message_id = int(usr_cmd[2])
|
| 261 |
message = await FileStream.get_messages(user_id, message_id)
|
| 262 |
+
name = getattr(message, "caption", f"{get_name(message)}" ) or "None/Unknown"
|
| 263 |
+
#file_name = get_name(message)
|
| 264 |
+
#name = file_caption if (file_caption) != "None/Unknown" else file_name
|
| 265 |
+
from FileStream.Tools.cleanup import Get_Title_Year
|
| 266 |
+
title, year = Get_Title_Year(name)
|
| 267 |
+
print(f"** ANY SEARCH :{name} \nFinal :{title} YEAR :{year}")
|
| 268 |
+
get_imdb_id = json.loads(imdb.search(title, year=int(year)))
|
| 269 |
+
#print(f"ANY SEARCH :{title} YEAR :{year} IMDB Response :{res}")
|
| 270 |
+
#print("TMDB",search_tmdb_any(title, year))
|
| 271 |
+
#print(f"IMDB ID :{get_imdb_id['results'][0]['id']}")
|
| 272 |
+
print(f"\n** GET_ID {get_imdb_id}")
|
| 273 |
+
#pprint(get_imdb_id)
|
| 274 |
+
#res=json.loads(imdb.get_by_id(get_imdb_id['results'][0]['id']))
|
| 275 |
+
res=json.loads(imdb.get_by_id(get_imdb_id['results'][0]['id']))
|
| 276 |
+
print(f"\n** IMDB Response :{res}")
|
| 277 |
instruction = {
|
| 278 |
"privacy_type": "PRIVATE",
|
| 279 |
"user_id": user_id,
|
| 280 |
+
"user_type": "TELEGRAM",
|
| 281 |
+
"IMDB_id": get_imdb_id['results'][0]['id'],
|
| 282 |
+
"poster": res.get("poster", "None"),
|
| 283 |
+
"title": res['name'],
|
| 284 |
+
"release_date": res["datePublished"],
|
| 285 |
+
"type": res['type'],
|
| 286 |
+
"description":res.get("description", "None"),
|
| 287 |
+
"keywords":res["keywords"].split(",") if res.get("keywords") else [],
|
| 288 |
+
"genre": res.get("genre", []) ,
|
| 289 |
}
|
| 290 |
file_info = get_file_info(message, instruction)
|
| 291 |
# Here we are Adding the File Into the database First
|