Beispiel #1
0
if path.exists(tokenfile):
    token = open(tokenfile).read()
else:
    token = "None"

roonapi = RoonApi(appinfo, token, server)

# get target zone output_id
outputs = roonapi.outputs

output_id = None
for (k, v) in outputs.items():
    if target_zone in v["display_name"]:
        output_id = k

if output_id is None:
    print("No zone found matching", target_zone)
    exit()

# List matching artists
artists = roonapi.list_media(output_id, ["Library", "Artists", searchterm])

if artists:
    print(*artists, sep="\n")
else:
    print("No artists found matching ", searchterm)

# save the token for next time
with open(tokenfile, "w") as f:
    f.write(roonapi.token)
Beispiel #2
0
output_id = None
for (k, v) in outputs.items():
    if target_zone in v["display_name"]:
        output_id = k

if output_id is None:
    print("No zone found matching", target_zone)
    exit()

# Play artist from Library
found = roonapi.play_media(output_id, ["Library", "Artists", artist])

if found:
    print("Found media for artist search term:", artist)
else:
    artists = roonapi.list_media(output_id, ["Library", "Artists", artist])
    if len(artists) == 0:
        print("\nNo artist name partially matching", artist, "\n")
    else:
        print("\nArtist names partially matching", artist, ":\n")
        print(*artists, sep="\n")
        if len(artists) == 1:
            artist = artists[0]
            roonapi.play_media(output_id, ["Library", "Artists", artist])
        else:
            print("\nTo play an artist by name either specify the full name")
            print("or enough of a substring to provide a single match")

# save the token for next time
with open(tokenfile, "w") as f:
    f.write(roonapi.token)
Beispiel #3
0
output_id = None
for (k, v) in outputs.items():
    if target_zone in v["display_name"]:
        output_id = k

if output_id is None:
    print("No zone found matching", target_zone)
    exit()

# Play playlist
found = roonapi.play_media(output_id, ["Playlists", playlist])

if found:
    print("Found media for playlist search term:", playlist)
else:
    playlists = roonapi.list_media(output_id, ["Playlists", playlist])
    if len(playlists) == 0:
        print("\nNo playlist name partially matching", playlist, "\n")
    else:
        print("\nPlaylist titles partially matching", playlist, ":\n")
        print(*playlists, sep="\n")
        if len(playlists) == 1:
            playlist = playlists[0]
            roonapi.play_media(output_id, ["Playlists", playlist])
        else:
            print("\nTo play a playlist by name either specify the full name")
            print("or enough of a substring to provide a single match")

# save the token for next time
with open(tokenfile, "w") as f:
    f.write(roonapi.token)
if path.exists(tokenfile):
    token = open(tokenfile).read()
else:
    token = "None"

roonapi = RoonApi(appinfo, token, server)

# get target zone output_id
outputs = roonapi.outputs

output_id = None
for (k, v) in outputs.items():
    if target_zone in v["display_name"]:
        output_id = k

if output_id is None:
    print("No zone found matching", target_zone)
    exit()

# List matching albums
albums = roonapi.list_media(output_id, ["Library", "Albums", searchterm])

if albums:
    print(*albums, sep="\n")
else:
    print("No albums found matching ", searchterm)

# save the token for next time
with open(tokenfile, "w") as f:
    f.write(roonapi.token)
Beispiel #5
0
roonapi = RoonApi(appinfo, token, server)

# get target zone output_id
outputs = roonapi.outputs

output_id = None
for (k, v) in outputs.items():
    if target_zone in v["display_name"]:
        output_id = k

if output_id is None:
    print("No zone found matching", target_zone)
    exit()

# Play tag (not yet working)
tags = roonapi.list_media(output_id, ["Library", "Tags", tag])
if len(tags) == 0:
    print("\nNo tags matching", tag, "\n")
else:
    print("\nTags matching", tag, ":\n")
    print(*tags, sep="\n")
    if len(tags) == 1:
        tag = tags[0]
        print("\nPlaying media by tag is not yet working. Found tag for", tag,
              "\n")
        # Need to identify the media here, somehow use tag to search for media. How?
        roonapi.play_media(output_id, ["Library", "Tags", tag])
    else:
        print("\nTo play a tag by name either specify the full name")
        print("or enough of a substring to provide a single match")
if path.exists(tokenfile):
    token = open(tokenfile).read()
else:
    token = "None"

roonapi = RoonApi(appinfo, token, server)

# get target zone output_id
outputs = roonapi.outputs

output_id = None
for (k, v) in outputs.items():
    if target_zone in v["display_name"]:
        output_id = k

if output_id is None:
    print("No zone found matching", target_zone)
    exit()

# List matching genres
genres = roonapi.list_media(output_id, ["Genres", searchterm])

if genres:
    print(*genres, sep = "\n")
else:
    print("No genres found matching ", searchterm)

# save the token for next time
with open(tokenfile, "w") as f:
    f.write(roonapi.token)
Beispiel #7
0
output_id = None
for (k, v) in outputs.items():
    if target_zone in v["display_name"]:
        output_id = k

if output_id is None:
    print("No zone found matching", target_zone)
    exit()

# Play genre
found = roonapi.play_media(output_id, ["Genres", genre])

if found:
    print("Found media for genre search term:", genre)
else:
    genres = roonapi.list_media(output_id, ["Genres", genre])
    if len(genres) == 0:
        print("\nNo genre name partially matching", genre, "\n")
    else:
        print("\nGenres partially matching", genre, ":\n")
        print(*genres, sep="\n")
        if len(genres) == 1:
            genre = genres[0]
            roonapi.play_media(output_id, ["Genres", genre])
        else:
            print("\nTo play a genre by name either specify the full name")
            print("or enough of a substring to provide a single match")

# save the token for next time
with open(tokenfile, "w") as f:
    f.write(roonapi.token)
if path.exists(tokenfile):
    token = open(tokenfile).read()
else:
    token = "None"

roonapi = RoonApi(appinfo, token, server)

# get target zone output_id
outputs = roonapi.outputs

output_id = None
for (k, v) in outputs.items():
    if target_zone in v["display_name"]:
        output_id = k

if output_id is None:
    print("No zone found matching", target_zone)
    exit()

# List matching playlists
playlists = roonapi.list_media(output_id, ["Playlists", searchterm])

if playlists:
    print(*playlists, sep="\n")
else:
    print("No playlists found matching ", searchterm)

# save the token for next time
with open(tokenfile, "w") as f:
    f.write(roonapi.token)
if path.exists(tokenfile):
    token = open(tokenfile).read()
else:
    token = "None"

roonapi = RoonApi(appinfo, token, server)

# get target zone output_id
outputs = roonapi.outputs

output_id = None
for (k, v) in outputs.items():
    if target_zone in v["display_name"]:
        output_id = k

if output_id is None:
    print("No zone found matching", target_zone)
    exit()

# List matching tags
tags = roonapi.list_media(output_id, ["Library", "Tags", searchterm])

if tags:
    print(*tags, sep = "\n")
else:
    print("No tags found matching ", searchterm)

# save the token for next time
with open(tokenfile, "w") as f:
    f.write(roonapi.token)
output_id = None
for (k, v) in outputs.items():
    if target_zone in v["display_name"]:
        output_id = k

if output_id is None:
    print("No zone found matching", target_zone)
    exit()

# Play album from Library
found = roonapi.play_media(output_id, ["Library", "Albums", album])

if found:
    print("Found media for album search term:", album)
else:
    albums = roonapi.list_media(output_id, ["Library", "Albums", album])
    if len(albums) == 0:
        print("\nNo album titles partially matching", album, "\n")
    else:
        print("\nAlbum titles partially matching", album, ":\n")
        print(*albums, sep="\n")
        if len(albums) == 1:
            album = albums[0]
            roonapi.play_media(output_id, ["Library", "Albums", album])
        else:
            print("\nTo play an album by name either specify the full name")
            print("or enough of a substring to provide a single match")

# save the token for next time
with open(tokenfile, "w") as f:
    f.write(roonapi.token)