Example #1
0
def group():
    household_id = active_household_store.get_active_household()
    result = control.get_groups(household_id)["groups"]
    group_names = [group["name"] for group in result]

    index = show_prompt("Which group do you want to use", group_names)
    if index != -1:
        selected_group = result[index]
        active_group_store.save_active_group(selected_group["id"])
        click.echo(f'Selected group: {selected_group["name"]}')
    else:
        click.echo("Index out of range.")
Example #2
0
 def playlist(self, playlist_id):
     household_id = active_household_store.get_active_household()
     response = control.client.post(control._url(f'/households/{household_id}/playlists/getPlaylist'), json={"playlistId": int(playlist_id)})
     result = control._json(response)
     return result
Example #3
0
 def playlists(self):
     household_id = active_household_store.get_active_household()
     response = control.client.get(control._url(f'/households/{household_id}/playlists'))
     result = control._json(response)
     return result['playlists']
Example #4
0
 def favorites(self):
     household_id = active_household_store.get_active_household()
     response = control.client.get(control._url(f'/households/{household_id}/favorites'))
     result = control._json(response)
     return result['items']
Example #5
0
def tracks(playlist_id):
    household_id = active_household_store.get_active_household()
    result = control.get_tracks(household_id, playlist_id)
    return result["tracks"]
Example #6
0
def playlists():
    household_id = active_household_store.get_active_household()
    result = control.get_playlists(household_id)
    return result["playlists"]
Example #7
0
def groups():
    household_id = active_household_store.get_active_household()
    result = control.get_groups(household_id)
    return result["groups"]