Skip to content
This repository has been archived by the owner on Mar 21, 2023. It is now read-only.

Commit

Permalink
fix: #38 improved help menu responsiveness
Browse files Browse the repository at this point in the history
  • Loading branch information
iamtalhaasghar committed Feb 21, 2022
1 parent 4b3ca6d commit 972b4ef
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions mps_youtube/helptext.py
Expand Up @@ -306,8 +306,8 @@ def helptext():
Use {2}clearcache{1} command to clear the cache.
""".format(c.ul, c.w, c.y)),
("new", "New Features", """{0}What's New{1}\n{3}""".format(c.ul, c.w, c.y, get_changelog())),
("tor", "Check Tor Status. NOTE: Use this feature at your own risk. In case of any kind of damage we will not be responsible.", """{0}Tor Status{1}\n{3}""".format(c.ul, c.w, c.y, check_tor()))]
("new", "Check if new version is available", """{0}What's New{1}\n{3}""".format(c.ul, c.w, c.y, "get_changelog()")),
("tor", "Check Tor Status. NOTE: Use this feature at your own risk. In case of any kind of damage we will not be responsible.", """{0}Tor Status{1}\n{3}""".format(c.ul, c.w, c.y, "check_tor()"))]


def get_help(choice):
Expand Down Expand Up @@ -373,8 +373,15 @@ def indent(x):
return out

else:
choice = help_names.index(choice)
return indent(all_help[choice][2])
if choice == 'tor':
output_text = check_tor()
elif choice == 'new':
output_text = get_changelog()
else:
choice = help_names.index(choice)
output_text = all_help[choice][2]

return indent(output_text)

def get_changelog():
try:
Expand All @@ -393,6 +400,6 @@ def check_tor():
status = re.findall('Congratulations.(.*)', v)
if len(status) == 0:
status = re.findall('Sorry.(.*)', v)
return {'ip' : ip, 'status': status[0]}
return str({'ip' : ip, 'status': status[0]})
except (URLError, HTTPError, socket.timeout):
return "read changelog timed out"
return "read check tor status timed out"

0 comments on commit 972b4ef

Please sign in to comment.