aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/music/media_processing.py
diff options
context:
space:
mode:
authorsalmonik <raisersoft@proton.me>2026-04-18 00:24:50 +0200
committersalmonik <raisersoft@proton.me>2026-04-18 00:24:50 +0200
commita2b5b10625126b7e98643af9fe40569c9e004047 (patch)
tree2b59a929d068bc28bbc21e8c8d8836e4d29270c0 /cogs/music/media_processing.py
parentadd mathematical plotting (diff)
downloadsenator-sperma-a2b5b10625126b7e98643af9fe40569c9e004047.tar.gz
senator-sperma-a2b5b10625126b7e98643af9fe40569c9e004047.zip
refactor + preparing bot for public use
Signed-off-by: salmonik <raisersoft@proton.me>
Diffstat (limited to '')
-rw-r--r--cogs/music/media_processing.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/cogs/music/media_processing.py b/cogs/music/media_processing.py
index e04911c..b9b814c 100644
--- a/cogs/music/media_processing.py
+++ b/cogs/music/media_processing.py
@@ -19,9 +19,9 @@ class MediaDownloader:
19 @staticmethod 19 @staticmethod
20 async def download(ctx, url): 20 async def download(ctx, url):
21 """Download audio from YouTube URL.""" 21 """Download audio from YouTube URL."""
22 # Create temp directory if it doesn't exist 22 from cogs.utils.temp import get_temp_dir
23 temp_dir = os.path.join("cogs", "temp", "music") 23
24 os.makedirs(temp_dir, exist_ok=True) 24 temp_dir = get_temp_dir("senator_sperma_music")
25 25
26 ytdl_opts = { 26 ytdl_opts = {
27 "outtmpl": os.path.join(temp_dir, "%(title)s.%(ext)s"), 27 "outtmpl": os.path.join(temp_dir, "%(title)s.%(ext)s"),
@@ -69,17 +69,13 @@ class AudioCompressor:
69 @staticmethod 69 @staticmethod
70 async def compress(ctx, filename): 70 async def compress(ctx, filename):
71 """Compress audio file to opus format.""" 71 """Compress audio file to opus format."""
72 from cogs.utils.temp import get_temp_dir
73
72 if not filename: 74 if not filename:
73 await ctx.respond("dzie wideło", ephemeral=True) 75 await ctx.respond("dzie wideło", ephemeral=True)
74 return None 76 return None
75 77
76 # Create temp directory if it doesn't exist 78 temp_dir = get_temp_dir("senator_sperma_compressed")
77 temp_dir = os.path.join(
78 os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
79 "temp",
80 "compressed",
81 )
82 os.makedirs(temp_dir, exist_ok=True)
83 79
84 # Create a temporary output filename in the temp directory 80 # Create a temporary output filename in the temp directory
85 base_name = os.path.basename(filename) 81 base_name = os.path.basename(filename)