Last active
November 27, 2019 21:57
-
-
Save simon-weber/5007769 to your computer and use it in GitHub Desktop.
approximations of Google Music auto playlists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from operator import itemgetter | |
from gmusicapi import Api | |
api = Api() | |
api.login('[email protected]', 'my-password') | |
# => True | |
lib = api.get_all_songs() | |
# This assumes you're using thumbs up/down. | |
# Change this to, eg, t['rating'] > 3 if you're using 5-star ratings. | |
thumbs_up = [t for t in lib if t['rating'] == 5] | |
# This doesn't completely match Google's calculation, but it's certainly a valid interpretation. | |
# It only seems to differ slightly. | |
last_added = sorted(lib, key=itemgetter('creationDate'), reverse=True) | |
free_and_purchased = [t for t in lib if t['type'] == 1] | |
# Shared with me and Google Play recommends are calculated on the server, but I | |
# haven't implemented those calls yet. |
will api.get_all_songs get songs that you've thumbsed up but aren't in your library?
will api.get_all_songs get songs that you've thumbsed up but aren't in your library?
Unfortunately, no. Here's the issue to follow for that: simon-weber/gmusicapi#182.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ahh.. type == 1 that is what I was missing
Thanks