Reading id3 tags

By LiQuiDFLamE on Nov 21, 2007

Simple alias to read the id3 tags of a sound file. Properties consist of: artist,song,genre,year,comment, and album. Syntax: $id3(filename).prop

alias id3 {
  if ($1- && $isfile($1-)) { 
    var %x, %t, %f = $+(",$1-,")
    bread %f $calc($file(%f).size -128) 128 &id3
    if ($bvar(&id3,1-3).text = TAG) {
      if (!$prop) %x = 4-33
      else { 
        if ($prop = song) %x = 4-33
        if ($prop = artist) %x = 34-63
        if ($prop = album) %x = 64-93
        if ($prop = year) %x = 94-97
        if ($prop = comment) %x = 98-127
        if ($prop = genre) { 
          %genre = $calc($bvar(&id3,128)+1)
          %t = $genre(%genre)
        }
      }
      return $iif($prop = genre,%t,$bvar(&id3,%x).text))
    }
  }
}
alias -l genre { 
  var %g = Blues|Classic Rock|Country|Dance|Disco|Funk|Grunge|Hip-Hop|Jazz|Metal|New Age|Oldies|Other|Pop|R&B|Rap|Reggae|Rock|Techno|Industrial|Alternative|Ska|Death Metal|Pranks|Soundtrack|Euro-Techno|Ambient|Trip-Hop|Vocal|Jazz+Funk|Fusion|Trance|Classical|Instrumental|Acid|House|Game|Sound Clip|Gospel|Noise|AlternRock|Bass|Soul|Punk|Space|Meditative|Instrumental Pop|Instrumental Rock|Ethnic|Gothic|Darkwave|Techno-Industrial|Electronic|Pop-Folk|Eurodance|Dream|Southern Rock|Comedy|Cult|Gangsta|Top 40|Christian Rap|Pop/Funk|Jungle|Native American|Cabaret|New Wave|Psychadelic|Rave|Showtunes|Trailer|Lo-Fi|Tribal|Acid Punk|Acid Jazz|Polka|Retro|Musical|Rock & Roll|Hard Rock
  var %g_ = Folk|Folk Rock|Swing|Fast Fusion|Bebob|Latin|Revival|Celtic|Bluegrass|Avantgarde|Gothic Rock|Progressive Rock|Psychedelic Rock|Symphonic Rock|Slow Rock|Big Bang|Chorus|Easy Listening|Acoustic|Humour|Speech|Chanson|Opera|Chamber Music|Sonata|Symphony|Booty Brass|Primus|Porn Groove|Satire|Slow Jam|CLub|Tango|Samba|Floklore|Ballad|Poweer Ballad|Rhytmic Soul|Freestyle|Duet|Punk Rock|Drum Solo|A Capela|Euro-House|Dance Hall
  var %u = $gettok(%g,$1,124)
  if (!%u) var %u = $gettok(%g_,$1,124)
  return %u
  unset %genre
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.