Spaces:
Running
Running
BinaryONe
commited on
Commit
·
06de700
1
Parent(s):
af6a9a1
Callback Update
Browse files
FileStream/TMDB/Endpoint.py
CHANGED
|
@@ -18,17 +18,14 @@ def search_tmdb_movies(name):
|
|
| 18 |
for result in search_results:
|
| 19 |
if not isinstance(result, dict):
|
| 20 |
result = dict(result)
|
| 21 |
-
|
| 22 |
if result.get("media_type") == "movie":
|
| 23 |
release_date= result.get("release_date") or result.get("first_air_date")
|
| 24 |
if release_date and int(release_date.split('-')[0]) == year:
|
| 25 |
-
print("\n * TMDB response" ,result, type(result))
|
| 26 |
return dict(result)
|
| 27 |
-
|
| 28 |
except Exception as e :
|
| 29 |
print("* Error at Endpoint", e, result)
|
| 30 |
return None
|
| 31 |
-
|
| 32 |
return None
|
| 33 |
|
| 34 |
def search_tmdb_tv(name):
|
|
|
|
| 18 |
for result in search_results:
|
| 19 |
if not isinstance(result, dict):
|
| 20 |
result = dict(result)
|
|
|
|
| 21 |
if result.get("media_type") == "movie":
|
| 22 |
release_date= result.get("release_date") or result.get("first_air_date")
|
| 23 |
if release_date and int(release_date.split('-')[0]) == year:
|
| 24 |
+
#print("\n * TMDB response" ,result, type(result))
|
| 25 |
return dict(result)
|
|
|
|
| 26 |
except Exception as e :
|
| 27 |
print("* Error at Endpoint", e, result)
|
| 28 |
return None
|
|
|
|
| 29 |
return None
|
| 30 |
|
| 31 |
def search_tmdb_tv(name):
|
FileStream/bot/plugins/FileHandlers/callback.py
CHANGED
|
@@ -149,21 +149,19 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
| 149 |
#response_id = int(usr_cmd[3])
|
| 150 |
message = await FileStream.get_messages(user_id, message_id)
|
| 151 |
#response = await FileStream.get_messages(user_id, response_id)
|
| 152 |
-
#print("Response Update:",update,f"Message ID:{response_id}")
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
"user_type": "TELEGRAM",
|
| 157 |
-
"type": msg_type
|
| 158 |
-
}
|
| 159 |
-
file_caption = getattr(message, "caption", f"{get_name(message)}" ) or "None/Unknown"
|
| 160 |
-
file_name = get_name(message)
|
| 161 |
-
name = file_caption if file_caption != "None/Unknown" else file_name
|
| 162 |
-
|
| 163 |
from FileStream.TMDB.Endpoint import search_tmdb_any, search_tmdb_tv, search_tmdb_movies
|
| 164 |
if msg_type == 'MOVIE':
|
| 165 |
-
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
elif msg_type == "WEBSERIES":
|
| 168 |
print(search_tmdb_any(name))
|
| 169 |
elif msg_type == "ANIME":
|
|
@@ -175,8 +173,17 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
| 175 |
else:
|
| 176 |
print("Please choose correct answer")
|
| 177 |
|
| 178 |
-
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
file_info = get_file_info(message, instruction)
|
| 181 |
# Here we are Adding the File Into the database First
|
| 182 |
inserted_id = await db.add_file(file_info)
|
|
|
|
| 149 |
#response_id = int(usr_cmd[3])
|
| 150 |
message = await FileStream.get_messages(user_id, message_id)
|
| 151 |
#response = await FileStream.get_messages(user_id, response_id)
|
| 152 |
+
#print("Response Update:",update,f"Message ID:{response_id}")
|
| 153 |
+
name = getattr(message, "caption", f"{get_name(message)}" ) or "None/Unknown"
|
| 154 |
+
#file_name = get_name(message)
|
| 155 |
+
#name = file_caption if (file_caption) != "None/Unknown" else file_name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
from FileStream.TMDB.Endpoint import search_tmdb_any, search_tmdb_tv, search_tmdb_movies
|
| 157 |
if msg_type == 'MOVIE':
|
| 158 |
+
resp=search_tmdb_movies(name)
|
| 159 |
+
result={
|
| 160 |
+
'title': resp['title'],
|
| 161 |
+
'id': resp['id'],
|
| 162 |
+
'media_type': resp['media_type'],
|
| 163 |
+
'overview':resp['overview']
|
| 164 |
+
}
|
| 165 |
elif msg_type == "WEBSERIES":
|
| 166 |
print(search_tmdb_any(name))
|
| 167 |
elif msg_type == "ANIME":
|
|
|
|
| 173 |
else:
|
| 174 |
print("Please choose correct answer")
|
| 175 |
|
| 176 |
+
instruction = {
|
| 177 |
+
"privacy_type": "PUBLIC",
|
| 178 |
+
"user_id": user_id,
|
| 179 |
+
"user_type": "TELEGRAM",
|
| 180 |
+
"TMDB_id": result['id'],
|
| 181 |
+
"title": result['title'],
|
| 182 |
+
"type": result['media_type'],
|
| 183 |
+
"subtype":"Unknown",
|
| 184 |
+
"quality":"Unknown",
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
file_info = get_file_info(message, instruction)
|
| 188 |
# Here we are Adding the File Into the database First
|
| 189 |
inserted_id = await db.add_file(file_info)
|
FileStream/bot/plugins/FileHandlers/stream.py
CHANGED
|
@@ -61,9 +61,13 @@ async def private_receive_handler(bot: Client, message: Message):
|
|
| 61 |
"privacy_type":"PUBLIC",
|
| 62 |
"user_id":message.from_user.id if (message.chat.type == ChatType.PRIVATE) else message.chat.id,
|
| 63 |
"user_type": "TELEGRAM",
|
| 64 |
-
"
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
reply = await message.reply_text(LANG.PROCESSING_TEXT)
|
| 68 |
file_info=get_file_info(message, instruction)
|
| 69 |
reply_markup, stream_text = await upload_type_func(get_file_info(message, instruction),reply)
|
|
|
|
| 61 |
"privacy_type":"PUBLIC",
|
| 62 |
"user_id":message.from_user.id if (message.chat.type == ChatType.PRIVATE) else message.chat.id,
|
| 63 |
"user_type": "TELEGRAM",
|
| 64 |
+
"TMDB_id": "Unknown",
|
| 65 |
+
"title":"Unknown",
|
| 66 |
+
"type": "Unknown",
|
| 67 |
+
"subtype":"Unknown",
|
| 68 |
+
"quality":"Unknown",
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
reply = await message.reply_text(LANG.PROCESSING_TEXT)
|
| 72 |
file_info=get_file_info(message, instruction)
|
| 73 |
reply_markup, stream_text = await upload_type_func(get_file_info(message, instruction),reply)
|
FileStream/utils/FileProcessors/file_properties.py
CHANGED
|
@@ -191,8 +191,8 @@ def get_file_info(message, instruction):
|
|
| 191 |
"user_id": instruction['user_id'],
|
| 192 |
"user_type": instruction['user_type'],
|
| 193 |
"message_id": message.id,
|
| 194 |
-
"TMDB_id":
|
| 195 |
-
"title":
|
| 196 |
"type": instruction['type'],
|
| 197 |
"subtype":"Unknown",
|
| 198 |
"quality":"Unknown",
|
|
|
|
| 191 |
"user_id": instruction['user_id'],
|
| 192 |
"user_type": instruction['user_type'],
|
| 193 |
"message_id": message.id,
|
| 194 |
+
"TMDB_id": instruction['TMDB_id'],
|
| 195 |
+
"title": instruction['title'],
|
| 196 |
"type": instruction['type'],
|
| 197 |
"subtype":"Unknown",
|
| 198 |
"quality":"Unknown",
|