Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* typo

* change default progress bar

* added template to database

* fix

* Change to str !!

* Change to Str

* Take Updated One

* Refix

* Update imdb.py

Co-authored-by: Karan Adhikari <[email protected]>
  • Loading branch information
SilentDemonSD and weebzone authored Nov 27, 2022
1 parent e163f0e commit 9e75d87
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 24 deletions.
12 changes: 7 additions & 5 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@

DEF_ANI_TEMP = environ.get('ANIME_TEMPLATE', '')
if len(DEF_ANI_TEMP) == 0:
DEF_ANI_TEMP = """<b>{ro_title}</b>({na_title})
DEF_ANI_TEMP = '''<b>{ro_title}</b>({na_title})
<b>Format</b>: <code>{format}</code>
<b>Status</b>: <code>{status}</code>
<b>Start Date</b>: <code>{startdate}</code>
Expand All @@ -204,7 +204,7 @@
<b>Hashtag</b>: {hashtag}
<b>Studios</b>: {studios}
<b>Description</b>: <i>{description}</i>"""
<b>Description</b>: <i>{description}</i>'''

LIST_ITEMS = environ.get('LIST_ITEMS', '')
if len(LIST_ITEMS) == 0:
Expand Down Expand Up @@ -560,8 +560,8 @@
FINISHED_PROGRESS_STR = environ.get('FINISHED_PROGRESS_STR', '')
UN_FINISHED_PROGRESS_STR = environ.get('UN_FINISHED_PROGRESS_STR', '')
if len(FINISHED_PROGRESS_STR) == 0 or len(FINISHED_PROGRESS_STR) == 0:
FINISHED_PROGRESS_STR = '' # '■'
UN_FINISHED_PROGRESS_STR = '' # '□'
FINISHED_PROGRESS_STR = '' # '■'
UN_FINISHED_PROGRESS_STR = '' # '□'

CHANNEL_USERNAME = environ.get('CHANNEL_USERNAME', '')
if len(CHANNEL_USERNAME) == 0:
Expand Down Expand Up @@ -630,7 +630,7 @@

UPDATE_PACKAGES = environ.get('UPDATE_PACKAGES', '')
if len(UPDATE_PACKAGES) == 0:
UPDATE_PACKAGES = False
UPDATE_PACKAGES = 'False'


config_dict = {'AS_DOCUMENT': AS_DOCUMENT,
Expand Down Expand Up @@ -734,6 +734,8 @@
'PIXABAY_SEARCH': PIXABAY_SEARCH,
'NAME_FONT': NAME_FONT,
'CAPTION_FONT': CAPTION_FONT,
'DEF_IMDB_TEMP': DEF_IMDB_TEMP,
'DEF_ANI_TEMP': DEF_ANI_TEMP,
'DISABLE_DRIVE_LINK': DISABLE_DRIVE_LINK,
'UPDATE_PACKAGES': UPDATE_PACKAGES,
'SOURCE_LINK': SOURCE_LINK,
Expand Down
12 changes: 6 additions & 6 deletions bot/helper/mirror_utils/download_utils/direct_link_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ def direct_link_generator(link: str):
return solidfiles(link)
elif 'krakenfiles.com' in link:
return krakenfiles(link)
elif 'rocklinks.net' in link:
return rock(link)
elif 'try2link.com' in link:
return try2link(link)
elif 'ez4short.com' in link:
return ez4(link)
elif is_gdtot_link(link):
return gdtot(link)
elif is_unified_link(link):
Expand All @@ -90,12 +96,6 @@ def direct_link_generator(link: str):
return sharer_pw_dl(link)
elif is_sharedrive_link(link):
return shareDrive(link)
elif is_rock_link(link):
return rock(link)
elif is_try2link_link(link):
return try2link(link)
elif is_ez4_link(link):
return ez4(link)
elif any(x in link for x in fmed_list):
return fembed(link)
elif any(x in link for x in ['sbembed.com', 'watchsb.com', 'streamsb.net', 'sbplay.org']):
Expand Down
81 changes: 72 additions & 9 deletions bot/modules/bot_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'AUTO_DELETE_UPLOAD_MESSAGE_DURATION': -1,
'BOT_PM': False,
'FORCE_BOT_PM': False,
'UPDATE_PACKAGES': False,
'UPDATE_PACKAGES': 'False',
'UPSTREAM_BRANCH': 'master',
'UPSTREAM_REPO': 'https://github.com/weebzone/WZML',
'STATUS_UPDATE_INTERVAL': 10,
Expand All @@ -39,14 +39,41 @@
'CREDIT_NAME': 'WeebZone',
'NAME_FONT': 'code',
'CAPTION_FONT': 'code',
'FINISHED_PROGRESS_STR': '',
'UN_FINISHED_PROGRESS_STR': '',
'FINISHED_PROGRESS_STR': '',
'UN_FINISHED_PROGRESS_STR': '',
'CHANNEL_USERNAME': 'WeebZone_updates',
'FSUB_CHANNEL_ID': '-1001512307861',
'IMAGE_URL': 'https://graph.org/file/6b22ef7b8a733c5131d3f.jpg',
'TIMEZONE': 'Asia/Kolkata',
'SEARCH_LIMIT': 0,
'RSS_DELAY': 900}
'RSS_DELAY': 900,
'DEF_ANI_TEMP': '''<b>{ro_title}</b>({na_title})
<b>Format</b>: <code>{format}</code>
<b>Status</b>: <code>{status}</code>
<b>Start Date</b>: <code>{startdate}</code>
<b>End Date</b>: <code>{enddate}</code>
<b>Season</b>: <code>{season}</code>
<b>Country</b>: {country}
<b>Episodes</b>: <code>{episodes}</code>
<b>Duration</b>: <code>{duration}</code>
<b>Average Score</b>: <code>{avgscore}</code>
<b>Genres</b>: {genres}
<b>Hashtag</b>: {hashtag}
<b>Studios</b>: {studios}
<b>Description</b>: <i>{description}</i>''',
'DEF_IMDB_TEMP': '''<b>Title: </b> {title} [{year}]
<b>Also Known As:</b> {aka}
<b>Rating ⭐️:</b> <i>{rating}</i>
<b>Release Info: </b> <a href="{url_releaseinfo}">{release_date}</a>
<b>Genre: </b>{genres}
<b>IMDb URL:</b> {url}
<b>Language: </b>{languages}
<b>Country of Origin : </b> {countries}
<b>Story Line: </b><code>{plot}</code>
<a href="{url_cast}">Read More ...</a>'''}



Expand Down Expand Up @@ -320,7 +347,7 @@ def load_config():

UPDATE_PACKAGES = environ.get('UPDATE_PACKAGES', '')
if len(UPDATE_PACKAGES) == 0:
UPDATE_PACKAGES = False
UPDATE_PACKAGES = 'False'

MIRROR_ENABLED = environ.get('MIRROR_ENABLED', '')
MIRROR_ENABLED = MIRROR_ENABLED.lower() == 'true'
Expand Down Expand Up @@ -487,11 +514,45 @@ def load_config():
if len(CAPTION_FONT) == 0:
CAPTION_FONT = 'code'

DEF_IMDB_TEMP = environ.get('IMDB_TEMPLATE', '')
if len(DEF_IMDB_TEMP) == 0:
DEF_IMDB_TEMP = '''<b>Title: </b> {title} [{year}]
<b>Also Known As:</b> {aka}
<b>Rating ⭐️:</b> <i>{rating}</i>
<b>Release Info: </b> <a href="{url_releaseinfo}">{release_date}</a>
<b>Genre: </b>{genres}
<b>IMDb URL:</b> {url}
<b>Language: </b>{languages}
<b>Country of Origin : </b> {countries}
<b>Story Line: </b><code>{plot}</code>
<a href="{url_cast}">Read More ...</a>'''


DEF_ANI_TEMP = environ.get('ANIME_TEMPLATE', '')
if len(DEF_ANI_TEMP) == 0:
DEF_ANI_TEMP = """<b>{ro_title}</b>({na_title})
<b>Format</b>: <code>{format}</code>
<b>Status</b>: <code>{status}</code>
<b>Start Date</b>: <code>{startdate}</code>
<b>End Date</b>: <code>{enddate}</code>
<b>Season</b>: <code>{season}</code>
<b>Country</b>: {country}
<b>Episodes</b>: <code>{episodes}</code>
<b>Duration</b>: <code>{duration}</code>
<b>Average Score</b>: <code>{avgscore}</code>
<b>Genres</b>: {genres}
<b>Hashtag</b>: {hashtag}
<b>Studios</b>: {studios}
<b>Description</b>: <i>{description}</i>"""

FINISHED_PROGRESS_STR = environ.get('FINISHED_PROGRESS_STR', '')
UN_FINISHED_PROGRESS_STR = environ.get('UN_FINISHED_PROGRESS_STR', '')
if len(FINISHED_PROGRESS_STR) == 0 or len(FINISHED_PROGRESS_STR) == 0:
FINISHED_PROGRESS_STR = '' # '■'
UN_FINISHED_PROGRESS_STR = '' # '□'
FINISHED_PROGRESS_STR = '' # '■'
UN_FINISHED_PROGRESS_STR = '' # '□'

CHANNEL_USERNAME = environ.get('CHANNEL_USERNAME', '')
if len(CHANNEL_USERNAME) == 0:
Expand Down Expand Up @@ -651,6 +712,8 @@ def load_config():
'PIXABAY_SEARCH': PIXABAY_SEARCH,
'NAME_FONT': NAME_FONT,
'CAPTION_FONT': CAPTION_FONT,
'DEF_IMDB_TEMP': DEF_IMDB_TEMP,
'DEF_ANI_TEMP': DEF_ANI_TEMP,
'DISABLE_DRIVE_LINK': DISABLE_DRIVE_LINK,
'SOURCE_LINK': SOURCE_LINK,
'START_BTN1_NAME': START_BTN1_NAME,
Expand Down Expand Up @@ -1026,9 +1089,9 @@ def edit_bot_settings(update, context):
update_buttons(message)
dispatcher.remove_handler(file_handler)
elif data[1] == 'editvar' and STATE == 'edit':
if data[2] in ['SUDO_USERS', 'RSS_USER_SESSION_STRING', 'IGNORE_PENDING_REQUESTS', 'CMD_PERFIX', 'OWNER_ID',
if data[2] in ['SUDO_USERS', 'IGNORE_PENDING_REQUESTS', 'CMD_PERFIX', 'OWNER_ID',
'USER_SESSION_STRING', 'TELEGRAM_HASH', 'TELEGRAM_API', 'AUTHORIZED_CHATS', 'RSS_DELAY'
'DATABASE_URL', 'BOT_TOKEN', 'DOWNLOAD_DIR']:
'DATABASE_URL', 'BOT_TOKEN', 'DOWNLOAD_DIR', 'MIRROR_LOGS', 'LINK_LOGS', 'LEECH_LOG']:
query.answer(text='Restart required for this edit to take effect!', show_alert=True)
else:
query.answer()
Expand Down
4 changes: 3 additions & 1 deletion bot/modules/imdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ def imdb_callback(update, context):
imdb = get_poster(query=data[3], id=True)
buttons = ButtonMaker()
if imdb['trailer']:
buttons.buildbutton("▶️ IMDb Trailer ", imdb['trailer'])
if isinstance(imdb['trailer'], list):
buttons.buildbutton("▶️ IMDb Trailer ", str(imdb['trailer'][-1]))
else: buttons.buildbutton("▶️ IMDb Trailer ", str(imdb['trailer']))
if isinstance(imdb['trailer'], list):
imdb['trailer'] = list_to_str(imdb['trailer'])
buttons.sbutton("🚫 Close 🚫", f"imdb {user_id} close")
Expand Down
36 changes: 34 additions & 2 deletions config_sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ MEGA_LIMIT = ""
TIME_GAP = "-1"

# Progress Strings
FINISHED_PROGRESS_STR = '' # '■'
UN_FINISHED_PROGRESS_STR = '' # '□'
FINISHED_PROGRESS_STR = '' # '■'
UN_FINISHED_PROGRESS_STR = '' # '□'

# THEME
EMOJI_THEME = "" #Default is False
Expand All @@ -151,6 +151,38 @@ PIXABAY_SEARCH = "" # Put Keyword to Download Images from Pixabay.com Limit
NAME_FONT = "" # Default Name of File on Upload message, Available Options : b, code, i, u, strike, spoiler
CAPTION_FONT = "" # Default Caption of Leeched files, Available Options : b, code, i, u, strike, spoiler

#UPDATE PACKAGE
UPDATE_PACKAGES = "" #Default False

#TEMPLATE
DEF_ANI_TEMP = '''<b>{ro_title}</b>({na_title})
<b>Format</b>: <code>{format}</code>
<b>Status</b>: <code>{status}</code>
<b>Start Date</b>: <code>{startdate}</code>
<b>End Date</b>: <code>{enddate}</code>
<b>Season</b>: <code>{season}</code>
<b>Country</b>: {country}
<b>Episodes</b>: <code>{episodes}</code>
<b>Duration</b>: <code>{duration}</code>
<b>Average Score</b>: <code>{avgscore}</code>
<b>Genres</b>: {genres}
<b>Hashtag</b>: {hashtag}
<b>Studios</b>: {studios}

<b>Description</b>: <i>{description}</i>'''

DEF_IMDB_TEMP = '''<b>Title: </b> {title} [{year}]
<b>Also Known As:</b> {aka}
<b>Rating ⭐️:</b> <i>{rating}</i>
<b>Release Info: </b> <a href="{url_releaseinfo}">{release_date}</a>
<b>Genre: </b>{genres}
<b>IMDb URL:</b> {url}
<b>Language: </b>{languages}
<b>Country of Origin : </b> {countries}

<b>Story Line: </b><code>{plot}</code>

<a href="{url_cast}">Read More ...</a>'''

# Buttons
DISABLE_DRIVE_LINK = ""
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dnspython
feedparser
flask
gc-python-utils
git+https://github.com/cinemagoer/cinemagoer
git+https://github.com/SilentDemonSD/cinemagoer
google-api-python-client
google-auth-httplib2
google-auth-oauthlib
Expand Down

0 comments on commit 9e75d87

Please sign in to comment.