Merge branch 'master' into next
[paraslash.git] / README.afs
index e627ca76b9ea7c6d748f38fe633c698e5b100241..edd2d17be98591391a7d3ceab0a820cf12b77763 100644 (file)
@@ -1,10 +1,14 @@
 The audio file selector
 =======================
 
 The audio file selector
 =======================
 
-Paraslash comes with a sophisticated audio file selector called afs.
-In the installation notes, only the "dummy" mode of afs was used which
-gets activated automatically if nothing else was specified. In this
-section the various features of afs are described.
+Paraslash comes with a sophisticated audio file selector called *afs*.
+In the
+<<
+<a href="INSTALL.html">installation notes</a>,
+>>
+only the "dummy" mode of afs was used which gets activated automatically if
+nothing else was specified. In this section the various features of afs are
+described.
 
 ----------
 Attributes
 
 ----------
 Attributes
@@ -27,12 +31,12 @@ an audio file by executing
 
        para_client setatt test+ /path/to/the/audio/file
 
 
        para_client setatt test+ /path/to/the/audio/file
 
-Similarly, the "test" bit can be removed from a audio file with
+Similarly, the "test" bit can be removed from an audio file with
 
        para_client setatt test- /path/to/the/audio/file
 
 
        para_client setatt test- /path/to/the/audio/file
 
-Instead of a path you can also use a pattern, and the attribute is
-applied to all audio files matching that pattern:
+Instead of a path you may use a shell wildcard pattern. The attribute
+is applied to all audio files matching that pattern:
 
        para_client setatt test+ '/test/directory/*'
 
 
        para_client setatt test+ '/test/directory/*'
 
@@ -49,9 +53,9 @@ you find this annoying, just say
 
        alias para='para_client --'
 
 
        alias para='para_client --'
 
-and be happy. In the remainder part this alias is being used.
+and be happy. In what follows we shall use this alias.
 
 
-Drop the test attribute entirely from the database with
+The "test" attribute can be dropped from the database with
 
        para rmatt test
 
 
        para rmatt test
 
@@ -70,13 +74,14 @@ Abstract mood nonsense
 
 [skip this part if you don't like formal definitions]
 
 
 [skip this part if you don't like formal definitions]
 
-A mood consists of a unique name and its *mood definition*, which is a set of
-*mood lines* containing expressions in terms of attributes and other data
-contained in the database.
+A mood consists of a unique name and its *mood definition*, which is
+a set of *mood lines* containing expressions in terms of attributes
+and other data contained in the database.
 
 A mood defines a subset of audio files called the *admissible audio files*
 
 A mood defines a subset of audio files called the *admissible audio files*
-for that mood. A mood can be *active* which means that para_server
-is going to select only files from that subset of admissible files.
+for that mood. At any time, at most one mood can be *active* which
+means that para_server is going to select only files from that subset
+of admissible files.
 
 So in order to create a mood definition one has to write a set of
 mood lines. Mood lines come in three flavours: Accept lines, deny
 
 So in order to create a mood definition one has to write a set of
 mood lines. Mood lines come in three flavours: Accept lines, deny
@@ -95,7 +100,7 @@ a random score to all matching files. The score value changes the
 order in which admissible files are going to be selected, but is of
 minor importance for this introduction.
 
 order in which admissible files are going to be selected, but is of
 minor importance for this introduction.
 
-So we concentrate on the first two forms, that is accept and deny
+So we concentrate on the first two forms, i.e. accept and deny
 lines. As usual, everything in square brackets is optional, i.e.
 accept/deny lines take the following form when ignoring scores:
 
 lines. As usual, everything in square brackets is optional, i.e.
 accept/deny lines take the following form when ignoring scores:
 
@@ -117,12 +122,12 @@ or
 
 The set of admissible files for the whole mood is now defined as those
 files which match at least one accept mood line, but no deny mood line.
 
 The set of admissible files for the whole mood is now defined as those
 files which match at least one accept mood line, but no deny mood line.
-More formally, a file is admissible if and only if
+More formally, an audio file F is admissible if and only if
 
        (F ~ AL1 or F ~ AL2...) and not (F ~ DL1 or F ~ DN2 ...)
 
 
        (F ~ AL1 or F ~ AL2...) and not (F ~ DL1 or F ~ DN2 ...)
 
-where F is the file, AL1, AL2... are the accept lines, DL1, DL2... are
-the deny lines and "~" means "matches".
+where AL1, AL2... are the accept lines, DL1, DL2... are the deny
+lines and "~" means "matches".
 
 The cases where no mood lines of accept/deny type are defined need
 special treatment:
 
 The cases where no mood lines of accept/deny type are defined need
 special treatment:
@@ -146,25 +151,47 @@ special treatment:
 List of mood_methods
 ~~~~~~~~~~~~~~~~~~~~
 
 List of mood_methods
 ~~~~~~~~~~~~~~~~~~~~
 
-       no_attributes_set()
+       no_attributes_set
 
 Takes no arguments and matches an audio file if and only if no
 attributes are set.
 
 
 Takes no arguments and matches an audio file if and only if no
 attributes are set.
 
-       played_rarely()
-
-Takes no arguments and matches all audio files where the number of
-times this audio file was selected is below the average.
-
-       is_set(attribute_name)
+       is_set <attribute_name>
 
 Takes the name of an attribute and matches iff that attribute is set.
 
 
 Takes the name of an attribute and matches iff that attribute is set.
 
-       name_like(pattern)
+       path_matches <pattern>
 
 Takes a filename pattern and matches iff the path of the audio file
 matches the pattern.
 
 
 Takes a filename pattern and matches iff the path of the audio file
 matches the pattern.
 
+       artist_matches <pattern>
+       album_matches <pattern>
+       title_matches <pattern>
+       comment_matches <pattern>
+
+Takes an extended regular expression and matches iff the text of the
+corresponding tag of the audio file matches the pattern. If the tag
+is not set, the empty string is matched against the pattern.
+
+       year ~ <num>
+       bitrate ~ <num>
+       frequency ~ <num>
+       channels ~ <num>
+
+Takes a comparator ~ of the set {<, =, <=, >, >=, !=} and a number
+<num>. Matches an audio file iff the condition <val> ~ <num> is
+satisfied where val is the corresponding value of the audio file
+(bitrate in kbit/s, frequency in Hz, channel count, value of the
+year tag).
+
+The year tag is special as its value is undefined if the audio file
+has no year tag or the content of the year tag is not a number. Such
+audio files never match. Another difference is the special treatment
+if the year tag is a two-digit number. In this case either 1900 or
+2000 are added to the tag value, depending on whether the number is
+greater than 2000 plus the current year.
+
 
 ----------
 Mood usage
 
 ----------
 Mood usage
@@ -188,7 +215,7 @@ the catmood command to get it back:
 
 A mood can be activated by executing
 
 
 A mood can be activated by executing
 
-       para chmood my_mood
+       para select m/my_mood
 
 Once active, the list of admissible files is shown by the ls command
 if the "-a" switch is given:
 
 Once active, the list of admissible files is shown by the ls command
 if the "-a" switch is given:
@@ -219,12 +246,33 @@ songs is
 ---------
 Troubles?
 ---------
 ---------
 Troubles?
 ---------
-If something went wrong, look at the output. If that does not give
-you a clue, use loglevel one (option -l 1 for most commands) to show
+
+Use the debug loglevel (option -l debug for most commands) to show
 debugging info. Almost all paraslash executables have a brief online
 debugging info. Almost all paraslash executables have a brief online
-help which is displayed by using the -h switch.
+help which is displayed by using the -h switch. The --detailed-help
+option prints the full help text.
+
+para_fsck tries to fix your database. Use --force (even if your name
+isn't Luke) to clean up after a crash. However, first make sure
+para_server isn't running before executing para_fsck if para_fsck
+complains about busy (dirty) tables. para_fsck also contains an option
+to dump the contents of the database to the file system.
+
+If you don't mind to recreate your database you can start
+from scratch by removing the entire database directory, i.e.
+
+       rm -rf ~/.paraslash/afs_database
+
+Note that this removes all tables, in particular attribute definitions
+and data, and all playlist and mood definitions.
+
+para_fsck operates on the osl-layer, i.e. it fixes inconsistencies
+in the database but doesn't know about the contents of the tables
+contained therein. Use
+
+       para_client check
+
+to print out bad entries, e.g.missing audio files or invalid mood
+definitions.
 
 
-Still not working? Mail the author Andre Noll <maan@systemlinux.org>
-(english, german, or spanish language). Please provide enough info
-such as the version of paraslash you are using and relevant parts of
-the logs.
+Still having problems? mailto: Andre Noll <maan@systemlinux.org>