Skip to content

Commit

Permalink
fixed playlist tracks json output for LocalLibrary (#107)
Browse files Browse the repository at this point in the history
* add debug print

* add debug print

* apply fix 1

* add default for track get on pl json

* switch to default path for track get on pl json

* remove debug line

* update release history

* remove limiter_deduplication attribute from print output on xautopf

* update release history
  • Loading branch information
geo-martino authored Jun 27, 2024
1 parent f3cdf9e commit aa812cf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions docs/release-history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,19 @@ Added
* ``wait_max`` time to cap wait time between requests for :py:class:`.RequestHandler`
* Add log on :py:class:`.CachedSession` for when either a `cache hit` or a `HTTP request` happens.

Removed
-------
* ``limiter_deduplication`` attribute from print output on :py:class:`.XAutoPF`

Fixed
-----
* Bug in MusicBee XMLLibraryParser which would not read 'Playlists' keys.
* Moved 'check api' logic later when deleting playlists in :py:class:`.RemoteItemChecker`
to ensure API is not checked on close when checker has not actually run.
* :py:class:`.RequestHandler` now also handles bad responses even if response is OK.
* :py:class:`.RequestHandler` now handles wait and backoff logic asynchronously.
* Tracks on playlists from the JSON output of :py:class:`.LocalLibrary` now display correctly.
Previously showed 'null' for every track.


1.0.1
Expand Down
6 changes: 3 additions & 3 deletions musify/libraries/local/library/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ async def load_playlists(self) -> None:
# WARNING: making this run asynchronously will break tqdm; bar will get stuck after 1-2 ticks
bar = self.logger.get_synchronous_iterator(
self._playlist_paths.values(),
desc="Loading tracks",
unit="tracks",
desc="Loading playlists",
unit="playlists",
total=len(self._playlist_paths)
)
self._playlists = {
Expand Down Expand Up @@ -475,7 +475,7 @@ def _get_playlist_json(pl: LocalPlaylist) -> tuple[str, dict[str, Any]]:
pl_attributes["tracks"] = []

pl_json = pl._to_json(pl_attributes, pool=True)
pl_json["tracks"] = [tracks.get(track.path) for track in pl]
pl_json["tracks"] = [tracks.get(str(track.path), str(track.path)) for track in pl]

return pl.name, pl_json

Expand Down
1 change: 1 addition & 0 deletions musify/libraries/local/playlist/xautopf.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class XAutoPF(LocalPlaylist[AutoMatcher]):
"""

__slots__ = ("_parser", "_limiter_deduplication")
__attributes_ignore__ = ("limiter_deduplication",)

valid_extensions = frozenset({".xautopf"})

Expand Down

0 comments on commit aa812cf

Please sign in to comment.