BinaryONe commited on
Commit
8d4d962
·
1 Parent(s): 3ad44f5

Callback Update

Browse files
FileStream/Database/database.py CHANGED
@@ -56,10 +56,12 @@ class Database:
56
  "user_type": details['user_type'] if details['user_type'] else None,
57
  "message_id": details['message_id'] if details['message_id'] else None,
58
  "location":details['location'] if details['location'] else None,
59
- "TMDB_id": int(),
 
60
  "title": "Unknown",
61
- "type":"Unknown",
62
- "subtype":"Unknown",
 
63
  "quality":"Unknown",
64
  "time": details['time'] if details['time'] else None,
65
  "privacy_type": details['privacy_type'] if details['privacy_type'] else None,
 
56
  "user_type": details['user_type'] if details['user_type'] else None,
57
  "message_id": details['message_id'] if details['message_id'] else None,
58
  "location":details['location'] if details['location'] else None,
59
+ "IMDB_id": "Unknown",
60
+ "poster": "Unknown",
61
  "title": "Unknown",
62
+ "type": "Unknown",
63
+ "description":"Unknown",
64
+ "genre":"Unknown",
65
  "quality":"Unknown",
66
  "time": details['time'] if details['time'] else None,
67
  "privacy_type": details['privacy_type'] if details['privacy_type'] else None,
FileStream/bot/plugins/FileHandlers/callback.py CHANGED
@@ -111,47 +111,11 @@ async def cb_data(bot: Client, update: CallbackQuery):
111
  disable_web_page_preview=True,
112
  reply_markup=reply_markup,
113
  )
114
- elif usr_cmd[0] == "initialize":
115
- try:
116
- upload_type=str(usr_cmd[1])
117
- user_id = str(usr_cmd[2])
118
- message_id = int(usr_cmd[3])
119
-
120
- await update.message.edit_text(
121
- text=f"Please Choose The File Type",
122
- parse_mode=ParseMode.HTML,
123
- disable_web_page_preview=True,
124
- reply_markup=InlineKeyboardMarkup([
125
- [InlineKeyboardButton("Movie", callback_data=f"{'privup' if upload_type =='PRIVATE' else 'pubup'}_{user_id}_{message_id}_MOVIE")],
126
- [InlineKeyboardButton("WebSeries", callback_data=f"{'privup' if upload_type =='PRIVATE' else 'pubup'}_{user_id}_{message_id}_WEBSERIES")],
127
- [InlineKeyboardButton("Anime", callback_data=f"{'privup' if upload_type =='PRIVATE' else 'pubup'}_{user_id}_{message_id}_ANIME")],
128
- [InlineKeyboardButton("Documentary", callback_data=f"{'privup' if upload_type =='PRIVATE' else 'pubup'}_{user_id}_{message_id}_DOCUMENTARY")],
129
- [InlineKeyboardButton("Regular", callback_data=f"{'privup' if upload_type =='PRIVATE' else 'pubup'}_{user_id}_{message_id}_REGULAR")],
130
- [ InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]
131
- ]),
132
- )
133
- except FloodWait as e:
134
- print(f"Sleeping for {str(e.value)}s")
135
- await asyncio.sleep(e.value)
136
- await FileStream.send_message(
137
- chat_id=Telegram.ULOG_GROUP,
138
- text=
139
- f"Gᴏᴛ FʟᴏᴏᴅWᴀɪᴛ ᴏғ {str(e.value)}s ғʀᴏᴍ [{message.from_user.first_name}](tg://user?id={message.from_user.id})\n\n**ᴜsᴇʀ ɪᴅ :** `{str(message.from_user.id)}`",
140
- disable_web_page_preview=True,
141
- parse_mode=ParseMode.MARKDOWN)
142
- except Exception as e:
143
- print(f"An error occurred: {str(e)}")
144
- await FileStream.send_message(
145
- chat_id=Telegram.ULOG_GROUP,
146
- text=f"An error occurred: {str(e)}"
147
- )
148
  elif usr_cmd[0] == "pubup":
149
  try:
150
  print("Public Upload :",usr_cmd)
151
  user_id = str(usr_cmd[1])
152
  message_id = int(usr_cmd[2])
153
- msg_type = usr_cmd[3]
154
- #response_id = int(usr_cmd[3])
155
  message = await FileStream.get_messages(user_id, message_id)
156
  #response = await FileStream.get_messages(user_id, response_id)
157
  print(f"Message:{message}")
@@ -161,42 +125,24 @@ async def cb_data(bot: Client, update: CallbackQuery):
161
  from FileStream.Tools.cleanup import Get_Title_Year
162
  title, year = Get_Title_Year(name)
163
  year = int(year)
164
- res = json.loads(imdb.search(title, year=year))
165
- print(f"ANY SEARCH :{title} YEAR :{year} IMDB Response :{res}")
166
- print("TMDB",search_tmdb_any(title, year))
167
- print(f"IMDB ID :{res['results'][0]['id']}")
168
- print(f"IMDB Response :{imdb.get_by_id(res['results'][0]['id'])}")
169
- if msg_type == 'MOVIE':
170
- resp=search_tmdb_movies(name)
171
- print("TMDB Movie Response:",resp,"\n IMDB",res)
172
- result={
173
- 'title': resp['title'],
174
- 'id': resp['id'],
175
- 'media_type': resp['media_type'],
176
- 'overview':resp['overview']
177
- }
178
- elif msg_type == "WEBSERIES":
179
- resp=search_tmdb_any(title, year)
180
- result={
181
- 'title': resp['title'],
182
- 'id': resp['id'],
183
- 'media_type': resp['media_type'],
184
- 'overview':resp['overview']
185
- }
186
- else:
187
- print("Please choose correct answer")
188
-
189
  instruction = {
190
  "privacy_type": "PUBLIC",
191
  "user_id": user_id,
192
  "user_type": "TELEGRAM",
193
  "IMDB_id": res['results'][0]['id'],
194
- "TMDB_id": result['id'],
195
- "title": result['title'],
196
- "type": result['media_type'],
197
- "subtype":"Unknown",
 
198
  "quality":"Unknown",
199
  }
 
200
  file_info = get_file_info(message, instruction)
201
  # Here we are Adding the File Into the database First
202
  inserted_id = await db.add_file(file_info)
 
111
  disable_web_page_preview=True,
112
  reply_markup=reply_markup,
113
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  elif usr_cmd[0] == "pubup":
115
  try:
116
  print("Public Upload :",usr_cmd)
117
  user_id = str(usr_cmd[1])
118
  message_id = int(usr_cmd[2])
 
 
119
  message = await FileStream.get_messages(user_id, message_id)
120
  #response = await FileStream.get_messages(user_id, response_id)
121
  print(f"Message:{message}")
 
125
  from FileStream.Tools.cleanup import Get_Title_Year
126
  title, year = Get_Title_Year(name)
127
  year = int(year)
128
+ get_imdb_id = json.loads(imdb.search(title, year=year))
129
+ #print(f"ANY SEARCH :{title} YEAR :{year} IMDB Response :{res}")
130
+ #print("TMDB",search_tmdb_any(title, year))
131
+ #print(f"IMDB ID :{res['results'][0]['id']}")
132
+ res=json.loads(imdb.get_by_id(get_imdb_id['results'][0]['id']))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  instruction = {
134
  "privacy_type": "PUBLIC",
135
  "user_id": user_id,
136
  "user_type": "TELEGRAM",
137
  "IMDB_id": res['results'][0]['id'],
138
+ "poster": res['poster'],
139
+ "title": res['name'],
140
+ "type": res['type'],
141
+ "description":res["description"],
142
+ "genre":[res["genre"],res["keywords"]],
143
  "quality":"Unknown",
144
  }
145
+
146
  file_info = get_file_info(message, instruction)
147
  # Here we are Adding the File Into the database First
148
  inserted_id = await db.add_file(file_info)
FileStream/bot/plugins/FileHandlers/stream.py CHANGED
@@ -62,10 +62,11 @@ async def private_receive_handler(bot: Client, message: Message):
62
  "user_id":message.from_user.id if (message.chat.type == ChatType.PRIVATE) else message.chat.id,
63
  "user_type": "TELEGRAM",
64
  "IMDB_id": "Unknown",
65
- "TMDB_id": "Unknown",
66
- "title":"Unknown",
67
  "type": "Unknown",
68
- "subtype":"Unknown",
 
69
  "quality":"Unknown",
70
  }
71
 
 
62
  "user_id":message.from_user.id if (message.chat.type == ChatType.PRIVATE) else message.chat.id,
63
  "user_type": "TELEGRAM",
64
  "IMDB_id": "Unknown",
65
+ "poster": "Unknown",
66
+ "title": "Unknown",
67
  "type": "Unknown",
68
+ "description":"Unknown",
69
+ "genre":"Unknown",
70
  "quality":"Unknown",
71
  }
72
 
FileStream/utils/FileProcessors/bot_utils.py CHANGED
@@ -110,11 +110,11 @@ async def upload_type_func(file_info,replied_message):
110
  reply_markup = InlineKeyboardMarkup([[
111
  InlineKeyboardButton(
112
  "PUBLIC UPLOAD",
113
- callback_data=f"initialize_PUBLIC_{file_info['user_id']}_{file_info['message_id']}"),
114
  InlineKeyboardButton(
115
  "PRIVATE UPLOAD",
116
  callback_data=
117
- f"initialize_PRIVATE_{file_info['user_id']}_{file_info['message_id']}")
118
  ], [InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]])
119
 
120
  return reply_markup, stream_text
 
110
  reply_markup = InlineKeyboardMarkup([[
111
  InlineKeyboardButton(
112
  "PUBLIC UPLOAD",
113
+ callback_data=f"pubup_{file_info['user_id']}_{file_info['message_id']}"),
114
  InlineKeyboardButton(
115
  "PRIVATE UPLOAD",
116
  callback_data=
117
+ f"privup_{file_info['user_id']}_{file_info['message_id']}")
118
  ], [InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]])
119
 
120
  return reply_markup, stream_text
FileStream/utils/FileProcessors/file_properties.py CHANGED
@@ -189,11 +189,12 @@ def get_file_info(message, instruction):
189
  "user_id": instruction['user_id'],
190
  "user_type": instruction['user_type'],
191
  "message_id": message.id,
192
- "IMDB_id": instruction['IMDB_id'],
193
- "TMDB_id": instruction['TMDB_id'],
194
- "title": instruction['title'],
195
- "type": instruction['type'],
196
- "subtype":"Unknown",
 
197
  "quality":"Unknown",
198
  "location": message.from_user.id if (message.chat.type == ChatType.PRIVATE) else message.chat.id,
199
  "file": {
 
189
  "user_id": instruction['user_id'],
190
  "user_type": instruction['user_type'],
191
  "message_id": message.id,
192
+ "IMDB_id": instruction["IMDB_id"],
193
+ "poster": instruction["poster"],
194
+ "title": instruction["title"],
195
+ "type": instruction["type"],
196
+ "description":instruction["description"],
197
+ "genre":instruction["genre"],
198
  "quality":"Unknown",
199
  "location": message.from_user.id if (message.chat.type == ChatType.PRIVATE) else message.chat.id,
200
  "file": {