Giter Site home page Giter Site logo

Comments (3)

simon-weber avatar simon-weber commented on June 8, 2024

You're referring to songs with a store id, right (which is needed for get_track_info)? I don't think there's a good solution: Google just doesn't send that information to mobile clients for whatever reason.

It's possible to retrieve that information from the web client (eg), but because of the auth situation that doesn't really work outside the context of a Chrome Extension.

from gmusicapi.

LuigiSigillo avatar LuigiSigillo commented on June 8, 2024

Hi, probably I have not written clearly what I was asking for. However I have found a solution to my problem:

songs = mc.get_all_songs()
def get_songs_info(id_song):
    for e in songs:
        if e['id'] == id_song:
            return {
                "title": e['title'],
                "artist": e['artist'],
                "album": e['album']
            }

def get_songs_of_playlist(playlist_name):
    playlists = mc.get_all_user_playlist_contents()
    for p in playlists:
        p_dict_list = []
        if playlist_name == p["name"]:
            for track in p['tracks']:
                p_dict_list.append(get_songs_info(track['trackId']))
            return p_dict_list

Maybe it's more clear with the code than with my words, but I'm referring to songs that I have personally uploaded on Google Play Music.
My problem was to find information (title, artist etc.) about the songs contained inside a playlist. To do this I have first downloaded all the songs and then search every time with the trackId present inside the playlist.
My suggestion was to provide not only the trackId but also this other useful information inside a playlist dictionary, but for what I'm understanding now, this is not possible due to some Google policy. So I think this may be a good solution to achieve my purpose, otherwise let me know if there is something to improve in this solution or am I using the client in some wrong way.
Thank you.

from gmusicapi.

simon-weber avatar simon-weber commented on June 8, 2024

Ah, yes, I see what you're getting at. User-uploaded song metadata isn't provided inline in playlist responses; it needs to be looked up from the results of get_all_songs. Presumably Google made the apis this way since their own clients are pretty heavy (they run their own databases and everything).

There's some old discussion of this in #232 (comment). I'm more hesitant to automatically do the matching these days since these kinds of relationships happen in a few places and I'd rather not be inconsistent. Updating the docs to explain the situation would be good, though.

from gmusicapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.