Giter Club home page Giter Club logo

liri_bot's Introduction

LIRI_Bot

Language Interpretation and Recognition Interface

LIRI is a Node-based app which when run will inquire via terminal what the user would like to search for, then responds with data about the chosen input. It utilizes three API's to print information (to both the terminal and to the given file named output.txt) about the user's input. These API's are:

• BandsInTown - Searches live shows and tour dates by band name
• Spotify - Searches music by song or artist name
• OMDB - Searches movies by title
# An Example #

When a user runs 'node liri.js' in their terminal, LIRI will inquire What would you like to search? The user is given three options: Songs, Bands, and Movies, and is able to select any combination of the three.

Provided at least one is chosen, the user is then prompted for a search. They may type anything in this field. If their query is matched by any of the chosen search options, data is then printed to the console and to the output.txt file.

So if a user selects Movies, then searches '8 Mile,' they will receive data about the film including Genre, Ratings, and a short Plot Summary.

+ Resources Used +
Inquirer - For Querying users for input
Moment - To reformat dates
AXIOS - For handling API objects
File System (fs) - To print to 'output.txt'
dotenv - Storing configuration in the environment separate from code
The aformentioned API's for data
! The Code !

To Properly use this application, you will have to use your own Spotify API information. You can do this by creating your own .env file, and filling in your own Spotify information, like this:

# Spotify API keys

SPOTIFY_ID=your-spotify-id
SPOTIFY_SECRET=your-spotify-secret

Alternatively, you can simply replace your spotify keys within liri.js, like this:

var spotify = new Spotify({
  id: <your spotify client id>,
  secret: <your spotify client secret>
});

However, your spotify client id and client secret will not be secure. More info on the Spotify API node package can be found here: https://www.npmjs.com/package/node-spotify-api

If you would like to add more search parameters, you will need to utilize inquirer.prompt, and make additions to inquiries in liri.js within the inquirer prompt, shown below:

inquirer.prompt([

    {
      type: "checkbox",
      name: "category",
      message: "What would you like to search: ",
      choices: [
          "Songs", "Bands", "Movies"
        ]
    },
    
    {
      type: "input",
      name: "search",
      message: "Your search: "
    }
  
  ]).then(function(reply) {///Do something
  ...}

You may also want to change how/where the data is logged or printed to using File System. Below is a sample of the console-logged data and the output.txt printed data, which is appended asynchronously using fs.appendFile. More information on fs can be found here: https://nodejs.org/api/fs.html

    console.log(
        "Lineup: " + bandData[i].lineup.join(",").replace(",", ", ") +
        "\nVenue: " + bandData[i].venue.name + //give venue name and location
        "\nLocation: " + bandData[i].venue.city + ", " + bandData[i].venue.region +
        "\nDate: " + moment(bandData[i].datetime).format('MMMM Do YYYY, h:mm') + //give date of event, reformatted
        "\n====================="
    ); //Display to console and append onto a .txt file
    fs.appendFile("output.txt", "\nLineup: " + bandData[i].lineup.join(",").replace(",", ", ") +
        "\nVenue: " + bandData[i].venue.name + //give venue name and location
        "\nLocation: " + bandData[i].venue.city + ", " + bandData[i].venue.region +
        "\nDate: " + moment(bandData[i].datetime).format('MMMM Do YYYY, h:mm') + //give date of event, reformatted
        "\n=====================", function(err) {

        // If the code experiences any errors it will log the error to the console.
        if (err) {
            return console.log(err);
        }
    });
- Enjoy LIRI, and have fun coding! -

liri_bot's People

Contributors

wsatchmo avatar

Watchers

 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.