From 5de3ee9a5f82afab6a69246352e591b7e208359d Mon Sep 17 00:00:00 2001 From: Domen Date: Wed, 28 Nov 2018 16:04:25 +0100 Subject: [PATCH] Export plugin can now export path from library, if explicitly specified as field to export. Info plugin behaviour is unchanged. --- beetsplug/info.py | 4 +++- docs/changelog.rst | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/beetsplug/info.py b/beetsplug/info.py index 0d40c597b4..31251790a1 100644 --- a/beetsplug/info.py +++ b/beetsplug/info.py @@ -66,7 +66,6 @@ def library_data(lib, args): def library_data_emitter(item): def emitter(): data = dict(item.formatted()) - data.pop('path', None) # path is fetched from item return data, item return emitter @@ -184,6 +183,8 @@ def run(self, lib, opts, args): included_keys = [] for keys in opts.included_keys: included_keys.extend(keys.split(',')) + # Drop path even if user provides it multiple times + included_keys = [k for k in included_keys if k != 'path'] key_filter = make_key_filter(included_keys) first = True @@ -239,4 +240,5 @@ def filter_(data): def identity(val): + val.pop('path', None) # path is fetched from item return val diff --git a/docs/changelog.rst b/docs/changelog.rst index 61e2443103..cdd14a86a1 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -53,6 +53,8 @@ Changes: ``mb_albumid`` or ``mb_trackid`` field is invalid See also the discussion on Google Groups_ Thanks to :user:`arogl`. +* :doc:`/plugins/export` now also exports ``path`` field if user explicitly + specifies it with ``-i`` parameter. Only works when exporting library fields. .. _Groups: https://groups.google.com/forum/#!searchin/beets-users/mbsync|sort:date/beets-users/iwCF6bNdh9A/i1xl4Gx8BQAJ