Remove All Ads from XDA

Create playlist based on Thumbs Up playlist??

19 posts
Thanks Meter: 6
By agalenko, Junior Member on 25th June 2014, 04:47 AM
Post Reply Email Thread
Is it possible to somehow create a playlist with 1000 songs randomly chosen from Thumbs Up playlist in Goole Music web app or Android app? I currently have over 5000 songs in that playlist. Choosing them manually is kinda painful. I need it, so I could store some music locally on my device while traveling. Thanks!
26th June 2014, 06:05 AM |#2  
OP Junior Member
Thanks Meter: 6
Found a way!!!! There is a python project that allows you to manipulate google music. Simon Weber you are the man!


So just installed the PIP, then API and then wrote a python script to create a random playlist. Here is the code:

from gmusicapi import Mobileclient
import random

#connect to Goole Music
api = Mobileclient()
#set here your login
logged_in = api.login('', 'app specific password')
print(logged_in) #TRUE means connection was successfull

#get thumbs up songs from all access
liked_tracks = api.get_thumbs_up_songs()
#add rated music from your library to liked_tracks
all_tracks = api.get_all_songs(False, False)
for song in all_tracks:
    if song.has_key('rating'):
        rating = song['rating']
        if (float(rating)>3):

#sample 850 random songs from liked_tracks
length = 850
random_liked_tracks = random.sample(liked_tracks, int(length))

#for a list of track ids used to create new playlist
for track in random_liked_tracks:
    #sometimes track identified with id and sometimes nid
    if (track.has_key('id')):
    elif (track.has_key('nid')):  

#create new playlist with randomly selected tracks
#note after each run new playlist with same name will be created        
playlist_id = api.create_playlist('Random Thumbs Up')
api.add_songs_to_playlist(playlist_id, random_track_ids)
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes