BinaryONe
commited on
Commit
ยท
c140fac
1
Parent(s):
92e93c1
Callback Update
Browse files
FileStream/Tools/cleanup.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import re
|
| 2 |
|
| 3 |
-
#words_to_remove = ["FC","HEVC","ษดแดแดแด:","-","BuLMoviee" ,"๐๐ผ๐ถ๐ป ๐จ๐ ๐ข๐ป ๐ง๐ฒ๐น๐ฒ๐ด๐ฟ๐ฎ๏ฟฝ","SIDHUU 591","๐ฑ๐๐๐ ๐ผ๐ ๐ถษด ๐ปแดสแดษขสแดแด","Tษชแดสแด :"]
|
| 4 |
|
| 5 |
def remove_words(text, words_to_remove):
|
| 6 |
# Join the words to remove into a single regex pattern
|
|
@@ -50,11 +50,32 @@ def clean_text(input_text):
|
|
| 50 |
return output_text
|
| 51 |
|
| 52 |
|
| 53 |
-
|
| 54 |
def Get_Title_Year(name):
|
| 55 |
# Regex to match title and year
|
| 56 |
-
words_to_remove = [
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
match = re.search(r'(?P<title>.+?)[\s\.\(\)]*(?P<year>\d{4})',name )
|
| 59 |
|
| 60 |
if match:
|
|
|
|
| 1 |
import re
|
| 2 |
|
| 3 |
+
# words_to_remove = ["FC","HEVC","ษดแดแดแด:","-","BuLMoviee" ,"๐๐ผ๐ถ๐ป ๐จ๐ ๐ข๐ป ๐ง๐ฒ๐น๐ฒ๐ด๐ฟ๐ฎ๏ฟฝ","SIDHUU 591","๐ฑ๐๐๐ ๐ผ๐ ๐ถษด ๐ปแดสแดษขสแดแด","Tษชแดสแด :"]
|
| 4 |
|
| 5 |
def remove_words(text, words_to_remove):
|
| 6 |
# Join the words to remove into a single regex pattern
|
|
|
|
| 50 |
return output_text
|
| 51 |
|
| 52 |
|
|
|
|
| 53 |
def Get_Title_Year(name):
|
| 54 |
# Regex to match title and year
|
| 55 |
+
words_to_remove = [
|
| 56 |
+
"Fษชสแด",
|
| 57 |
+
"Fษชสแด ษดแดแดแด :",
|
| 58 |
+
"FC",
|
| 59 |
+
"HEVC",
|
| 60 |
+
"ษดแดแดแด",
|
| 61 |
+
"Tษชแดสแด :",
|
| 62 |
+
"-",
|
| 63 |
+
"BuLMoviee",
|
| 64 |
+
"๐๐ผ๐ถ๐ป ๐จ๐ ๐ข๐ป ๐ง๐ฒ๐น๐ฒ๐ด๐ฟ๐ฎ๏ฟฝ",
|
| 65 |
+
"๐๐ผ๐ถ๐ป ๐จ๐ ๐ข๐ป ๐ง๐ฒ๐น๐ฒ๐ด๐ฟ๐ฎ๐บ",
|
| 66 |
+
"SIDHUU 591",
|
| 67 |
+
"๐ฑ๐๐๐ ๐ผ๐ ๐ถษด ๐ปแดสแดษขสแดแด",
|
| 68 |
+
"Tษชแดสแด :",
|
| 69 |
+
"Bollywood",
|
| 70 |
+
"mkv",
|
| 71 |
+
"Mแดแด ษชแด",
|
| 72 |
+
"ษขสแดแดแด",
|
| 73 |
+
"TGxMALLU_MOVIE",
|
| 74 |
+
"[Tg-@New_Movies_OnTG]",
|
| 75 |
+
"[@ClipmateEmpire]",
|
| 76 |
+
"@Horek_Rokom2020"
|
| 77 |
+
]
|
| 78 |
+
name = remove_words(name, words_to_remove)
|
| 79 |
match = re.search(r'(?P<title>.+?)[\s\.\(\)]*(?P<year>\d{4})',name )
|
| 80 |
|
| 81 |
if match:
|
FileStream/utils/FileProcessors/bot_utils.py
CHANGED
|
@@ -12,6 +12,8 @@ from FileStream.Database import Database
|
|
| 12 |
from FileStream.utils.FileProcessors.human_readable import humanbytes
|
| 13 |
from FileStream.config import Telegram, Server
|
| 14 |
from FileStream.bot import FileStream
|
|
|
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
db = Database(Telegram.DATABASE_URL, Telegram.SESSION_NAME)
|
|
@@ -105,8 +107,10 @@ async def upload_type_func(file_info,replied_message):
|
|
| 105 |
return reply_markup, stream_text
|
| 106 |
|
| 107 |
else:
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
| 110 |
reply_markup = InlineKeyboardMarkup([[
|
| 111 |
InlineKeyboardButton(
|
| 112 |
"PUBLIC UPLOAD",
|
|
|
|
| 12 |
from FileStream.utils.FileProcessors.human_readable import humanbytes
|
| 13 |
from FileStream.config import Telegram, Server
|
| 14 |
from FileStream.bot import FileStream
|
| 15 |
+
from FileStream.Tools.cleanup import Get_Title_Year
|
| 16 |
+
|
| 17 |
|
| 18 |
|
| 19 |
db = Database(Telegram.DATABASE_URL, Telegram.SESSION_NAME)
|
|
|
|
| 107 |
return reply_markup, stream_text
|
| 108 |
|
| 109 |
else:
|
| 110 |
+
|
| 111 |
+
name = file_info['file']['caption'] if file_info['file']['caption'] else file_info['file']['file_name']
|
| 112 |
+
title, year = Get_Title_Year(name)
|
| 113 |
+
stream_text = LANG.STREAM_TEXT_Y.format(file_info['file']['file_name'],str(title+" "+year),humanbytes(file_info['file']['file_size']))
|
| 114 |
reply_markup = InlineKeyboardMarkup([[
|
| 115 |
InlineKeyboardButton(
|
| 116 |
"PUBLIC UPLOAD",
|
FileStream/utils/FileProcessors/translation.py
CHANGED
|
@@ -44,6 +44,7 @@ class LANG(object):
|
|
| 44 |
STREAM_TEXT_Y = """
|
| 45 |
<b>๐ช : ๐น๐โ๐ธโ๐ ๐ปโ๐๐๐ผ : ๐ช</b>\n
|
| 46 |
<b>๐ Fษชสแด ษดแดแดแด :</b> <b>{}</b>\n
|
|
|
|
| 47 |
<b>๐ฆ Fษชสแด ๊ฑษชแดขแด :</b> <code>{}</code>\n
|
| 48 |
"""
|
| 49 |
|
|
|
|
| 44 |
STREAM_TEXT_Y = """
|
| 45 |
<b>๐ช : ๐น๐โ๐ธโ๐ ๐ปโ๐๐๐ผ : ๐ช</b>\n
|
| 46 |
<b>๐ Fษชสแด ษดแดแดแด :</b> <b>{}</b>\n
|
| 47 |
+
<b>๐ ๐ฃ๐พ๐๐๐๐พ๐ฝ ๐ญ๐บ๐๐พ :</b> <b>{}</b>\n
|
| 48 |
<b>๐ฆ Fษชสแด ๊ฑษชแดขแด :</b> <code>{}</code>\n
|
| 49 |
"""
|
| 50 |
|