mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
Fix step ep 01 02 10 11 for only < 9
This commit is contained in:
parent
49a8826142
commit
a485b3feb4
@ -17,22 +17,21 @@ MAP_EPISODE = config_manager.get('DEFAULT', 'map_episode_name')
|
|||||||
|
|
||||||
def dynamic_format_number(n: int) -> str:
|
def dynamic_format_number(n: int) -> str:
|
||||||
"""
|
"""
|
||||||
Formats a number by adding a leading zero.
|
Formats a number by adding a leading zero if it is less than 9.
|
||||||
The width of the resulting string is dynamic, calculated as the number of digits in the number plus one.
|
The width of the resulting string is dynamic, calculated as the number of digits in the number plus one
|
||||||
|
for numbers less than 9, otherwise the width remains the same.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
- n (int): The number to format.
|
- n (int): The number to format.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
- str: The formatted number as a string with a leading zero.
|
- str: The formatted number as a string with a leading zero if the number is less than 9.
|
||||||
|
|
||||||
Examples:
|
|
||||||
>>> dynamic_format_number(1)
|
|
||||||
'01'
|
|
||||||
>>> dynamic_format_number(20)
|
|
||||||
'020'
|
|
||||||
"""
|
"""
|
||||||
|
if n < 9:
|
||||||
width = len(str(n)) + 1
|
width = len(str(n)) + 1
|
||||||
|
else:
|
||||||
|
width = len(str(n))
|
||||||
|
|
||||||
return str(n).zfill(width)
|
return str(n).zfill(width)
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ def MP4_downloader(url: str, path: str, referer: str = None):
|
|||||||
- referer (str): The referer header value to include in the HTTP request headers.
|
- referer (str): The referer header value to include in the HTTP request headers.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if "http" not in url or "https" not in url:
|
if "http" not in str(url).lower().strip() or "https" not in str(url).lower().strip():
|
||||||
logging.error(f"Invalid url: {url}")
|
logging.error(f"Invalid url: {url}")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
@ -43,7 +43,8 @@ class TOR_downloader:
|
|||||||
- username (str): Username for logging into qBittorrent.
|
- username (str): Username for logging into qBittorrent.
|
||||||
- password (str): Password for logging into qBittorrent.
|
- password (str): Password for logging into qBittorrent.
|
||||||
"""
|
"""
|
||||||
self.qb = Client(f'http://{HOST}:{PORT}/')
|
try: self.qb = Client(f'http://{HOST}:{PORT}/')
|
||||||
|
except: logging.error("Start qbitorrent first.")
|
||||||
self.username = USERNAME
|
self.username = USERNAME
|
||||||
self.password = PASSWORD
|
self.password = PASSWORD
|
||||||
self.logged_in = False
|
self.logged_in = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user