# lltag How-To?

## Basics

### How do I use lltag?

      lltag myfile1.mp3 myfile2.ogg

It is also possible to tag all files in subdirectories with:

      lltag -R mymusic/

All mp3, ogg and flac are processed, depending on their extension. If the extension is wrong, it is possible to force the file processing type:

      lltag --ogg myfile.mp3

### How do I see current tags in files?

All the tags currently existing in files may be displayed:

      lltag -S *

It is also possible to only display some tags:

      lltag --show-tags artist,album,title,number *

### How do I set tags by hand?

Any tag may be changed by hand:

      lltag --artist "myartist" --album "myalbum" --genre "rock" --comment="very cool" *.mp3

File types that support random tag names (ogg and flac currently) may also get random tags:

      lltag --tag foo=nil bar.ogg

It is also possible to clear a tag:

      lltag --tag foo= bar.ogg

And all tags may be removed from all files:

      lltag --clear *.flac

## Disabling, Confirming, Forcing

### How do I try lltag without actually tagging?

      lltag --dry-run

### How do I change what confirmation lltag wants?

It is possible to remove any need for confirmation when no problem occurs:

      lltag --yes myfile.flac

It is also possible to force confirmation when `lltag` parses the filename with user-provided formats:

      lltag --ask myfile.ogg

Finally, during confirmation, it is possible to use `Always` to enable `--yes` at runtime.

## Parsing

### How do I see how lltag parses filename?

`lltag` uses internal format that are defined in `/etc/lltag/formats/`. You might see them with:

      lltag -L

### How do I force lltag to use another format?

If internal formats do not fit the way your filename is written, you may pass additional formats with:

      lltag -F "%a-%t" -F "%n)%a-%t" myfile1.mp3 myfile2.flac

It is also possible to try user-provided formats and then try internal formats:

      lltag -F "%a-%t" -F "%n)%a-%t" -G myfile1.mp3 myfile2.flac

### What is the preferred parser?

If all your filenames have the same format, i.e. they may be matched with the same parser, you might want to try this one first instead of seeing the other ones fail or having to skip them. When confirming parsing, you may choose to accept the current parser and mark it as preferred so that `lltag` will try it first for the next files, and not ask you for confirmation as long as it parses filenames fine.
If one filename cannot be matched by the preferred parser, `lltag` will revert to the common behavior. Any other parser, or the same previous one, may be marked as preferred later again.

## Getting tags from the online CDDB

### What is CDDB and why does lltag need it?

CDDB is a huge online database of CD describing their artist, album, date, tracks, ... everything that `lltag` considers as tags. By default, `lltag` accesses the database on `www.freedb.org` through the HTTP protocol. The server and its port may be changed on the command-line:

      lltag --cddb --cddb-server mycddb.mydomain.org:443 *

In case of a HTTP proxy being required for HTTP request, `lltag` may also be configured to use it:

      lltag --cddb --cddb-proxy myhttpproxy.mydomain.org:3128 *

### How do get tags from CDDB?

The common way to search a CD on CDDB is to pass keywords, which return a list of matching CDs. Then, you choose a CD in the list, and a track in the CD tracks.
When entering the `lltag` CDDB menu for the first time, you need to enter keywords to find the CD that match the audio file you are processing. `lltag` will return a list of CD. At this point, you may either go back to search with other keywords, or enter the index of the CD that you want.
Then, `lltag` will display of the CD you have chosen and of its tracks. You may then choose a track and use it to tag/rename your file, or go back to choose another CD, or go back more to change the keywords.
When coming back to CDDB the next time, `lltag` will propose the next track of the previous CD that you used, so that processing an entire album is quick and easy.

### How do choose a precise CD in CDDB?

All CD that are registered in CDDB are identified by a category and an hexadecimal identifier. When searching by keywords, `lltag` will return a list of matching CD with their category/identifier in parentheses.
It is also possible to directly enter this category/identifier instead of keywords to get a precise CD quickly.

### Is the interactive interface always required to access CDDB?

The CDDB interface seems to be designed for interactive usage since the user is supposed to choose a CD in the list of CDs returned by the keywords query, and then choose a track in the CD. But, it is also possible to use CDDB automatically if the CD id is known and the files are ordered by track numbers.
The CD id may be given on the command line:

      lltag --cddb-query rock/a0b2c4d7 --yes *

Using --yes enables automatic mode which means `lltag` will tag the first file as the first track of the CD returned by CDDB, the second file as the second track, ... If `lltag` ever reaches the end of the CD, it will return to interactive mode so that the user may choose another CD to tag the remaining files.

## Managing tags

### How do I set a specific value? What are explicit tag values?

Each tag field may receive a specific value even if it is not obtained through parsing the filename or so:

      lltag -a MyArtist -y 1990 myfile.mp3

All regular fields may be defined like the above with `-a`, `-t`, `-A`, `-n`, `-g`, `-d` or `-c`. These (and any random tag) may also be set through `--tag FIELD=value`. These values are called explicit values. They are always added to the ones obtained through parsing or so, even if it means that the target tag will have multiple values. Playing with `--clear` or `--append` enables configuration of how they are actually added.

### How do I cleanup tags?

If your filenames are dirty, it is possible to ask `lltag` to be flexible with spaces. Any space in the format might be matched with 0 or several spaces with:

      lltag --spaces myfile.mp3

The first letter of each word in each tag might be upcased with:

      lltag --maj myfile.mp3

If the filename contains special characters that have to be translated into spaces for tags:

      lltag --sep _|-|: myfile.mp3

## Renaming

### How do I rename files after tagging?

Files might be renamed using the tags that were gotten from original filename parsing:

      lltag myfile.mp3 --rename "%a - %t.mp3"

Tags might be lowcased before renaming, and spaces might be replaced with another character:

      lltag myfile.mp3 --rename "%a - %t.mp3" --rename-min --rename-sep _

### How do I rename files without tagging?

`lltag` may also be used as a renaming program without any tagging:

      lltag --no-tagging -F "%A/%n. %a - %t" --rename "%a - %A/%n - %t" */*.ogg

Note that `lltag` may rename using existing tags even if the old filename is useless. Matching with `"%i"` to ignore the old filename might be useful in this case.

      lltag --no-tagging --rename "%a - %A/%n - %t" */*.ogg

$Id: howto.html,v 1.2 2006/05/07 00:57:26 bgoglin Exp $