Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinSchenkel authored Aug 3, 2024
2 parents ef86cf9 + ae7ee0f commit 4de5ee2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion music_assistant/server/controllers/music.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ async def refresh_item(
ctrl = self.get_controller(media_type)
is_library_item = media_item.provider == "library"

available_providers = get_global_cache_value("unique_providers")
available_providers = get_global_cache_value("provider_instance_ids")
if TYPE_CHECKING:
available_providers = cast(set[str], available_providers)

Expand Down
11 changes: 6 additions & 5 deletions music_assistant/server/providers/ytmusic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@
ProviderFeature.SIMILAR_TRACKS,
)

YT_DLP_CACHE_SECTION = "youtube-oauth2"
YT_DLP_CACHE_KEY = "oauth_token"

# TODO: fix disabled tests
# ruff: noqa: PLW2901, RET504
Expand Down Expand Up @@ -612,6 +610,7 @@ def _parse_album(self, album_obj: dict, album_id: str | None = None) -> Album:
item_id=str(album_id),
provider_domain=self.domain,
provider_instance=self.instance_id,
url=f"{YTM_DOMAIN}/playlist?list={album_id}",
)
},
)
Expand Down Expand Up @@ -692,6 +691,7 @@ def _parse_playlist(self, playlist_obj: dict) -> Playlist:
item_id=playlist_id,
provider_domain=self.domain,
provider_instance=self.instance_id,
url=f"{YTM_DOMAIN}/playlist?list={playlist_id}",
)
},
)
Expand Down Expand Up @@ -720,17 +720,18 @@ def _parse_track(self, track_obj: dict) -> Track:
if not track_obj.get("videoId"):
msg = "Track is missing videoId"
raise InvalidDataError(msg)

track_id = str(track_obj["videoId"])
track = Track(
item_id=track_obj["videoId"],
item_id=track_id,
provider=self.domain,
name=track_obj["title"],
provider_mappings={
ProviderMapping(
item_id=str(track_obj["videoId"]),
item_id=track_id,
provider_domain=self.domain,
provider_instance=self.instance_id,
available=track_obj.get("isAvailable", True),
url=f"{YTM_DOMAIN}/watch?v={track_id}",
audio_format=AudioFormat(
content_type=ContentType.M4A,
),
Expand Down
2 changes: 2 additions & 0 deletions music_assistant/server/providers/ytmusic/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def _get_playlist():
ytm = ytmusicapi.YTMusic(auth=headers, language=language)
playlist = ytm.get_playlist(playlistId=prov_playlist_id, limit=None)
playlist["checksum"] = get_playlist_checksum(playlist)
# Fix missing playlist id in some edge cases
playlist["id"] = prov_playlist_id if not playlist.get("id") else playlist["id"]
return playlist

return await asyncio.to_thread(_get_playlist)
Expand Down
2 changes: 1 addition & 1 deletion music_assistant/server/providers/ytmusic/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "YouTube Music",
"description": "Support for the YouTube Music streaming provider in Music Assistant.",
"codeowners": ["@MarvinSchenkel"],
"requirements": ["ytmusicapi==1.7.5", "yt-dlp-youtube-accesstoken==0.1.1", "yt-dlp==2024.7.9"],
"requirements": ["ytmusicapi==1.8.0", "yt-dlp-youtube-accesstoken==0.1.1", "yt-dlp==2024.7.25"],
"documentation": "https://music-assistant.io/music-providers/youtube-music/",
"multi_instance": true
}
4 changes: 2 additions & 2 deletions requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ soundcloudpy==0.1.0
tidalapi==0.7.6
unidecode==1.3.8
xmltodict==0.13.0
yt-dlp==2024.7.9
yt-dlp==2024.7.25
yt-dlp-youtube-accesstoken==0.1.1
ytmusicapi==1.7.5
ytmusicapi==1.8.0
zeroconf==0.132.2

0 comments on commit 4de5ee2

Please sign in to comment.