Spaces:
Running
Running
BinaryONe
commited on
Commit
·
400d8b3
1
Parent(s):
5725d40
Image Enhancement
Browse files- FileStream/Database/database.py +1 -1
- FileStream/bot/plugins/FileHandlers/callback.py +3 -3
- FileStream/bot/plugins/FileHandlers/stream.py +15 -13
- FileStream/utils/FileProcessors/bot_utils.py +6 -6
- FileStream/utils/FileProcessors/custom_ul.py +1 -1
- FileStream/utils/FileProcessors/translation.py +1 -1
FileStream/Database/database.py
CHANGED
@@ -128,7 +128,7 @@ class Database:
|
|
128 |
if not file_info:
|
129 |
file_info = await self.tfiles.find_one({"_id": ObjectId(_id)})
|
130 |
#raise FileNotFound
|
131 |
-
print(file_info)
|
132 |
return file_info
|
133 |
except InvalidId:
|
134 |
raise FileNotFound
|
|
|
128 |
if not file_info:
|
129 |
file_info = await self.tfiles.find_one({"_id": ObjectId(_id)})
|
130 |
#raise FileNotFound
|
131 |
+
#print(file_info)
|
132 |
return file_info
|
133 |
except InvalidId:
|
134 |
raise FileNotFound
|
FileStream/bot/plugins/FileHandlers/callback.py
CHANGED
@@ -105,7 +105,7 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
105 |
|
106 |
elif usr_cmd[0] == "mainstream":
|
107 |
_id = usr_cmd[1]
|
108 |
-
reply_markup,stream_text
|
109 |
await update.message.edit_text(
|
110 |
text=stream_text,
|
111 |
parse_mode=ParseMode.HTML,
|
@@ -158,7 +158,7 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
158 |
await get_file_ids(False, inserted_id, message)
|
159 |
#All the Time Get_file_ids should be called before update privacy or else tagged_users will be {}
|
160 |
await db.update_privacy(file_info)
|
161 |
-
reply_markup, stream_text
|
162 |
await update.message.edit_text(
|
163 |
text=stream_text,
|
164 |
parse_mode=ParseMode.HTML,
|
@@ -224,7 +224,7 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
224 |
#All the Time Get_file_ids should be called before update privacy or else tagged_users will be {}
|
225 |
print(file_info)
|
226 |
await db.update_privacy(file_info)
|
227 |
-
reply_markup,stream_text
|
228 |
await update.message.edit_text(
|
229 |
text=stream_text,
|
230 |
parse_mode=ParseMode.HTML,
|
|
|
105 |
|
106 |
elif usr_cmd[0] == "mainstream":
|
107 |
_id = usr_cmd[1]
|
108 |
+
reply_markup,stream_text = await gen_link(_id=_id)
|
109 |
await update.message.edit_text(
|
110 |
text=stream_text,
|
111 |
parse_mode=ParseMode.HTML,
|
|
|
158 |
await get_file_ids(False, inserted_id, message)
|
159 |
#All the Time Get_file_ids should be called before update privacy or else tagged_users will be {}
|
160 |
await db.update_privacy(file_info)
|
161 |
+
reply_markup, stream_text = await gen_link(_id=inserted_id)
|
162 |
await update.message.edit_text(
|
163 |
text=stream_text,
|
164 |
parse_mode=ParseMode.HTML,
|
|
|
224 |
#All the Time Get_file_ids should be called before update privacy or else tagged_users will be {}
|
225 |
print(file_info)
|
226 |
await db.update_privacy(file_info)
|
227 |
+
reply_markup,stream_text = await gen_link(_id=inserted_id)
|
228 |
await update.message.edit_text(
|
229 |
text=stream_text,
|
230 |
parse_mode=ParseMode.HTML,
|
FileStream/bot/plugins/FileHandlers/stream.py
CHANGED
@@ -75,20 +75,22 @@ async def private_receive_handler(bot: Client, message: Message):
|
|
75 |
reply = await message.reply_text(LANG.PROCESSING_TEXT)
|
76 |
file_info=get_file_info(message, instruction)
|
77 |
#This Will give a option to Public Private and temporary Upload
|
78 |
-
reply_markup,stream_text
|
79 |
-
|
80 |
if poster == "None":
|
81 |
-
await reply.
|
|
|
82 |
parse_mode=ParseMode.HTML,
|
83 |
-
|
84 |
-
reply_markup= reply_markup,
|
85 |
)
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
92 |
|
93 |
except FloodWait as e:
|
94 |
print(f"Sleeping for {str(e.value)}s")
|
@@ -111,7 +113,7 @@ async def channel_receive_handler(bot: Client, message: Message):
|
|
111 |
try:
|
112 |
inserted_id = await db.add_file(file_info=get_file_info(message), db_type="TEMPORARY")
|
113 |
await get_file_ids(False, inserted_id, MULTI_CLIENTS, message)
|
114 |
-
reply_markup,streaam_text
|
115 |
await bot.edit_message_reply_markup(
|
116 |
chat_id=message.chat.id,
|
117 |
message_id=message.id,
|
@@ -215,7 +217,7 @@ async def reply_handler(
|
|
215 |
reply_to_msg_id=None,
|
216 |
chat_id=Telegram.PFLOG_CHANNEL)
|
217 |
|
218 |
-
reply_markup,stream_text
|
219 |
await replied_message.edit_text(
|
220 |
text=f"{message_txt}\n{stream_text}",
|
221 |
parse_mode=ParseMode.HTML,
|
|
|
75 |
reply = await message.reply_text(LANG.PROCESSING_TEXT)
|
76 |
file_info=get_file_info(message, instruction)
|
77 |
#This Will give a option to Public Private and temporary Upload
|
78 |
+
reply_markup,stream_text = await upload_type_func(get_file_info(message, instruction),reply)
|
79 |
+
"""
|
80 |
if poster == "None":
|
81 |
+
await reply.reply_photo(photo=poster,
|
82 |
+
caption=stream_text,
|
83 |
parse_mode=ParseMode.HTML,
|
84 |
+
reply_markup=reply_markup
|
|
|
85 |
)
|
86 |
+
|
87 |
+
else:"""
|
88 |
+
await reply.edit_text(text=stream_text,
|
89 |
+
parse_mode=ParseMode.HTML,
|
90 |
+
disable_web_page_preview=True,
|
91 |
+
reply_markup= reply_markup,
|
92 |
+
)
|
93 |
+
|
94 |
|
95 |
except FloodWait as e:
|
96 |
print(f"Sleeping for {str(e.value)}s")
|
|
|
113 |
try:
|
114 |
inserted_id = await db.add_file(file_info=get_file_info(message), db_type="TEMPORARY")
|
115 |
await get_file_ids(False, inserted_id, MULTI_CLIENTS, message)
|
116 |
+
reply_markup,streaam_text = await gen_link(_id=inserted_id)
|
117 |
await bot.edit_message_reply_markup(
|
118 |
chat_id=message.chat.id,
|
119 |
message_id=message.id,
|
|
|
217 |
reply_to_msg_id=None,
|
218 |
chat_id=Telegram.PFLOG_CHANNEL)
|
219 |
|
220 |
+
reply_markup,stream_text = await gen_link(_id=file_info['_id'])
|
221 |
await replied_message.edit_text(
|
222 |
text=f"{message_txt}\n{stream_text}",
|
223 |
parse_mode=ParseMode.HTML,
|
FileStream/utils/FileProcessors/bot_utils.py
CHANGED
@@ -92,10 +92,10 @@ async def upload_type_func(file_info,replied_message):
|
|
92 |
"""
|
93 |
existing_file = await db.get_file_by_fileuniqueid_only(file_info['file']['file_unique_id'], file_info['privacy_type'])
|
94 |
if existing_file :
|
95 |
-
reply_markup,stream_text
|
96 |
#await update.message.edit_text(text=stream_text,parse_mode=ParseMode.HTML,disable_web_page_preview=True,reply_markup=reply_markup,)
|
97 |
#return {"reply_markup" : response.get("reply_markup"), "stream_text": response.get("stream_text"),"poster":response.get("poster"),"type":"ExistingFile"}
|
98 |
-
return reply_markup,stream_text
|
99 |
else:
|
100 |
name = file_info['file']['caption'] if file_info['file']['caption'] else file_info['file']['file_name']
|
101 |
title, year = Get_Title_Year(name)
|
@@ -109,7 +109,7 @@ async def upload_type_func(file_info,replied_message):
|
|
109 |
],
|
110 |
[InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]
|
111 |
])
|
112 |
-
return reply_markup, stream_text
|
113 |
|
114 |
|
115 |
async def priv_func(file_name, file_size):
|
@@ -160,7 +160,7 @@ async def gen_priv_file_link(_id):
|
|
160 |
|
161 |
async def gen_link(_id):
|
162 |
file_info = await db.get_file(_id)
|
163 |
-
print("File Info at Gen Link :",file_info,type(file_info))
|
164 |
#file_name = file_info.get("file").get("file_name", ""),
|
165 |
file_name = file_info['file']['file_name']
|
166 |
file_size = humanbytes(file_info['file']['file_size'])
|
@@ -173,7 +173,7 @@ async def gen_link(_id):
|
|
173 |
stream_link = f"{Server.URL}api/dl/{_id}"
|
174 |
file_link = f"https://t.me/{FileStream.username}?start=file_{_id}"
|
175 |
#poster=''.join(poster)
|
176 |
-
print("\n Poster", poster, type(poster))
|
177 |
|
178 |
if "video" in mime_type:
|
179 |
stream_text = LANG.STREAM_TEXT.format(poster,description,title,release_date,file_name, file_size, stream_link, page_link, file_link)
|
@@ -196,7 +196,7 @@ async def gen_link(_id):
|
|
196 |
InlineKeyboardButton("ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",callback_data=f"msgdelpvt_{_id}")
|
197 |
], [InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]
|
198 |
])
|
199 |
-
return reply_markup, stream_text
|
200 |
|
201 |
|
202 |
#---------------------[ GEN STREAM LINKS FOR CHANNEL ]---------------------#
|
|
|
92 |
"""
|
93 |
existing_file = await db.get_file_by_fileuniqueid_only(file_info['file']['file_unique_id'], file_info['privacy_type'])
|
94 |
if existing_file :
|
95 |
+
reply_markup,stream_text = await gen_link(existing_file['_id'])
|
96 |
#await update.message.edit_text(text=stream_text,parse_mode=ParseMode.HTML,disable_web_page_preview=True,reply_markup=reply_markup,)
|
97 |
#return {"reply_markup" : response.get("reply_markup"), "stream_text": response.get("stream_text"),"poster":response.get("poster"),"type":"ExistingFile"}
|
98 |
+
return reply_markup,stream_text
|
99 |
else:
|
100 |
name = file_info['file']['caption'] if file_info['file']['caption'] else file_info['file']['file_name']
|
101 |
title, year = Get_Title_Year(name)
|
|
|
109 |
],
|
110 |
[InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]
|
111 |
])
|
112 |
+
return reply_markup, stream_text
|
113 |
|
114 |
|
115 |
async def priv_func(file_name, file_size):
|
|
|
160 |
|
161 |
async def gen_link(_id):
|
162 |
file_info = await db.get_file(_id)
|
163 |
+
#print("File Info at Gen Link :",file_info,type(file_info))
|
164 |
#file_name = file_info.get("file").get("file_name", ""),
|
165 |
file_name = file_info['file']['file_name']
|
166 |
file_size = humanbytes(file_info['file']['file_size'])
|
|
|
173 |
stream_link = f"{Server.URL}api/dl/{_id}"
|
174 |
file_link = f"https://t.me/{FileStream.username}?start=file_{_id}"
|
175 |
#poster=''.join(poster)
|
176 |
+
#print("\n Poster", poster, type(poster))
|
177 |
|
178 |
if "video" in mime_type:
|
179 |
stream_text = LANG.STREAM_TEXT.format(poster,description,title,release_date,file_name, file_size, stream_link, page_link, file_link)
|
|
|
196 |
InlineKeyboardButton("ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",callback_data=f"msgdelpvt_{_id}")
|
197 |
], [InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]
|
198 |
])
|
199 |
+
return reply_markup, stream_text
|
200 |
|
201 |
|
202 |
#---------------------[ GEN STREAM LINKS FOR CHANNEL ]---------------------#
|
FileStream/utils/FileProcessors/custom_ul.py
CHANGED
@@ -222,7 +222,7 @@ class TeleUploader:
|
|
222 |
#await db.add_webfile(file_info)
|
223 |
inserted_id = await db.add_file(file_info=file_info,db_type="TEMPORARY")
|
224 |
await get_file_ids(False, inserted_id, MessageFile)
|
225 |
-
reply_markup,stream_text
|
226 |
await message.edit_text(
|
227 |
text=stream_text,
|
228 |
parse_mode=ParseMode.HTML,
|
|
|
222 |
#await db.add_webfile(file_info)
|
223 |
inserted_id = await db.add_file(file_info=file_info,db_type="TEMPORARY")
|
224 |
await get_file_ids(False, inserted_id, MessageFile)
|
225 |
+
reply_markup,stream_text = await gen_link(_id=inserted_id)
|
226 |
await message.edit_text(
|
227 |
text=stream_text,
|
228 |
parse_mode=ParseMode.HTML,
|
FileStream/utils/FileProcessors/translation.py
CHANGED
@@ -35,7 +35,7 @@ class LANG(object):
|
|
35 |
|
36 |
STREAM_TEXT = """
|
37 |
<i>𝗬𝗼𝘂𝗿 𝗟𝗶𝗻𝗸 𝗚𝗲𝗻𝗲𝗿𝗮𝘁𝗲𝗱 !</i>\n
|
38 |
-
<img src={} width="150" height="300"
|
39 |
<b>📣 ᴅᴇꜱᴄʀɪᴘᴛɪᴏɴ :</b> {} \n
|
40 |
<b>📊 ɪᴍᴅʙ :</b> {} \n
|
41 |
<b>📦 રειελȘε :</b> {} \n
|
|
|
35 |
|
36 |
STREAM_TEXT = """
|
37 |
<i>𝗬𝗼𝘂𝗿 𝗟𝗶𝗻𝗸 𝗚𝗲𝗻𝗲𝗿𝗮𝘁𝗲𝗱 !</i>\n
|
38 |
+
<img src='{}' width="150" height="300">
|
39 |
<b>📣 ᴅᴇꜱᴄʀɪᴘᴛɪᴏɴ :</b> {} \n
|
40 |
<b>📊 ɪᴍᴅʙ :</b> {} \n
|
41 |
<b>📦 રειελȘε :</b> {} \n
|