LIRI is a Language Interpretation and Recognition Interface. LIRI will be a command line node app that takes in parameters and gives you back data.
In this project we focused on using Node.js in the command line and taking parameters (process.argv)to call a function and display output to the console.
- When running Node with following strings, Node takes the strings as an array, with spaces as the separator.
- The first item in the array is the Node.exe path
- Second item is the current directory
- The LIRI app takes the third item of the array for the command, while the rest are used as arguments for API calls.
- NODE.JS - a JavaScript runtime built on Chrome's V8 JavaScript engine.
- Axios
- Installation:
node install axios - Used for grabbing data from:
- Installation:
- Node-Spotify-API
- Installation:
npm install node-spotify-api
- Installation:
- Moment
- Moment.js module is used for formatting time.
- Installation:
npm install moment
- Dotenv
- A zero-dependency module for loading environment variables from
.envintoprocess.env. - Installation:
npm install dotenv
- A zero-dependency module for loading environment variables from
- FS module
- "The
fsmodule provides an API for interacting with the file system in a manner closely modeled around standard POSIX functions." (link)
- "The
The getMyStuff object contains multiple methods for the LIRI app to determine which command was entered and then calls that specific method to obtain and display specific information.
processArgsmethod- gets an array from
[process.argv](https://nodejs.org/api/process.html#process_process_argv), which is a "property that returns an array containing the command line arguments passed when the Node.js process was launched."
- gets an array from
checkCommandmethod- Uses the
switch/casestatement checks if the command argument matches an existing method and calls that method.
- Uses the
concertThismethod.spotifyThismethod.movieThismethod.doWhatItSaysmethod.addToFilemethod.
LIRI is run in the command line.
-
node liri.js concert-this <artist/band name here>runs theconcertThismethod along with the name of the artist or band as an argument. It gets info from the Bands In Town API using Axios and displays multiple show events. -
node liri.js spotify-this-song <song name here>runs thespotifyThismethod. -
node liri.js movie-this <movie name here>runs themovieThismethod using Axios and OMDB API. -
node liri.js do-what-it-saysruns thedoWhatItSaysmethod using the FS module to get a string from therandom.txtfile.- The "," in the string will be used as a delimiter using `.split(",") and saves the string as two items in an array.
- The first item is used as the command and the second item is the query argument.
- The command and query argument are passed to the
checkCommandmethod which then calls the appropriate method. - Save command and argument to
addToFilemethod. - Screenshot:
-
The
addToFilemethod uses theFSmodule to append a string to thelog.txtfile.- Moment.js is used to getthe current time and format it as
[YYYY/DD/MM hh:mm:ss]. - Here's the heading of each appended string:
[YYYY/DD/MM hh:mm:ss] <command-name> <argument>
- Screenshot
- Log.txt file:
- Moment.js is used to getthe current time and format it as
- EZGIF.COM - converts MP4 to animated GIF online with optimizing tools.




