diff options
| author | salmonik <raisersoft@proton.me> | 2026-05-20 16:40:28 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-05-20 16:40:28 +0200 |
| commit | bdf93cbc700f6baa55a283300d5bd3d2e958bc69 (patch) | |
| tree | 411459de7a546a6a214344bb1d9eb4e1bafb5405 /cogs | |
| parent | Clean up consumers: replace polling with VoiceManager.play_source() (diff) | |
| download | senator-sperma-bdf93cbc700f6baa55a283300d5bd3d2e958bc69.tar.gz senator-sperma-bdf93cbc700f6baa55a283300d5bd3d2e958bc69.zip | |
Redirect play_commands imports to cogs.voice, remove audio_playback shim
- Update play_commands.py to import get_voice_manager from cogs.voice
instead of going through the audio_playback.py re-export shim
- Delete the audio_playback.py shim file entirely
- Update test_music_audio.py imports to use cogs.voice.VoiceManager
- Delete PLAN_VOICE_REFACTOR.md (plan is complete)
Diffstat (limited to '')
| -rw-r--r-- | cogs/music/audio_playback.py | 10 | ||||
| -rw-r--r-- | cogs/music/play_commands.py | 11 |
2 files changed, 6 insertions, 15 deletions
diff --git a/cogs/music/audio_playback.py b/cogs/music/audio_playback.py deleted file mode 100644 index 5206a96..0000000 --- a/cogs/music/audio_playback.py +++ /dev/null | |||
| @@ -1,10 +0,0 @@ | |||
| 1 | # This file is part of Senator Sperma | ||
| 2 | # Licensed under the GPL-3.0 License | ||
| 3 | # Copyright (C) 2026 Salmonik @ salmonik@tuta.io | ||
| 4 | # https://codeberg.org/salmonik/senator-sperma | ||
| 5 | |||
| 6 | # Re-export shim — all voice utilities now live in cogs.voice.VoiceManager. | ||
| 7 | # Kept so existing imports in play_commands.py and ai.py keep working. | ||
| 8 | # TODO: update importers and remove this file. | ||
| 9 | |||
| 10 | from cogs.voice import VoiceManager as AudioPlaybackManager # noqa: F401 | ||
diff --git a/cogs/music/play_commands.py b/cogs/music/play_commands.py index bdb021d..a90f901 100644 --- a/cogs/music/play_commands.py +++ b/cogs/music/play_commands.py | |||
| @@ -16,10 +16,11 @@ import discord | |||
| 16 | from discord.commands import OptionChoice | 16 | from discord.commands import OptionChoice |
| 17 | from discord.ext import commands | 17 | from discord.ext import commands |
| 18 | 18 | ||
| 19 | from cogs.music import audio_playback, media_processing | 19 | from cogs.music import media_processing |
| 20 | from cogs.utils.file_search import UniversalSearcher | 20 | from cogs.utils.file_search import UniversalSearcher |
| 21 | from cogs.utils.settings import get_uploadurl | 21 | from cogs.utils.settings import get_uploadurl |
| 22 | from cogs.utils.url_helper import clean_url_for_ytdlp | 22 | from cogs.utils.url_helper import clean_url_for_ytdlp |
| 23 | from cogs.voice import get_voice_manager | ||
| 23 | 24 | ||
| 24 | logger = logging.getLogger(__name__) | 25 | logger = logging.getLogger(__name__) |
| 25 | 26 | ||
| @@ -162,7 +163,7 @@ class PlayCommands(commands.Cog): | |||
| 162 | if not compressed_path: | 163 | if not compressed_path: |
| 163 | return | 164 | return |
| 164 | 165 | ||
| 165 | await audio_playback.AudioPlaybackManager.play( | 166 | await get_voice_manager(self.bot).play( |
| 166 | ctx, compressed_path, delete_after_play=True | 167 | ctx, compressed_path, delete_after_play=True |
| 167 | ) | 168 | ) |
| 168 | except Exception as e: | 169 | except Exception as e: |
| @@ -209,7 +210,7 @@ class PlayCommands(commands.Cog): | |||
| 209 | 210 | ||
| 210 | upload_task = asyncio.create_task(self._upload_to_copyparty_async(local_path)) | 211 | upload_task = asyncio.create_task(self._upload_to_copyparty_async(local_path)) |
| 211 | 212 | ||
| 212 | await audio_playback.AudioPlaybackManager.play( | 213 | await get_voice_manager(self.bot).play( |
| 213 | ctx, local_path, delete_after_play=True | 214 | ctx, local_path, delete_after_play=True |
| 214 | ) | 215 | ) |
| 215 | 216 | ||
| @@ -274,7 +275,7 @@ class PlayCommands(commands.Cog): | |||
| 274 | if compressed: | 275 | if compressed: |
| 275 | await self._handle_compressed_file_play(ctx, url) | 276 | await self._handle_compressed_file_play(ctx, url) |
| 276 | else: | 277 | else: |
| 277 | await audio_playback.AudioPlaybackManager.play(ctx, url) | 278 | await get_voice_manager(self.bot).play(ctx, url) |
| 278 | 279 | ||
| 279 | @discord.slash_command(name="grajcuj", description="grajcujmy wszyscy!") | 280 | @discord.slash_command(name="grajcuj", description="grajcujmy wszyscy!") |
| 280 | async def play( | 281 | async def play( |
| @@ -309,7 +310,7 @@ class PlayCommands(commands.Cog): | |||
| 309 | if file: | 310 | if file: |
| 310 | file_path: PathLike[str] | str = os.path.join(self.temp_dir, file.filename) | 311 | file_path: PathLike[str] | str = os.path.join(self.temp_dir, file.filename) |
| 311 | await file.save(file_path) | 312 | await file.save(file_path) |
| 312 | await audio_playback.AudioPlaybackManager.play(ctx, file_path) | 313 | await get_voice_manager(self.bot).play(ctx, file_path) |
| 313 | else: | 314 | else: |
| 314 | try: | 315 | try: |
| 315 | if EXTERNAL_URL_PATTERN.match(melodia.lower()): | 316 | if EXTERNAL_URL_PATTERN.match(melodia.lower()): |
