Verbosity fix V1.0.7
This commit is contained in:
+3
-2
@@ -16,9 +16,10 @@ class Simp(commands.Cog):
|
|||||||
if result['status'] == 'error':
|
if result['status'] == 'error':
|
||||||
await ctx.respond(f'Błąd pobierania: {result["message"]}')
|
await ctx.respond(f'Błąd pobierania: {result["message"]}')
|
||||||
return
|
return
|
||||||
print(f'Wysyłanie "{result["title"]}" na kanał {ctx.channel.name} ({ctx.guild.name})')
|
|
||||||
|
print(f'Wysyłanie \"{result["title"]}\" na kanał {ctx.channel.name} ({ctx.guild.name})')
|
||||||
await ctx.respond(file=discord.File(result['filename']))
|
await ctx.respond(file=discord.File(result['filename']))
|
||||||
print(f'Wysyłano "{result["title"]}" na kanał {ctx.channel.name} ({ctx.guild.name})')
|
print(f'Wysyłano \"{result["title"]}\" na kanał {ctx.channel.name} ({ctx.guild.name})')
|
||||||
|
|
||||||
|
|
||||||
def setup(bot: discord.Bot):
|
def setup(bot: discord.Bot):
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import hashlib
|
|||||||
def rotate_downloads(downloads_dir: str):
|
def rotate_downloads(downloads_dir: str):
|
||||||
MAX_FILES = os.getenv('MAX_FILES')
|
MAX_FILES = os.getenv('MAX_FILES')
|
||||||
if not MAX_FILES.isnumeric():
|
if not MAX_FILES.isnumeric():
|
||||||
return {'status': 'error', 'message': f'MAX_FILES: {MAX_FILES} - nie jest cyfrą.'}
|
return {'status': 'error', 'message': f'MAX_FILES: \"{MAX_FILES}\" - nie jest cyfrą.'}
|
||||||
|
|
||||||
MAX_FILES = int(MAX_FILES)
|
MAX_FILES = int(MAX_FILES)
|
||||||
files = [
|
files = [
|
||||||
@@ -20,13 +20,13 @@ def rotate_downloads(downloads_dir: str):
|
|||||||
to_delete = files[:len(files) - MAX_FILES + 1]
|
to_delete = files[:len(files) - MAX_FILES + 1]
|
||||||
for f in to_delete:
|
for f in to_delete:
|
||||||
os.remove(f)
|
os.remove(f)
|
||||||
print(f'Usunięto stary plik: {os.path.basename(f)}')
|
print(f'Usunięto stary plik: \"{os.path.basename(f)}\"')
|
||||||
|
|
||||||
|
|
||||||
def download_video(yt_url: str) -> dict:
|
def download_video(yt_url: str) -> dict:
|
||||||
MAX_DUR = os.getenv('MAX_DURATION')
|
MAX_DUR = os.getenv('MAX_DURATION')
|
||||||
if not MAX_DUR.isnumeric():
|
if not MAX_DUR.isnumeric():
|
||||||
return {'status': 'error', 'message': f'MAX_DUR: {MAX_DUR} - nie jest cyfrą.'}
|
return {'status': 'error', 'message': f'MAX_DUR: \"{MAX_DUR}\" - nie jest cyfrą.'}
|
||||||
|
|
||||||
MAX_DUR = int(MAX_DUR)
|
MAX_DUR = int(MAX_DUR)
|
||||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
@@ -35,7 +35,7 @@ def download_video(yt_url: str) -> dict:
|
|||||||
|
|
||||||
with yt_dlp.YoutubeDL({'quiet': True}) as ydl:
|
with yt_dlp.YoutubeDL({'quiet': True}) as ydl:
|
||||||
try:
|
try:
|
||||||
print(f'Pobieranie "{yt_url}"')
|
print(f'Pobieranie \"{yt_url}\"')
|
||||||
info = ydl.extract_info(yt_url, download=False)
|
info = ydl.extract_info(yt_url, download=False)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'Nie można pobrać metadanych: {e}')
|
print(f'Nie można pobrać metadanych: {e}')
|
||||||
@@ -63,7 +63,7 @@ def download_video(yt_url: str) -> dict:
|
|||||||
try:
|
try:
|
||||||
info = ydl.extract_info(yt_url, download=True)
|
info = ydl.extract_info(yt_url, download=True)
|
||||||
filename = ydl.prepare_filename(info)
|
filename = ydl.prepare_filename(info)
|
||||||
print(f'Pobrano "{info.get('title')}" ({yt_url})')
|
print(f'Pobrano \"{info.get('title')}\" ({yt_url})')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'Błąd pobierania: {e}')
|
print(f'Błąd pobierania: {e}')
|
||||||
return {'status': 'error', 'message': f'Błąd pobierania: {e}'}
|
return {'status': 'error', 'message': f'Błąd pobierania: {e}'}
|
||||||
|
|||||||
Reference in New Issue
Block a user