From 68f56e54ef39a9d1322b318b3180cf47ca231eba Mon Sep 17 00:00:00 2001 From: EvieePy Date: Sun, 17 Dec 2023 02:25:40 +1000 Subject: [PATCH 1/2] Add raw_data field to playable. --- wavelink/tracks.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/wavelink/tracks.py b/wavelink/tracks.py index 8638fa2d..8751dcf2 100644 --- a/wavelink/tracks.py +++ b/wavelink/tracks.py @@ -137,6 +137,8 @@ def __init__(self, data: TrackPayload, *, playlist: PlaylistInfo | None = None) self._extras: ExtrasNamespace = ExtrasNamespace(data.get("userData", {})) + self._raw_data = data + def __hash__(self) -> int: return hash(self.encoded) @@ -294,6 +296,29 @@ def extras(self, __value: ExtrasNamespace | dict[str, Any]) -> None: else: self._extras = ExtrasNamespace(__value) + @property + def raw_data(self) -> TrackPayload: + """The raw data for this ``Playable`` received via ``Lavalink``. + + You can use this data to reconstruct this ``Playable`` object. + + + Examples + -------- + + .. code:: python3 + + # For example purposes... + old_data = track.raw_data + + # Later... + track: wavelink.Playable = wavelink.Playable(old_data) + + + .. versionadded:: 3.2.0 + """ + return self._raw_data + @classmethod async def search(cls, query: str, /, *, source: TrackSource | str | None = TrackSource.YouTubeMusic) -> Search: """Search for a list of :class:`~wavelink.Playable` or a :class:`~wavelink.Playlist`, with the given query. From 7c7d82ee21b3e4653f31b79f63aff96aaa658c7d Mon Sep 17 00:00:00 2001 From: EvieePy Date: Sun, 17 Dec 2023 02:26:10 +1000 Subject: [PATCH 2/2] Bump version --- pyproject.toml | 2 +- wavelink/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6531dcae..384ff7bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "wavelink" -version = "3.1.0" +version = "3.2.0" authors = [ { name="PythonistaGuild, EvieePy", email="evieepy@gmail.com" }, ] diff --git a/wavelink/__init__.py b/wavelink/__init__.py index 40cfde86..61e9edb4 100644 --- a/wavelink/__init__.py +++ b/wavelink/__init__.py @@ -25,7 +25,7 @@ __author__ = "PythonistaGuild, EvieePy" __license__ = "MIT" __copyright__ = "Copyright 2019-Present (c) PythonistaGuild, EvieePy" -__version__ = "3.1.0" +__version__ = "3.2.0" from .enums import *