Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export plugin can now export path from library. #3084

Merged
merged 1 commit into from
Dec 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion beetsplug/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -239,4 +240,5 @@ def filter_(data):


def identity(val):
val.pop('path', None) # path is fetched from item
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little odd to call this function identity when it's not really an identity function. 😃 I'm going to fiddle around with this a little bit…

return val
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down