Metadata: Organizing your iTunes. Digitized music such as that managed by iTunes has metadata such as the name, artist, and so on. Internally, iTunes uses the XML format to manage its metadata, and...


Metadata: Organizing your iTunes.


Digitized music such as that managed by iTunes has metadata such as the name, artist, and so on. Internally, iTunes uses the XML format to manage its metadata, and Python has modules to work with XML, but XML has more complexity than we can deal with in a problem (or even a few chapters). However, using copy-and-paste you can copy your iTunes metadata from the text “list” view of your playlist into your favorite text editor such as TextEdit or WordPad. The result is a file that is tab-separated, that is, fields are separated by the tab character. Because the split() method can take an argument of what to split on, we can split the lines of your text file using line.split("\t"). Remember that we can specify the tab character with "\t". What is an appropriate data structure? It is natural to organize music around the artist and an artist’s name is immutable, so a dictionary is suggested with the artist as the key. The remaining metadata becomes the value of each record. You can read in your metatdata and place it in a dictionary. Write a program that does the following:


(a) Reads the metadata from a file into a dictionary.


(b) Loops to repeatedly prompt for:


i. Name: list all tunes by the specified artist. ii. Album: list all tunes on the specified album. iii. Genre: list all tunes in a specified genre. iv. Add: add a tune. v. Delete: delete a specified tune (specify its name). vi. Popular: finds the artist with the most tunes in your collection. vii. Longest: finds the longest tune in your collection and prints its metadata


i. Name: list all tunes by the specified artist.


 ii. Album: list all tunes on the specified album.


iii. Genre: list all tunes in a specified genre.


iv. Add: add a tune.


v. Delete: delete a specified tune (specify its name).


vi. Popular: finds the artist with the most tunes in your collection.


vi.                 Longest: finds the longest tune in your collection and prints its metadata


Hint: To sort to find the most popular or longest, you need to convert your dictionary into a data structure that you can sort, such as a list or tuple. Remember that the Python sort will sort on the first item in each list (or tuple), so you will need to arrange your lists appropriately.]

Nov 17, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here