Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for latest gmusicapi #8

Open
aonic opened this issue Nov 28, 2016 · 2 comments
Open

Fixes for latest gmusicapi #8

aonic opened this issue Nov 28, 2016 · 2 comments

Comments

@aonic
Copy link

aonic commented Nov 28, 2016

Here are the changes needed to make this compatible with the latest gmusicapi

diff --git a/gmusicimport.py b/gmusicimport.py
index b3bccd0..057fd1d 100755
--- a/gmusicimport.py
+++ b/gmusicimport.py
@@ -35,7 +35,7 @@ if __name__ == "__main__":
     args = parser.parse_args()
     print("Logging in as \"%s\" to Google Play Music" % args.username)
     pw = getpass.getpass()
-    if not client.login(args.username, pw):
+    if not client.login(args.username, pw, Mobileclient.FROM_MAC_ADDRESS):
         print("Authentication failed. Please check the provided credentials.")
     with open(args.source) as f:
         data = json.load(f)
@@ -48,14 +48,15 @@ if __name__ == "__main__":
             print("Importing %s" % playlist["title"])
         toimport = []
         for track in playlist["tracks"]:
-            query = "%s %s" % (track["title"], track["artist"])
-            results = client.search_all_access(query)
+            query = "%s %s" % (track["title"].replace('Album Version', ''), track["artist"])
+            results = client.search(query)
             match = None
             if args.verbose:
                 print("Fetching matches for %s" % query)
             for hit_i, hit in enumerate(results["song_hits"]):
                 if hit_i >= 10:
                     break
+                hit['score'] = 1000.0 # new API doesnt return score
                 if args.verbose and hit_i < 10:
                     print("Hit %d, scoring %.02f: %s by %s in %s" %
                             (hit_i + 1,

@iXce
Copy link
Owner

iXce commented Nov 28, 2016

mind doing a PR ? :)

@aonic
Copy link
Author

aonic commented Dec 5, 2016

Fine! :) give me a day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants