Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 797d25b

Browse files
committed
Added player repr
Removed cache.
1 parent b7a78b3 commit 797d25b

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

discordSuperUtils/music/player.py

+3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ def __init__(self, requester: Optional[discord.Member], used_query: str, data):
4949
def __str__(self):
5050
return self.title
5151

52+
def __repr__(self):
53+
return f"<{self.__class__.__name__} requester={self.requester}, title={self.title}, duration={self.duration}>"
54+
5255
@staticmethod
5356
def _get_stream_url(player: dict) -> str:
5457
"""

discordSuperUtils/youtube.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class YoutubeClient:
1313
Represents a Youtube client that fetches music.
1414
"""
1515

16-
__slots__ = ("session", "timeout", "loop", "cache")
16+
__slots__ = ("session", "timeout", "loop")
1717

1818
# This access key is not private, and is used in ALL youtube API requests from the website (from any user).
1919
ACCESS_KEY = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"
@@ -35,7 +35,6 @@ def __init__(
3535
):
3636
self.timeout = timeout
3737
self.loop = loop or asyncio.get_event_loop()
38-
self.cache: Dict[str, dict] = {}
3938
self.session = session or aiohttp.ClientSession(
4039
timeout=aiohttp.ClientTimeout(total=self.timeout, connect=3), loop=self.loop
4140
)
@@ -223,9 +222,6 @@ async def get_videos(
223222
if not video_id:
224223
return []
225224

226-
if cached_info := self.cache.get(video_id):
227-
return cached_info
228-
229225
if len(video_id) == 11: # Video
230226
queries = [
231227
{
@@ -260,6 +256,4 @@ async def get_videos(
260256
except asyncio.exceptions.TimeoutError:
261257
tracks = []
262258

263-
self.cache[video_id] = tracks
264-
265259
return tracks

0 commit comments

Comments
 (0)