@@ -43,9 +43,10 @@ class Track:
4343 :ivar duration: The duration of the track.
4444 :ivar uri: The track URI. Could be None.
4545 :ivar is_stream: Bool indicating whether the track is a stream.
46+ :ivar thumb: The thumbnail associated with this track. Could be None.
4647 """
4748
48- __slots__ = ('id' , 'info' , 'query' , 'title' , 'ytid' , 'length' , 'duration' , 'uri' , 'is_stream' , 'dead' )
49+ __slots__ = ('id' , 'info' , 'query' , 'title' , 'ytid' , 'length' , 'duration' , 'uri' , 'is_stream' , 'dead' , 'thumb' )
4950
5051 def __init__ (self , id_ , info , query = None ):
5152 self .id = id_
@@ -61,6 +62,11 @@ def __init__(self, id_, info, query=None):
6162 self .is_stream = info .get ('isStream' )
6263 self .dead = False
6364
65+ if self .ytid :
66+ self .thumb = f"https://img.youtube.com/vi/{ self .ytid } /default.jpg"
67+ else :
68+ self .thumb = None
69+
6470 def __str__ (self ):
6571 return self .title
6672
@@ -69,6 +75,18 @@ def is_dead(self):
6975 return self .dead
7076
7177
78+ class TrackPlaylist :
79+ """Track Playlist object.
80+
81+ :ivar data: The raw playlist info data dict.
82+ :ivar tracks: The individual :class:`Track` objects from the playlist.
83+ """
84+
85+ def __init__ (self , data : dict ):
86+ self .data = data
87+ self .tracks = [Track (id_ = track ['track' ], info = track ['info' ]) for track in data ['tracks' ]]
88+
89+
7290class Player :
7391
7492 def __init__ (self , bot : Union [commands .Bot , commands .AutoShardedBot ], guild_id : int , node ):
0 commit comments