From 1ffc56b85aa396c759b2b476c1529a8d84709f46 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Fri, 17 May 2013 12:07:53 -0700 Subject: [PATCH] doc correction and refactoring for #275 Plugin-provided template fields are not available for queries. (Perhaps they should be, though!) --- beetsplug/missing.py | 14 ++++++++------ docs/plugins/missing.rst | 7 +++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/beetsplug/missing.py b/beetsplug/missing.py index ac1561648..1fcb0d68c 100644 --- a/beetsplug/missing.py +++ b/beetsplug/missing.py @@ -135,17 +135,19 @@ class MissingPlugin(BeetsPlugin): print(sum([_missing_count(a) for a in albums])) return + # Default format string for count mode. + if count and not fmt: + fmt = '$albumartist - $album: $missing' + for album in albums: if count: missing = _missing_count(album) if missing: - if not fmt: - fmt = '$albumartist - $album: $missing' - print_obj(album, lib, fmt=fmt.format(missing)) - continue + print_obj(album, lib, fmt=fmt) - for item in _missing(album): - print_obj(item, lib, fmt=fmt) + else: + for item in _missing(album): + print_obj(item, lib, fmt=fmt) self._command.func = _miss return [self._command] diff --git a/docs/plugins/missing.rst b/docs/plugins/missing.rst index 2418333d5..c128b84b8 100644 --- a/docs/plugins/missing.rst +++ b/docs/plugins/missing.rst @@ -60,12 +60,11 @@ total The ``total`` option (default: false) prints a single count of missing tracks in all albums -Metadata fields +Template Fields --------------- -With this plugin enabled, templates can reference ``$missing`` as they -can any standard metadata field for use in :doc:`Queries -` and :doc:`Path Formats `. +With this plugin enabled, the ``$missing`` template field expands to the +number of tracks missing from each album. Examples --------