From 1359c1c96d0ff09389d47975d0a33db816f76422 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 31 Dec 2024 00:21:41 -0500 Subject: [PATCH] refactor(youtubedl): add __repr__ and __str__ implementations --- youtubedl.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/youtubedl.py b/youtubedl.py index c67dd89..d4aadd6 100644 --- a/youtubedl.py +++ b/youtubedl.py @@ -5,7 +5,6 @@ import disnake import yt_dlp import constants -import utils ytdl = yt_dlp.YoutubeDL(constants.YTDL_OPTIONS) @@ -43,6 +42,12 @@ class YTDLSource(disnake.PCMVolumeTransformer): data=data, ) + def __repr__(self): + return f" duration={self.duration}>" + + def __str__(self): + return self.__repr__() + class QueuedPlayer: def __init__(self): @@ -61,6 +66,12 @@ class QueuedPlayer: def queue_add_front(self, item): self.queue.insert(0, item) + def __repr__(self): + return f"" + + def __str__(self): + return self.__repr__() + class QueuedSong: def __init__(self, player, queuer): @@ -81,6 +92,12 @@ class QueuedSong: del segments[0] return f"{':'.join(f'{s:0>2}' for s in segments)}" + def __repr__(self): + return f"" + + def __str__(self): + return self.__repr__() + def __reload_module__(): global ytdl