Skip to content

Commit

Permalink
Merge pull request #12 from j-jacobson/userlib_updates
Browse files Browse the repository at this point in the history
Added flags to user albums grab. Added get album by UPC
  • Loading branch information
j-jacobson authored Aug 27, 2023
2 parents 89147d2 + c051739 commit 54fd116
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions applemusicpy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,19 @@ def albums(self, album_ids, storefront='us', l=None, include=None):
"""
return self._get_multiple_resources(album_ids, 'albums', storefront=storefront, l=l, include=include)

def albums_by_upc(self, album_upcs, storefront='us', l=None, include=None):
"""
Get all catalog album data associated with the UPCs provided
:param album_upcs: a list of album UPCs
:param storefront: Apple Music store front
:param l: The localization to use, specified by a language tag. Check API documentation.
:param include: Additional relationships to include in the fetch. Check API documentation.
:return: A list of catalog album data in JSON format
"""
return self._get_resource_by_filter(filter_type='upc', filter_list=album_upcs, resource_type='albums', storefront=storefront, l=l, include=include)

def music_video(self, music_video_id, storefront='us', l=None, include=None):
"""
Get a catalog Music Video by ID
Expand Down Expand Up @@ -895,13 +908,13 @@ def current_user_playlists(self, limit=10, offset=0):
url = self.root + 'me/library/playlists'
return self._user_get(url, limit=limit, offset=offset)

def current_user_saved_albums(self, limit=10, offset=0):
def current_user_saved_albums(self, limit=10, offset=0, extend=None, include=None):
"""
Retrieve saved albums of the current user in Apple Music.
:return: Saved albums data in JSON format.
"""
url = self.root + 'me/library/albums'
return self._user_get(url, limit=limit, offset=offset)
return self._user_get(url, limit=limit, offset=offset, extend=extend, include=include)

def current_user_followed_artists(self, limit=10, offset=0):
"""
Expand Down

0 comments on commit 54fd116

Please sign in to comment.