Code Monkey home page Code Monkey logo

genius-lyrics's Introduction

genius-lyrics

Custom component for Home Assistant to fetch song lyrics from Genius by tracking media player entities. Component allows service calls for custom automations.

Installation

With HACS

  1. Open HACS Settings and add this repository (https://github.com/robert-alfaro/genius-lyrics) as a Custom Repository (use Integration as the category).
  2. The Genius Lyrics page should automatically load (or find it in the HACS Store).
  3. Click Install

Manual

Copy the genius_lyrics directory from custom_components in this repository, and place inside your Home Assistant installation's custom_components directory.

Setup

  1. Create a Genius.com access token:

    1. Sign up for a free account at genius.com if you don't have one.
    2. Open the New API Client page and fill in App Name, App Website URL, and Redirect URL (this won't be used).
    3. Once you've saved the new client, click the button to generate a Client Access Token (record this somewhere safe).
  2. Install this integration

  3. Enable Genius Lyrics in configuration.yaml by adding the following (substitute your access token from step 1):

    genius_lyrics:
      access_token: "3SxSxqZJOtz5fYlkFXv-12E-mgripD0XM7v0L091P3Kz22wT9ReCRNg0qmrYeveG"
      entities:
        - media_player.foobar

    The above configuration will create a sensor entity sensor.foobar_lyrics.

  4. Create markdown card in lovelace:

    type: vertical-stack
    cards:
      - type: media-control
        entity: media_player.foobar
      - type: conditional
        conditions:
          - entity: sensor.foobar_lyrics
            state: 'on'
        card:
          type: markdown
          content: >-
            ## {{ states.sensor.foobar_lyrics.attributes.media_artist }} - {{ states.sensor.foobar_lyrics.attributes.media_title }}
    
            {{ states.sensor.foobar_lyrics.attributes.media_lyrics }}

    The above lovelace card groups the media player and lyrics sensor together. The conditional portion will hide the lyrics sensor when the media player is off.

Example service call

JSON
{
 "media_artist":"Protoje",
 "media_title":"Mind of a King",
 "entity_id":"sensor.foobar_lyrics"
}
YAML
media_artist: "Protoje"
media_title: "Mind of a King"
entity_id: sensor.foobar_lyrics

Screenshot

lyrics-card


Thanks to

  • @johnwmillr for lyricsgenius python package!

genius-lyrics's People

Contributors

airdrummingfool avatar robert-alfaro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.