Edgar Vargas

My Portfolio

Lyric Quiz Web App

Home Page

Gives the user 2 options for which quiz they want to take. The text changes colors when hovered. The 2 album files are pulled from my local directory. Currently only tested with 2 albums since obtaining a lyric/album database is part of my other web scraping/database project.

Video Demo

Video demo of my web app. The dropdown menu adjusts to each album quiz from parsing through the album file to retrieve a song list. The score resets when the user goes home. I also avoided non-repeat questions by clearing the folder used for grabbing the questions in the java back-end. When the user selects a quiz from the home page, the questions are randomly generated each time.

Song Storage

Iterates through each line of a song file text folder in an album directory. Filters out non-lyrics such as "[Verse 1]" as well as certain accent marks. The lyric lines that pass through the filter are passed into a lyric array that will be used with helper methods to select random lines for the song. The song with it's random lines chosen are then added to a map for storage and easier retrieval.

Saving Song Map to File

Method for saving a map of songs as the key and chosen lyrics as the value. I used a for-loop to iterate through the map and save each file as the song name and writes the chosen lyrics to the file.

Select Random Lines

Method for grabbing a variable amount of random lines from a lyric array. Used a lyric array since lyrics are usually ordered by lines as opposed to traditional breaks like periods. Each index for the array represents the next lyric line.

JavaScript for questions handler

Javascript code that handles the questions for the front-end portion of the quiz app. Implemented HTML5 web storage to keep track of scores and the question count that can dynamically change with each album selected. Redirects the user to the score page after the completion of the last question.

HTML of questions page

HTML code of the questions page. Drop down menu dynamically changes to list the songs of each album that the user can select from. Passed in variables for the songlist, and the correct answer for each question from a Song Controller class in the Java back-end.