...but I don't understand how I would use it to 'insert data' or 'change values' of said data. Could you elaborate for me maybe with an example.
The snippet you quoted is most of the idea. You just have to work out the implementation details. It sounds like you're not understanding the concept of shell variables and/or not understanding backticks. When bash sees a line like
ALBUM=foo
it assigns the value "foo" to the variable "ALBUM". Then you can use that value in further commands by prefixing $. So
echo $ALBUM
just returns "foo".
Backticks indicate command substitution. Bash does whatever you tell it inside the backticks and uses the return value. So if you write
ALBUM=`echo "Hello World"`
then ALBUM now has the value "Hello World". You can test all of this on the command line too while you're learning... no need to write an actual script.
You have a variety of command-line tools for different file types (FLAC, MP3, Ogg, etc.) which all read tag data and spit it back out to you in different ways. For example, metaflac looks like...
tppytel@calliope:~/test$ metaflac --list --block-type=VORBIS_COMMENT example.flac
METADATA block #2
type: 4 (VORBIS_COMMENT)
is last: false
length: 505
vendor string: reference libFLAC 1.2.1 20070917
comments: 17
comment[0]: TITLE=We See
comment[1]: ACCURATERIPID=0018ddbc-00d9d0e4-9f0fa00b
comment[2]: ACCURATERIPCRC=d48847a4
comment[3]: ACCURATERIPDISCID=011-0018ddbc-00d9d0e4-9f0fa00b-01
comment[4]: ACCURATERIPCOUNT=30
comment[5]: ACCURATERIPCOUNTALLOFFSETS=30
comment[6]: ACCURATERIPTOTAL=42
comment[7]: TOTALTRACKS=7
comment[8]: Album=Monk
comment[9]: Artist=Monk, Thelonious
comment[10]: Comment=2000 remaster from The Complete Prestige Recordings
comment[11]: Genre=Jazz
comment[12]: ALBUMARTIST=Monk, Thelonious
comment[13]: LABELNO=3PRCD-4428-2
comment[14]: DATE=2000
comment[15]: TRACKNUMBER=01
comment[16]: ORIGINAL YEAR=1954
You need to get the right parts of that output assigned to the right shell variables using some combination of pipes, temp files, grep, sed, whatever. That's where the work is, and it's going to be a little different for each file type, so you'll need to check the type first and use if-then's to branch appropriately. In this case I'd probably dump the tag data to a temp file and then process it from there...
metaflac --list --block-type=VORBIS_COMMENT example.flac > tags.txt
ALBUMARTIST=`cat tags.txt | sed -n -e 's/^.*ALBUMARTIST=//p'`
Now ALBUMARTIST is "Monk, Thelonious" and I can use $ALBUMARTIST later on in the script when writing new tags, encoding, creating filenames, etc.
Again, you're best off learning this stuff by just playing around directly on the command line. Copy a single file into a temporary directory so you don't accidentally mess anything else up and experiment with how you can read tag values with the command-line tools and get them assigned to shell variables. When you're assigning values to variables on the command line, it's probably good practice to do
export FOO=bar
instead of just
FOO=bar
The export command adds the variable to your current environment and makes that value available to subprocesses, which is typically what you want when you're testing. You can then see the list of your current environment variables by running "env". You can remove existing assignments with "unset FOO", etc.