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

Commit dcd61d7

Browse files
authored
Merge pull request #264 from PythonistaGuild/feature/playable-rawdata
Feature/playable rawdata
2 parents 5f926ea + 7c7d82e commit dcd61d7

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "wavelink"
7-
version = "3.1.0"
7+
version = "3.2.0"
88
authors = [
99
{ name="PythonistaGuild, EvieePy", email="[email protected]" },
1010
]

wavelink/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
__author__ = "PythonistaGuild, EvieePy"
2626
__license__ = "MIT"
2727
__copyright__ = "Copyright 2019-Present (c) PythonistaGuild, EvieePy"
28-
__version__ = "3.1.0"
28+
__version__ = "3.2.0"
2929

3030

3131
from .enums import *

wavelink/tracks.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ def __init__(self, data: TrackPayload, *, playlist: PlaylistInfo | None = None)
137137

138138
self._extras: ExtrasNamespace = ExtrasNamespace(data.get("userData", {}))
139139

140+
self._raw_data = data
141+
140142
def __hash__(self) -> int:
141143
return hash(self.encoded)
142144

@@ -294,6 +296,29 @@ def extras(self, __value: ExtrasNamespace | dict[str, Any]) -> None:
294296
else:
295297
self._extras = ExtrasNamespace(__value)
296298

299+
@property
300+
def raw_data(self) -> TrackPayload:
301+
"""The raw data for this ``Playable`` received via ``Lavalink``.
302+
303+
You can use this data to reconstruct this ``Playable`` object.
304+
305+
306+
Examples
307+
--------
308+
309+
.. code:: python3
310+
311+
# For example purposes...
312+
old_data = track.raw_data
313+
314+
# Later...
315+
track: wavelink.Playable = wavelink.Playable(old_data)
316+
317+
318+
.. versionadded:: 3.2.0
319+
"""
320+
return self._raw_data
321+
297322
@classmethod
298323
async def search(cls, query: str, /, *, source: TrackSource | str | None = TrackSource.YouTubeMusic) -> Search:
299324
"""Search for a list of :class:`~wavelink.Playable` or a :class:`~wavelink.Playlist`, with the given query.

0 commit comments

Comments
 (0)