Source

cl-taglib / README.md

Full commit
Walton Hoops e4e7b16 

Walton Hoops a3ddb6e 
Walton Hoops e4e7b16 
































Walton Hoops c19ce08 




















# CL-Taglib

Simple CFFI bindings to [taglib](http://taglib.github.com/)

## Quick Examples

### Reading file tags

    :::lisp
    (use-package :taglib)
    (with-tag-file (file "07 - 17.mp3")
      (let ((tag (file-tag file))
            (audio (file-audioproperties file)))
        (values (list (tag-title tag)
                      (tag-artist tag)
                      (tag-album tag)
                      (tag-comment tag)
                      (tag-genre tag)
                      (tag-track tag)
                      (tag-year tag))
                (list (audio-length audio)
                      (audio-bitrate audio)
                      (audio-samplerate audio)
                      (audio-channels audio)))))
    ;;; result
    ("17" "Kings Of Leon" "Only By The Night" "Sample Commment"
          "Alternative Rock" 7 2008)
    (185 247 44100 2)

### Setting tags

    :::lisp
    (use-package :taglib)
    (with-tag-file (file "turtles.mp3")
           (let ((tag (file-tag file)))
             (setf (tag-comment tag) "turtles all the way down")
             (file-save file)))

## API

(*file-new* pathname) Takes a pathname or a string and returns the tagfile.  The the tagfile MUST be freed manually, use *with-open-tagfile* instead

(*file-free* tagfile) Frees the provided tagfile, returns nil.

(*file-save* tagfile) Saves any changes to the files tags.  Returns T on success, nil on failure.

(*with-tag-file* (var-name pathname) &body) Opens the file, runs &body and closes it, similar to with-open-file.  The file is NOT automatically saved.
### Working with tags

(*file-tag* tagfile) Returns the tag structure associated with the file.  Will be automatically be freed along with the file.

(*tag-<property>* tag) Returns the given property.  All tag operations are setf-able.  Available accessors are (title album artist genre comment track year)

### Reading audio information

(*file-audioproperties* file) returns the audio properties for the given file

(*audio-<property>* audio) Returns the given property as an integer.  Properties are (length bitrate samplerate channels).  Audio properties are NOT setf-able.