Skip to content

Commit

Permalink
Merge the whole concept of default and additional values into
Browse files Browse the repository at this point in the history
"explicit tag values" which may be set with either -a, -A, -t,
-n, -d, -g and -c or the generic --tag command line option.
The default_* configuration options are removed.
Based on complaints from Alexandre Buisse and Olivier Schwander.

Fix the way they are exported in the config file.
  • Loading branch information
bgoglin committed Dec 16, 2007
1 parent 4484eeb commit 87a7219
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 148 deletions.
6 changes: 6 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
lltag (xxx)

* Merge the whole concept of default and additional values into
"explicit tag values" which may be set with either -a, -A, -t,
-n, -d, -g and -c or the generic --tag command line option.
The default_* configuration options are removed.
Based on complaints from Alexandre Buisse and Olivier Schwander.
+ Fix the way they are exported in the config file.
* Replace slashes with dashes before renaming
(reported by Mark McEver in Gna! bug #10127).
+ Add --rename-slash to change dash into any other string.
Expand Down
11 changes: 1 addition & 10 deletions doc/config
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,7 @@
# Do not use file path when matching filename.
# no_path = 0

# Default field values.
# default_ARTIST = ""
# default_TITLE = ""
# default_ALBUM = ""
# default_NUMBER = ""
# default_GENRE = ""
# default_DATE = ""
# default_COMMENT = ""

# Additional tag.
# Explicit tag.
# Might be used multiple times.
# tag = "TAG=value"

Expand Down
29 changes: 12 additions & 17 deletions doc/howto.html
Original file line number Diff line number Diff line change
Expand Up @@ -259,30 +259,25 @@ <h2 class="section">Managing tags</h2>



<a name="set_default">
<h3 class="question">How do I set default values?</h3>
<a name="set_explicit">
<h3 class="question">How do I set a specific value? What are explicit tag values?</h3>
</a>

Each tag field may receive a default value even if it is not defined
when parsing the filename:
Each tag field may receive a specific value even if it is not obtained through
parsing the filename or so:
<pre>
lltag -a MyArtist -y 1990 myfile.mp3
</pre>

All regular fields may be defined like the above with <tt>-a</tt>, <tt>-t</tt>,
<tt>-A</tt>, <tt>-n</tt>, <tt>-g</tt>, <tt>-d</tt> or <tt>-c</tt>.
These (and any random tag) may also be set through <tt>--tag FIELD=value</tt>.


<a name="default_and_additional">
<h3 class="question">What is the difference between default and additional values?</h3>
</a>

Default values (given with <tt>-a</tt>, <tt>-t</tt>, <tt>-A</tt>, <tt>-n</tt>,
<tt>-g</tt>, <tt>-d</tt>, or <tt>-c</tt>) are only set at the end if there is no
defined value for the target tag in this file.

Additional values (given with <tt>--tag FIELD=value</tt>) are always added,
even if it means that the target tag will have multiple values. Playing with
<tt>--clear</tt> or <tt>--append</tt> enables configuration of how they are
actually added.
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 <tt>--clear</tt> or <tt>--append</tt> enables configuration
of how they are actually added.



Expand Down
8 changes: 4 additions & 4 deletions lib/Lltag/Tags.pm
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ sub get_values_non_regular_keys {
} (keys %{$values}) ;
}

# handle additional tags
sub process_additional_tag_value {
# handle explicit tag values
sub process_explicit_tag_value {
my $self = shift ;
my $string = shift ;
if ($string =~ m/^([^=]+)=(.*)$/) {
append_tag_value $self, $self->{additional_values}, $1, $2 ;
append_tag_value $self, $self->{explicit_values}, $1, $2 ;
} else {
die "Additional tags must be given as 'TAG=value'.\n" ;
die "Explicit tags must be given as 'TAG=value'.\n" ;
}
}

Expand Down
48 changes: 16 additions & 32 deletions lltag.1
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,13 @@ it will proceed with tagging (and renaming if requested) and go on with the
next file.

The new tags that the selected strategy returns will be appended with
the additional values given with
.BR --tag .
the explicit values given with
.BR " -a ", " -t ", " -A ", " -g ", " -n ", " -d ", " -c " or " --tag .
They will then either replace (default), clear and replace
.RB ( --clear )
or append to
.RB ( --append )
the existing tags in the target file.
And finally, each tag that will not be defined (and which the user will
have provided a default value for, with
.BR -a ", " -t ", " -A ", " -g ", " -n ", " -d " or " -c )
will get a default value.

Once the tags are known, a backend program or library is used to apply
them to the audio file (unless
Expand Down Expand Up @@ -181,15 +177,11 @@ filled with the tag values.

.TP
.BI "-A, --album" " <album>"
Set the default value of the \fIALBUM\fR tag.
The corresponding configuration file option is
.IR default_ALBUM .
Add a value for the \fIALBUM\fR tag.

.TP
.BI "-a, --artist" " <artist>"
Set the default value of the \fIARTIST\fR tag.
The corresponding configuration file option is
.IR default_ARTIST .
Add a value for the \fIARTIST\fR tag.

.TP
.BI "--append"
Expand Down Expand Up @@ -246,9 +238,7 @@ may be used (set to something like "https://my.proxy.com").

.TP
.BI "-c, --comment" " <comment>"
Set the default value of the \fICOMMENT\fR tag.
The corresponding configuration file option is
.IR default_COMMENT .
Add a value for the \fICOMMENT\fR tag.

.TP
.B --clear
Expand All @@ -266,9 +256,7 @@ below for details.

.TP
.BI "-d, --date" " <date>"
Set the default value of the \fIDATE\fR tag.
The corresponding configuration file option is
.IR default_DATE .
Add a value for the \fIDATE\fR tag.
Note that the ID3 date tag may only store 4 characters (for a year).

.TP
Expand Down Expand Up @@ -306,9 +294,7 @@ The corresponding configuration file option is

.TP
.BI "-g, --genre" " <genre>"
Set the default value of the \fIGENRE\fR tag.
The corresponding configuration file option is
.IR default_GENRE .
Add a value for the \fIGENRE\fR tag.
While some file types accept any string as a genre, some others
(especially ID3v1 tags in MP3 files) require the string to match
within a list of specified genres.
Expand Down Expand Up @@ -357,9 +343,7 @@ Note that merging/appending takes care of removing duplicates.

.TP
.BI "-n, --number" " <number>"
Set the default value of the \fINUMBER\fR tag.
The corresponding configuration file option is
.IR default_NUMBER .
Add a value for the \fINUMBER\fR tag.

.TP
.B --no-tagging
Expand Down Expand Up @@ -506,16 +490,16 @@ to get the detailled impact of this option.

.TP
.BI "-t, --title" " <title>"
Set the default value of the \fITITLE\fR tag.
The corresponding configuration file option is
.IR default_TITLE .
Add a value for the \fITITLE\fR tag.

.TP
.BI "--tag" " <TAG=value>"
Add an additional tag.
Add an explicit tag value.
The corresponding configuration file option is
.IR tag .
Might be used several times.
Might be used several times, even for the same tag.
When setting a common tag, it is similar to using
.BR -a ", " -A ", " -t ", " -n ", " -g ", " -d " or " -c .
Note that mp3 tags do not support whatever
.IR TAG .

Expand Down Expand Up @@ -605,8 +589,8 @@ We now describe all interactive menus in detail.


.SS MAIN MENU
Once some tags have been obtained by either CDDB, parsing or the default
values on the command line, the main menu opens to either change the tags
Once some tags have been obtained by either CDDB, parsing or the explicit
values given on the command line, the main menu opens to either change the tags
or apply them:
.TP
.B y
Expand All @@ -628,7 +612,7 @@ Edit values, see
.B EDITING MENU
.TP
.B D
Only use default and additional values, forget about CDDB or parsed tags
Only use explicit values, forget about CDDB or parsed tags
.TP
.B Z
Reset to no tag values at all
Expand Down
Loading

0 comments on commit 87a7219

Please sign in to comment.