def removeProfile(profileID): token = request.args.get('token') if not token: return make_response("No token query parameter", 404) userID = getUserId(token) if not userID: return make_response("User not found", 404) return removeCaldavCalendar(caldavUser, caldavPassword, userID, profileID);
def insertEvent(profileID): token = request.args.get('token') if not token: return make_response("No token query parameter", 404) userID = getUserId(token) if not userID: return make_response("User not found", 404) return insertCaldavEvent(caldavUser, caldavPassword, userID, profileID,request.json);
def removeUser(): token = request.args.get('token') if not token: return make_response("No token query parameter", 404) userID = getUserId(token) if not userID: return make_response("User not found", 404) return removeCaldavCollection(caldavUser, caldavPassword, userID);
def get(profileID = None, startDateString = None, endDateString = None): token = request.args.get('token') if not token: return make_response("No token query parameter", 404) userID = getUserId(token) if not userID: return make_response("User not found", 404) if startDateString: startDate = parser.parse(startDateString) else: startDate = None if endDateString: endDate = parser.parse(endDateString) else: endDate = None return getCaldavEvents(caldavUser, caldavPassword,userID, profileID, startDate, endDate)
for song in response['items']: songs[song['name']] = song['uri'] return songs def get_user_matched_songs(user_songs, cover_artist_songs): matched_songs = Set([]) for song in user_songs: if (song in cover_artist_songs): matched_songs.add( (cover_artist_songs[song].encode('ascii', 'ignore'))) return matched_songs cover_artist_id = '6MERXsiRbur2oJZFgYRDKz' playlist = '' total_liked_tracks = get_user_data_total_liked_tracks(sp) user_liked_songs = create_song_set(sp, total_liked_tracks) artist_songs = get_artist_songs((get_artist_albums(cover_artist_id))) playlist_songs = Set([]) if (len(user_liked_songs) < len(artist_songs)): playlist_songs = get_user_matched_songs(user_liked_songs, artist_songs) matched_songs = list(playlist_songs) #TODO: Change to loop through the match songs because of the limit sp.user_playlist_add_tracks(getUserId(), playlist, matched_songs) # get_artist_albums(cover_artist_id) #print(create_song_dictionary(sp, total_liked_tracks))