CS 132 – Project 4: ID3 Tag Editing

Due: Friday, December 1st, 2006 Start of Class

 

 

The ID3 tag format for MP3s and other multimedia files is the following:

 

offset

length

description

0

3

"TAG" identifier string.

3

30

Song title string.

33

30

Artist string.

63

30

Album string.

93

4

Year string.

97

28

Comment string.

125

1

Zero byte separator.

126

1

Track byte.

127

1

Genre byte.

 

 

 

 

 

 

 

 

 

 

 

 

An ID3 (v1.1) tag like above is tacked to the end of a file as the last 128 bytes. The tag is present if at the -128 from end offset there is the word “TAG” as three characters.

 

For your project you will make a utility that can print the contents of an existing tag, if there, and add or modify a tag.

 

Make a program called id3tagEd and make it so that it runs with the following command line options:

 

id3tagEd FILENAME

 

should print the contents of the ID3 tag to the console if present, or give a message if not present

 

id3tagEd FILENAME –FIELD VALUE

 

should set the specified field to the value that follows it.

 

You should handle the following field names:

 

title, author, album, year, comment, track

 

Make sure you are able to handle multiple field, value pairs on the command line at once. If the tag already exists in the specified file, then edit it, if not create a new tag by appending a tag at the end with the specified fields populated. Assume all others are to be empty (filled with 0s.)