Exemple #1
0
def queue_song(song_name, artist_name):
    app.logger.debug("Queuing song %s by %s" % (song_name, artist_name))

    if len(queue.song_ids) == 0:
        return statement("You must first play a song")

    # Fetch the song
    song = api.get_song(song_name, artist_name)

    if song is False:
        return statement("Sorry, I couldn't find that song")

    # Queue the track in the list of song_ids
    # queue.enqueue_track(song) //OLD
    if GMusicWrapper.use_library_first():
        song_id = song['id']
    else:
        song_id = song['storeId']
    queue.enqueue_track(song, song_id)

    stream_url = api.get_stream_url(song)
    card_text = "Queued %s by %s." % (song['title'], song['artist'])
    thumbnail = api.get_thumbnail(song)
    return audio().enqueue(stream_url) \
        .standard_card(title=card_text,
                       text='',
                       small_image_url=thumbnail,
                       large_image_url=thumbnail)
Exemple #2
0
def queue_song(song_name, artist_name):
    app.logger.debug("Queuing song %s by %s" % (song_name, artist_name))

    if len(queue.song_ids) == 0:
        return statement("You must first play a song")

    # Fetch the song
    song = api.get_song(song_name, artist_name)

    if song is False:
        return statement("Sorry, I couldn't find that song")

    # Queue the track in the list of song_ids
    queue.enqueue_track(song)
    stream_url = api.get_stream_url(song)
    card_text = "Queued %s by %s." % (song['title'], song['artist'])
    try:
        thumbnail = api.get_thumbnail(song['albumArtRef'][0]['url'])
    except:
        thumbnail = ""
    if (thumbnail==""):
        return audio(speech_text).play(stream_url) \
                                 .standard_card(title=speech_text,
                                                text='',
                                                small_image_url=thumbnail,
                                                large_image_url=thumbnail)
    else:
        return audio(speech_text).play(stream_url) \
         .simple_card(title=speech_text, content='')
Exemple #3
0
def queue_song(song_name, artist_name):
    app.logger.debug("Queuing song %s by %s" % (song_name, artist_name))

    if len(queue.song_ids) == 0:
        return statement(render_template("queue_song_no_song"))

    # Fetch the song
    song = api.get_song(song_name, artist_name)

    if song is False:
        return statement(render_template("no_song"))

    # Queue the track in the list of song_ids
    queue.enqueue_track(song)
    stream_url = api.get_stream_url(song)
    card_text = render_template("queue_song_queued",
                                song=song['title'],
                                artist=song['artist'])
    if "albumArtRef" in queue.current_track():
        thumbnail = api.get_thumbnail(
            queue.current_track()['albumArtRef'][0]['url'])
    else:
        thumbnail = None
    return audio().enqueue(stream_url) \
        .standard_card(title=card_text,
                       text='',
                       small_image_url=thumbnail,
                       large_image_url=thumbnail)
Exemple #4
0
def queue_song(song_name, artist_name):
    app.logger.debug("Queuing song %s by %s" % (song_name, artist_name))

    if len(queue.song_ids) == 0:
        return statement("You must first play a song")

    # Fetch the song
    song = api.get_song(song_name, artist_name)

    if song is False:
        return statement("Sorry, I couldn't find that song")

    # Queue the track in the list of song_ids
    queue.enqueue_track(song)
    stream_url = api.get_stream_url(song)
    return audio().enqueue(stream_url)