You are going to write a program MyTunes to manage your music library. Your music collection is a set of albums. Each album has several songs. A playlist is a set of songs--perhaps from multiple albums. You will keep track of songs and playlists.
Remember good coding practices: use of well-written comments, good variable and function names, constants, functions, etc. (See the web pages and your lecture notes for more information about good style.) There are several parts to the project. Build up the project from the different parts. Test each implemented part separately.
number_of_songs artist1_name; album1_name; song1_name; song1_length (minutes:seconds) artist2_name; album2_name; song2_name; song2_length (minutes:seconds) ...
If there is no file called "mytunes.collection", you have no music in your collection. Example collection files can be found in mytunes. Feel free to share your collection files with the class.
You should use a Song
struct to maintain information about the
song, such as the album, artist, name, and length of the song.
You will not have more than 50000 songs in your collection.
Add a function that will print out the music collection, nicely formatted.
Change your program so that it will allow the user to enter the name of the collection file as a command-line argument. The program will attempt to read that file to initialize the music collection. If you do not give a command-line argument, the program will attempt to read the default "mytunes.collection".
artist_name album_name number_of_songs song1_length (minutes:seconds) song1_name song2_length (minutes:seconds) song2_name ...The directory albums contains some example album files. Feel free to submit your own albums to share with the class.
Write a function to read in one album. Store the songs in the music collection. Print out the total length of the album as well.
Example Run:
Enter your option: m Enter the name of the album: albums/bte.txt Number Name Album Artist Length 0 Burned Before the Robots Better Than Ezra 03:41 1 Daylight Before the Robots Better Than Ezra 03:54 2 Lifetime Before the Robots Better Than Ezra 03:27 3 It's Only Natural Before the Robots Better Than Ezra 04:16 4 Overcome Before the Robots Better Than Ezra 05:22 5 Special Before the Robots Better Than Ezra 04:03 6 American Dream Before the Robots Better Than Ezra 03:40 7 Our Last Night Before the Robots Better Than Ezra 04:12 8 Southern Thing Before the Robots Better Than Ezra 04:02 9 Juicy Before the Robots Better Than Ezra 03:53 10 Hollow Before the Robots Better Than Ezra 03:30 11 Our Finest Year Before the Robots Better Than Ezra 04:22 Total time: 00:48:22
Add additional options to the print function you wrote in Part 0 that allow the user to sort the albums, either by artist name, album title, song title, or song length. For 5 points extra credit, you can implement merge sort to sort your array. Then, print out the music collection nicely.
Display the playlist in a nice format that includes the total length of the playlist.
Allow the user to import a playlist or export the playlist to a file. The format of the playlist file is
playlist_name number_of_songs artist1_name; album1_name; song1_name; song1_length (minutes:seconds) artist2_name; album2_name; song2_name; song2_length (minutes:seconds) ...
You can assume that an artist's name, an album name, the song name and length do not include the delimiter character ';'. You should, however, make your program flexible so that you can easily change the delimiter character.
When creating the exported playlist file, add a ".play" extension to the playlist's name to create the file name. If the playlist's name contains spaces, you should remove spaces from the name before creating the filename.
mytunes.collection
. Use the file format described in
Part 0.
Allow the user to enter either a lower case or capital letter for each option. If you implement the user menu with integers, you'll lose 5 points.
Test plan (20 points)
Good programmers write a test plan before writing their code. They use the test plan to verify that the program operates as expected and to meet a customer's requirements.
Write your test plan in a separate file. (You can write the test plan in a format other than a plain text file in Emacs, if you would like.) Your test plan should include the program's input and its expected output. (How do you know the expected output?) Write a test plan for each of your programs. Follow the test plan in your script (after you've executed the required test cases).
Submit the electronic copy via email to Gang before 6 p.m. on August 8 and the paper copy to Sara before class.
Sign up for a demo with either Sara or Gang on CPM during the week of August 8.