Normal configuration tasks are done in (how convenient) "Configuration files", described below.
If you need more control, or want to solve special problems you are having, you can do so by supplying Perl code in "Hook definition files".
The first setup directory we find always wins. arename does not consider more than one setup directory.
Configuration files
arename uses up to three configuration files. As for most programs, the script will try to read a configuration file, that is located in the user's home directory. In addition to that, it will try to load local configuration files, if it finds appropriately named files in the current directory (and the uselocalrc feature is enabled):
-
$XDG_CONFIG_HOME/arename/rc
-
-
~/etc/arename/rc
-
-
~/.arename/rc
-
-
~/.arenamerc
-
per-user normal configuration file.
-
./.arename.local
-
per-directory local configuration file (only read if uselocalrc is set or the --read-local option is given on the command line).
The per-user normal configuration file can be substituted by another file, if specified via the --rc option.
Last but not least, you can specify an intermediate configuration file, that is read in between the normal and the per-directory file, via the --post-rc option.
File format
The format of the aforementioned files is pretty simple. It is parsed line by line. Empty lines, lines only containing whitespace and lines, whose first non whitespace character is a hash character (#) are ignored.
There are two different types of settings: boolean and scalar settings.
Booleans can be set like this:
<setting> [true|false]
If the value is omitted, true is assumed. true and false are recognized case insensitively, and a value of 1 is synonymous to true, as is 0 to false.
Scalar settings are done in a very similar way:
<setting> <value>
If the value is omitted, string values will be set to an empty string and numeric values will be set to zero.
In both cases, setting and value are separated by one or more whitespace characters. The value will be the rest of the line (all of it, including trailing whitespace).
If the value part starts with a backslash, that backslash is left out of the value. That makes it possible to define templates with leading whitespace.
If a line contains only a string within square brackets, that string is the start of a section. Section names are matches for starts of file names. That means, the settings following such a section definition will only applied for input file names that start with the same string as the section name. Where file name means the string, handed over to arename. The string ~/ at the beginning of a section name is expanded to the user's home directory.
You may start as many sections as you would like.
A section named /foo/bar/ supersedes a section named /foo/ for a file named /foo/bar/baz.ogg. So, the longest match wins.
Another possible configuration file entry is a user variable, which is defined via the set command. These settings are very different from the normal settings. Therefore, they are defined in a different way. That way is described in the "User defined variables" subsection below.
Last but not least, you may define so called profiles, see below.
Configuration profiles
Profiles are a very flexible and context sensitive way of using multiple configuration files at once. With profiles, local configuration files (and local hook definition files) can be substituted in a secure way; even on multi-user systems.
Reading local files (configs and hook-files) is still supported for backwards compatibility (see uselocalrc and uselocalhooks options). However, you are strongly encouraged to use profiles whenever you can.
As normal configuration files and global hook-files, profile-related files are searched in one of the setup directories described above. They are using the following naming conventions:
-
$XDG_CONFIG_HOME/arename/profile.PROFILENAME
-
-
~/etc/arename/profile.PROFILENAME
-
-
~/.arename/profile.PROFILENAME
-
-
~/.arename.PROFILENAME
-
Profile related configuration files; read if PROFILENAME is active.
They are read after a intermediate config file defined by --post-rc and a local config file (if enabled).
-
$XDG_CONFIG_HOME/arename/profile.PROFILENAME.hooks
-
-
~/etc/arename/profile.PROFILENAME.hooks
-
-
~/.arename/profile.PROFILENAME.hooks
-
-
~/.arename.PROFILENAME.hooks
-
Profile related "Hook definition files" (see below for details); read if PROFILENAME is active.
These files are read, between global and local hook-definition files.
In order to define profiles, you need to use the profile keyword:
profile <name> <pattern>
Where name is a string, that is used in the place of PROFILENAME in the file location lists above. This name may contain of the following character range: a-zA-Z0-9_-
pattern is part of a Perl regex pattern (see perlreref and perlretut manpages). The pattern will be anchored at the beginning and is open at the end, somewhat like this pseudocode:
if ($working_directory =~ m/^PATTERN/) { use_this_profile(); }
Example:
profile music /mnt/audio/music/
Will cause the profile music to be active when the working directory is /mnt/audio/music/ or below. So, do not be afraid. You can use profiles without understanding regular expressions.
Like many other values in arename's configuration, a leading backslash of a pattern will be ignored to allow patterns, that start in white spaces. Furthermore, if a pattern starts in ~/, that string is replaced by the user's home directory.
You may add as many patterns to a profile name, as you want:
profile music /mnt/audio/music/
profile music /mnt/extern/audio/music/
The above activates the music profile in /mnt/audio/music/ and /mnt/extern/audio/music/, for example.
More than one profile can be activated at the same time. If that is true, the according configuration files are read in lexical order.
Sections versus Profiles
Since arename provides two context sensitive configuration facilities, you might ask yourself when to use which, when you are confronted with both for the first time.
First of all, profiles are more powerful. They may even introduce new hooks for arename to use. But that is not the conceptual difference between the two.
sections are sets of configuration settings, that are considered for each and every input file and they are only enabled for input files, whose name matches the section name.
profiles on the other hand are sets of configuration and hook-definition files, whose inclusion in the current arename run is decided at the beginning of the program's execution (not for every input file) - namely, if the name of the current working directory matches one of the profile's patterns.
That means, that if you need to introduce slight configuration changes based on an input file's name you want to use a section.
If you need to make broader configuration changes, considering the name of the current working directory, profiles are the way to go.
Of course, profile configuration files may introduce new sections, too.