LIRI is a Language Interpretation and Recognition Interface program which runs on the command line. The program can run a number of different operations which make API requests through NPM modules or Request:
- Spotify (song information)
- Twitter (load latest tweets)
- OMDB API (movie information)
- Weather (weather for location)
- Geocode (geographic information)
- Google Books (book information)
- Giant Bomb (video game information)
- Breed Info (information on cat breeds)
The program can also run these operations through Macros defined in files.
When an operation or macro is run, it outputs to the console and to a log file "log.txt" in the logs folder.
Information can be retrieved on a song using the Spotify operation by entering this in the console:
node liri spotify-this-song "<song title>"
(Aliases for spotify-this-song are spotify and song-info)
If no song title is given, the song "Scatman" is used. When the operation is run, it searches the Spotify database for the song title and some results are returned. This is an example of one of the results returned from Spotify:
********************
Title: How Bizarre
Album: How Bizarre
Artist(s): OMC
Preview URL: null
Tweets from an authorized account (in this case, @Kashistis) can be retrieved using the Twitter operation by entering this in the console:
node liri my-tweets <number>
(Aliases for my-tweets are get-tweets and twitter)
If no number is entered, the last up to 20 tweets are retrieved. Otherwise, the maximum number of latest tweets are set by the number entered. The tweets returned look like this:
--------------------
User @Kashistis
Thu Sep 28 02:26:42 +0000 2017
RT @kalpenn: How you can help hurricane victims in Puerto Rico https://t.co/zfo7iak5Os
Information can be retrieved on a movie using the OMDB operation by entering this in the console:
node liri movie-this "<movie title>"
(Aliases for movie-this are movie-info and omdbapi)
If no movie is entered, the movie "Jumanji" is used. If movie information is found, it's returned. It usually looks like this:
********************
Title: Silver Streak
Year: 1976
Country: USA
Language: English
Actors: Gene Wilder, Jill Clayburgh, Richard Pryor, Patrick McGoohan
Plot: On a long-distance train trip, a man finds romance but also finds himself in danger of being killed, or at least pushed off the train.
IMDB Rating: 6.9/10
Rotten Tomatoes: 83%
The current weather and next-day forecast for a location can be retrieved using the Weather operation by entering this in the console:
node liri weather-info "<location>"
(Aliases for weather-info are weather and get-weather)
If no location is entered, "Matawan, NJ" is used. The current weather and next-day forecast for the location are returned and look like this:
********************
Location: Somerset, NJ
Current Temperature: 36 F
Weather: Mostly Cloudy
Wind: 1 mph Northeast
Humidity: 93
Tomorrow's Forecast: Low of 29F, High of 48F
(Note: Temperatures are listed in degrees Fahrenheit (F).)
Geographical information can be retrieved for a location using the Geocode operation by entering this in the console:
node liri geocode-this "<location>"
(Aliases for geocode-this are location-info and geocode)
If no location is specified, "Matawan, NJ" is used. Some more specific geographical information is returned for the location which looks like this:
********************
Formatted Address: New Brunswick, NJ, USA
Geographic Coordinates:
Latitude: 40.4862157
Longitude: -74.4518188
Book information can be retrieved for a particular book using the Google Books operation by entering this in the console:
node liri google-books "<bookName>"
(Aliases for google-books are book-info and book-search)
If no book is specified, "Fahrenheit 451" is used. When it searches the Google Books API, some results are returned, one of which looks like this:
*********************
Title: Fahrenheit 451
Subtitle: Ray Bradbury
Author(s): Ray Bradbury
URL: https://books.google.com/books/about/Fahrenheit_451.html?hl=&id=nHWeS0buvG4C
Game information can be retrieved for a particular video game using the Giant Bomb operation by entering this in the console:
node liri giant-bomb "<gameName>"
(Aliases for giant-bomb are game-info and game-search)
If no game is specified, "Psychonauts" is used. When it searches the Giant Bomb API, some results are returned, one of which looks like this:
*********************
Title: Psychonauts
Year: null
Platforms: Mac, PlayStation 2, Xbox, Xbox 360 Games Store, PlayStation Network (PS3), PC, PlayStation 4, Linux
URL: https://www.giantbomb.com/psychonauts/3030-2906/
Information can be retrieved for a particular cat breed using the Breed Info operation by entering this in the console:
node liri breed-info "<breedName>"
(Aliases for breed-info are cat-info and breed-search)
If no breed is specified, "Burmese" is used. When it searches The Cats API, some information is returned, which looks like this:
********************
Burmese Info:
Burmese love being with people, playing with them, and keeping them entertained. They crave close physical contact and abhor an empty lap. They will follow their humans from room to room, and sleep in bed with them, preferably under the covers, cuddled as close as possible. At play, they will turn around to see if their human is watching and being entertained by their crazy antics.
One or more commands can be run through macros defined in external files by entering this in the console:
node liri do-what-it-says <filename>
(Aliases for do-what-it-says are run-macro and run-file)
If no file is specified, it will look for a file named "random.txt".
If a file is found, the macro file will be run. A macro file usually looks like this:
movie-this,"Sharknado"
spotify-this-song,"How Bizarre"
Each line is an operation. Before the first comma the operation to run is specified. After that comma are the arguments to run the operation on. As each line is read, the operation is run.
Note: At this time, aliases for the operations are not supported and macros cannot be run within other macros.
LIRI can be run without additional parameters by entering this in the console:
node liri
A menu appears with the operations defined in the application (example below):
? Choose an operation: (Use arrow keys)
> my-tweets
spotify-this-song
movie-this
geocode-this
weather-info
google-books
giant-bomb
breed-info
do-what-it-says
Once an operation is chosen, another prompt appears giving the user a chance to enter arguments to run for the operation. That operation is then run on the arguments entered.