Due Friday 4/24 - 5PM
The goals of this project are as follows:
- gain experience with program design
- gain experience using recursion
- gain experience using JList, JMenuBar, JMenu, and JMenuItem
- practice using additional third-party libraries
- practice file i/o and text parsing
- practice algorithmic thinking
For this project, you will design an iTunes-like program that plays MP3s. The GUI of your program will look similar to the following:
You program must provide, at minimum, the following functionality:
- Import MP3s - Use the JFileChooser to allow the user to select a directory. Recursively traverse the directory and all of its descendants and display the list of MP3s found in a JList.
- Open Library - Use the JFileChooser to allow the user to select a file containing a myTunes library previously saved using "Export Library". Open the file and display the library contents in a JList.
- Export Library - Use the JFileChooser to allow the user to specify the name of a file where the current MP3 list should be saved. Save the contents to the file.
- Play - Begin playback. First, play the song that is currently selected. When playback of that song completes, continue down the list until the user clicks Stop.
- Stop - Stop playback. If no song is playing, do nothing.
- Next - If a song is currently playing, stop playback of that song and skip to the next song in the list. If no song is playing, do nothing.
- Shuffle - Randomize the list of songs. If a song is currently playing, stop playback.
Extra Credit Options
- Add - Provide a menu option that will allow a user to add songs to an existing library.
- Previous - Allow the user to go back to the previous song.
- Podcasts - Allow the user to download and listen to podcasts.
- Merge Libraries - Allow the user to merge two existing libraries.
- Extra credit will not be awarded for the following operations you will be implementing for Project 5:
- Sort songs by artist/title.
- Search songs for a given artist, title.
- Support for playlists.
- You will need to design the format you will use to store the library data. iTunes uses XML for this purpose, but you may store the information in plain text format. (Programs using XML will receive extra credit.) It is recommended that you store the artist, title, album, and name of the file where the MP3 is stored.
- To shuffle, you will need to randomize the order of the list of songs. It is recommended that you use java.util.Random. A standard algorithm for randomization is, for each item, extract it from the list and insert it into a random position.
- Use jAudiotagger to read the ID3 tags of the MP3 files. This will allow you to extract the artist, album, and title of the song during Import.
- Use JLayer for playback. You can create a Player object from an InputStream and invoke the play method to begin playback. The close method stops playback.
- When invoking the play method to play a song, the method will not return until the song is finished playing. In order for your program to respond to other events during playback, you will need to create a new Thread that invokes the play method. A basic example of this is as follows (though, you may do more inside of your run method):