Skip to content

Commit

Permalink
fix remote playlist hashable
Browse files Browse the repository at this point in the history
  • Loading branch information
geo-martino committed Jan 1, 2025
1 parent 1da07f8 commit 3adf320
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/info/release-history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ The format is based on `Keep a Changelog <https://keepachangelog.com/en>`_,
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_


1.2.4
=====

Fixed
-----
* :py:class:`.RemotePlaylist` is now hashable again


1.2.3
=====

Expand Down
4 changes: 4 additions & 0 deletions musify/libraries/remote/core/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class RemoteCollectionLoader[T: RemoteObject](RemoteCollection[T], RemoteItem, m
__slots__ = ()
__attributes_classes__ = (RemoteObject, RemoteCollection)

def __hash__(self):
return hash(self.uri)

def __eq__(self, __collection: RemoteObject | MusifyCollection | Iterable[T]):
if isinstance(__collection, RemoteObject):
return self.uri == __collection.uri
Expand Down Expand Up @@ -122,6 +125,7 @@ class RemotePlaylist[T: RemoteTrack](Playlist[T], RemoteCollectionLoader[T], met
@abstractmethod
def owner_id(self) -> str:
"""The ID of the owner of this playlist"""
self.__eq__()
raise NotImplementedError

@property
Expand Down

0 comments on commit 3adf320

Please sign in to comment.