Skip to content

Language Interpretation and Recognition Interface: LIRI is a command line node.js app that takes in parameters and gives you back data

License

Notifications You must be signed in to change notification settings

sajeelmalik/LIRI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LIRI-Bot

Language Interpretation and Recognition Interface: LIRI is a command line node.js app that takes in parameters and gives you back data.

  • Powered by Javascript and node.js, including npm request, node-spotify-api, moment, and dotenv!

Getting Started and Prerequisites

Follow the instructions below to browse the application.

  • Download node.js to properly utilize this application!
  • Clone down this repository to your local desktop. All dependencies have been fulfilled.
  • Once downloaded, head to your terminal and direct yourself to the location of the LIRI directory.
  • Type in node liri to run the program and see a list of commands! See preview below

Preview of LIRI

LIRI Preview

The application has been authorized by Spotify!

LIRI Spotify Authorization

Technology Used

  • Javascript - the primary scripting logic powering the game
  • node.js - a versatile Javascript runtime environment that processes user inputs in terminal
  • Moment.js - a date-time Javascript library to enable ease of time manipulation

Node Packages Utilized

  1. Spotify API - require("node-spotify-api");
  2. Request - require("request");
  3. Chalk - require("chalk");

Code Snippets

Explanation

//import keys.js and node-spotify-api so that we can access the spotify export
var keys = require("./keys.js");
var Spotify = require('node-spotify-api');

var spotify = new Spotify(keys.spotify);

function spotifySearch(){

  if(searchTerm){

    spotify.search({ type: 'track', query: searchTerm }, function(err, data) {
      if (err) {
        return console.log('Error occurred: ' + err);
      }
   
      // console.log(data.tracks.items[0]); 

      console.log("Artist: " + data.tracks.items[0].artists[0].name);
      console.log("Song Name: " + data.tracks.items[0].name);
      console.log("Spotify Preview Link: " + data.tracks.items[0].external_urls.spotify);
      console.log("Album: " + data.tracks.items[0].album.name);
    });
  }
  else{
    spotify.search({ type: 'track', query: "The Sign by Ace of Base" }, function(err, data) {
      if (err) {
        return console.log('Error occurred: ' + err);
      }
     
      console.log(data.tracks.items[0]); 
      });
  }
  
  
}

Learning points

  • node.js proved to be a powerful tool to divvy requests and inquiries that fit the user's needs. For the future, it may be useful to spend time researching node's capabilities and more effective debugging methods
  • Moment JS allows developers to interact more fluidly with a generally difficult-to-deal-with user input - time

Developers

  • Sajeel Malik - Initial work - GitHub

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

Language Interpretation and Recognition Interface: LIRI is a command line node.js app that takes in parameters and gives you back data

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published