Naval Pilgrim's Mayflower
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    liri-clipublic

    LIRI (Language Interpretation and Recognition Interface)

    LIRI is a command line Node application that takes in parameters (via command line arguments or file input) to display tweets, songs from Spotify, and movie information from OMDB.


    NPM

    npm version npm GitHub last commit

    Table of Contents


    LIRI Commands

    node ./liri [movie, spotify, tweets, do] <value> (--say)

    Command Value Options Example Description
    movie "movie title" --say node liri "Blade Runner 2049" --say Display movie information from OMDB. If host environment is macOS/Darwin, the --say flag will convert the plot text to audible speech.
    spotify "song title" - node liri "Thriller" Display song information from Spotify. The default song is "The Sign" if no value is entered via the command line.
    tweets twitter handle - node liri "jeffreylowy" Display 20 tweets from Twitter. The default account is @barackobama if no value is entered via the command line.
    do-what-it-says - - node liri do-what-it-says Run whatever command and value are saved to the random.txt stored in the commands directory

    You can also run via npm scripts.

    npm run [movie, spotify, tweets, do] <value>

    --say currently does not work when run via npm script.

    API Keys

    Rather than include a keys.js file, I used the dotenv package to create environment variables. The .env file is the first file required in ./liri.js, which stores environment-specific variables in the form of NAME=VALUE.

    Replace XXXXXX with the key/secret/token for each service.

    OMDB_API_KEY=XXXXX
    SPOTIFY_CLIENT_ID=XXXXX
    SPOTIFY_CLIENT_SECRET=XXXXX
    TWITTER_CONSUMER_KEY=XXXXX
    TWITTER_CONSUMER_SECRET=XXXXX
    TWITTER_ACCESS_TOKEN_KEY=XXXXX
    TWITTER_ACCESS_TOKEN_SECRET=XXXXX
    

    process.env now has the keys and values defined in the .env file

    // Line 16 in ./commands/twitter.js
    let twitter = new Twitter({
        consumer_key: process.env.TWITTER_CONSUMER_KEY,
        consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
        access_token_key: process.env.TWITTER_ACCESS_TOKEN_KEY,
        access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET
    });

    For more information, visit the NPM page for the dotenv package.

    Make LIRI speak

    If Node is running on macOS/Darwin, you can make LIRI read movie plot information by passing the --say flag after the movie's title. This only works when the full command is entered.

    Example: node ./liri movie "Blade Runner 2049" --say

    Install and run via NPM

    This project was uploaded to NPM under the package name liri-cli. Though I hope to get there, the package is not yet ready to be installed globally.

    Install: npm i liri-cli

    --say currently does not work when run via npm script.

    Resources

    Node docs: child_process.spawn

    MDN: Number.prototype.toLocaleString()

    MDN: async function

    Carbon: Source code images

    David Walsh: Git Undo

    codeburst.io: Array.find & Array.findIndex

    Keywords

    none

    install

    npm i liri-cli

    Downloadsweekly downloads

    15

    version

    1.0.1

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar