Commit graph

23 commits

Author SHA1 Message Date
Sam Thursfield
b7ccb6f516 export,info: Improve performance of --library mode
The library mode was slow due to use of item.formatted(), which
runs multiple database queries per item. The --include-keys option
didn't help because it filtered the after the queries had already
happened.

This commit reworks filtering so that we only query the fields
that the user requests. In many cases this can dramatically speed up
execution.

Before:

    > /usr/bin/time beet  export -l Bob Dylan > /dev/null
    13.42user 21.56system 0:35.71elapsed 97%CPU (0avgtext+0avgdata 52396maxresident)k

    > /usr/bin/time beet  export -l -i artist,title,path Bob Dylan > /dev/null
    13.25user 21.17system 0:35.14elapsed 97%CPU (0avgtext+0avgdata 52112maxresident)k

After:

    > /usr/bin/time beet  export -l Bob Dylan > /dev/null
    1.46user 0.09system 0:01.60elapsed 97%CPU (0avgtext+0avgdata 51188maxresident)k

    > /usr/bin/time beet  export -l -i artist,title,path Bob Dylan > /dev/null
    0.50user 0.07system 0:00.58elapsed 97%CPU (0avgtext+0avgdata 50632maxresident)k
2020-09-30 20:12:02 +02:00
Sam Thursfield
aae422eaf2 export: Correctly export 'path' field when requested
This fixes a crash that could be seen by running:

    beet export --include=path .
2020-09-30 20:05:05 +02:00
Sam Thursfield
591038d246 export: Add --format=jsonlines option
This adds support for the JSON Lines format as documented at
https://jsonlines.org/.

In this mode the data is output incrementally, whereas the other
modes load every item into memory and don't produce output until
the end.
2020-09-30 17:36:23 +02:00
Jef LeCompte
9f8bd4cd3f
style: flake8 linting 2020-05-25 20:06:43 -04:00
Jef LeCompte
0c3201930c
feat: added github actions
only working with linux for now. exact replica of travis basically.
should probably try to implement the rest of tox or deprecate some
functionality.
2020-05-25 19:35:15 -04:00
Austin Marino
7f6630c006 removed xml configs from doc and code 2019-10-15 14:16:23 -07:00
Austin Marino
eb6055eeca Cleaned up comments and code 2019-10-15 11:45:01 -07:00
Austin Marino
4251ff70dc updated the way in which xml is outputted 2019-10-15 00:15:45 -07:00
Austin Marino
0d818eced5 Ran test to ensure it works 2019-10-14 17:02:39 -07:00
Austin Marino
fa2c9ba259 Aligned export related code with flake8 standards 2019-10-13 11:36:33 -07:00
Austin Marino
ec705fae1e Updated documents and comments to reflcet recent code changes. Cleaned up code to better follow PEP-8 conventions and just work more efficiently all around. 2019-10-12 15:41:06 -07:00
Austin Marino
0e2c1e0d56 Made changes to reflect comments and suggestions made by sampsyo 2019-10-12 14:47:44 -07:00
Austin Marino
c31b488e54 Updated class fields to allow for easier unit testing 2019-10-10 19:35:49 -07:00
Austin Marino
a8a480a691 Updated config formats 2019-10-10 16:33:46 -07:00
Austin Marino
e5b43d4bf4 Extended the file type export options to include not only JSON but also XML and CSV 2019-10-09 00:52:49 -07:00
Carl Suster
546bf3af7e mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
Jack Wilsdon
b1c58e99ec Update code to match pep8 naming standards 2016-04-27 20:15:10 +01:00
Guilherme Danno
228ffc91be use sort_keys to make the data more "predictable" 2016-04-17 23:47:12 -03:00
Guilherme Danno
5e3c65d32e change option letter 2016-04-17 23:37:51 -03:00
Guilherme Danno
10acea4efd Remove json monkey-patching and use encoder subclassing 2016-04-17 23:35:23 -03:00
Guilherme Danno
1e3704a27e fix NotImplementedError() 2016-04-17 21:52:09 -03:00
Guilherme Danno
c211aabd72 simplify json printing 2016-04-17 21:39:53 -03:00
Guilherme Danno
f58d4e838a Query data from items and export the json
Based on the ``info`` plugin
2016-04-17 18:26:17 -03:00