Skip to content

Commit

Permalink
Document the %sunique template
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimeMF committed Aug 17, 2022
1 parent f641df0 commit 6aa9804
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ New features:
* :ref:`import-options`: Add support for re-running the importer on paths in
log files that were created with the ``-l`` (or ``--logfile``) argument.
:bug:`4379` :bug:`4387`
* Add :ref:`%sunique{} <sunique>` template to disambiguate between singletons.
:bug:`4438`

Bug fixes:

Expand Down
17 changes: 17 additions & 0 deletions docs/reference/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,23 @@ The defaults look like this::

See :ref:`aunique` for more details.

.. _config-sunique:

sunique
~~~~~~~

These options are used to generate a string that is guaranteed to be unique
among all singletons in the library who share the same set of keys.

The defaults look like this::

sunique:
keys: artist title
disambiguators: year trackdisambig
bracket: '[]'

See :ref:`sunique` for more details.


.. _terminal_encoding:

Expand Down
14 changes: 14 additions & 0 deletions docs/reference/pathformat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ These functions are built in to beets:
option.
* ``%aunique{identifiers,disambiguators,brackets}``: Provides a unique string
to disambiguate similar albums in the database. See :ref:`aunique`, below.
* ``%sunique{identifiers,disambiguators,brackets}``: Provides a unique string
to disambiguate similar singletons in the database. See :ref:`sunique`, below.
* ``%time{date_time,format}``: Return the date and time in any format accepted
by `strftime`_. For example, to get the year some music was added to your
library, use ``%time{$added,%Y}``.
Expand Down Expand Up @@ -145,6 +147,18 @@ its import time. Only the second album will receive a disambiguation string. If
you want to add the disambiguation string to both albums, just run ``beet move``
(possibly restricted by a query) to update the paths for the albums.

.. _sunique:

Singleton Disambiguation
------------------------

It is also possible to have singleton tracks with the same name and the same
artist. Beets provides the ``%sunique{}`` template to avoid having the same
file path.

It has the same arguments as the :ref:`%aunique <aunique>` template, but the default
values are different. The default identifiers are ``artist title`` and the
default disambiguators are ``year trackdisambig``.

Syntax Details
--------------
Expand Down

0 comments on commit 6aa9804

Please sign in to comment.