Skip to content

Commit 2f67dda

Browse files
authored
Merge pull request #8 from adamjakab/devel
restructuring and documentation
2 parents f261742 + 9292509 commit 2f67dda

12 files changed

+300
-186
lines changed

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
# Created by .ignore support plugin (hsz.mobi)
2-
31
# Project
42
tmp/
53
coverage/
64
BEETSDIR/*
7-
!BEETSDIR/config.yaml
85

96

107
### Python template

BEETSDIR/config.yaml

-60
This file was deleted.

MANIFEST.in

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
prune test
22
include LICENSE.txt
33
include README.md
4-
include beetsplug/xtractor/version.py
5-
include beetsplug/xtractor/config_default.yml
4+
include beetsplug/xtractor/config_default.yml

README.md

+133-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[![Build Status](https://travis-ci.org/adamjakab/BeetsPluginXtractor.svg?branch=master)](https://travis-ci.org/adamjakab/BeetsPluginXtractor)
22
[![Coverage Status](https://coveralls.io/repos/github/adamjakab/BeetsPluginXtractor/badge.svg?branch=master)](https://coveralls.io/github/adamjakab/BeetsPluginXtractor?branch=master)
33
[![PyPi](https://img.shields.io/pypi/v/beets-xtractor.svg)](https://pypi.org/project/beets-xtractor/)
4+
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/beets-xtractor.svg)](https://pypi.org/project/beets-xtractor/)
5+
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE.txt)
46

7+
# Xtractor (Beets Plugin)
58

6-
# Xtractor (beets plugin)
9+
The *beets-xtractor* plugin lets you, through the use of the [Essentia](https://essentia.upf.edu/index.html) extractors, to obtain low and high level musical information about your songs.
710

8-
The *beets-xtractor* plugin lets you use the extractors of the [Essentia](https://essentia.upf.edu/index.html) project developed by the Music Technology Group.
9-
10-
11-
*NOTE: This plugin is highly unstable and not at all documented! Use it at your own risk*
11+
Currently, the following attributes are extracted for each library item: `average_loudness`, `bpm`, `danceable`, `gender`, `genre_rosamerica`, `voice_instrumental`, `mood_acoustic`, `mood_aggressive`, `mood_electronic`, `mood_happy`, `mood_party`, `mood_relaxed`, `mood_sad` (some more to come soon)
1212

1313

1414
## Installation
@@ -17,16 +17,138 @@ The plugin can be installed via:
1717
```shell script
1818
$ pip install beets-xtractor
1919
```
20+
and activated the usual way by adding `xtractor` to the list of plugins in your configuration:
21+
22+
```yaml
23+
plugins:
24+
- xtractor
25+
```
2026
27+
### Install the Essentia extractors
28+
You will also need the two binary extractors from the [Essentia project](#credits). They are called:
2129
22-
## References
23-
[Essentia](https://essentia.upf.edu/index.html)
30+
- streaming_extractor_music
31+
- streaming_extractor_music_svm
32+
33+
Unfortunately, only the first extractor is readily available for download whilst to have the second one you will need to compile it yourself. The [official installation documentation](https://essentia.upf.edu/installing.html) is somewhat complex but with some cross searching on internet you will make it. If you are stuck you can use the [Issue tracker](https://github.com/adamjakab/BeetsPluginXtractor/issues). Make sure you compile with Gaia support (`--with-gaia`) otherwise your second `streaming_extractor_music_svm` will not be built.
34+
35+
### Download the SVM models
36+
The second extractor uses prebuilt trained models for prediction. You need to download these from here: [SVM Models](https://essentia.upf.edu/svm_models/) I suggest that you download the more recent beta5 version. This means that your binaries must match this version. Put the downloaded models in any folder from which they can be accessed.
37+
38+
39+
## Configuration
40+
All your configuration will need to go under the `xtractor` key. This is what your configuration should look like:
41+
42+
```yaml
43+
xtractor:
44+
auto: no
45+
dry-run: no
46+
write: yes
47+
threads: 1
48+
force: no
49+
quiet: no
50+
items_per_run: 0
51+
keep_output: yes
52+
keep_profiles: no
53+
output_path: /mnt/data/xtraction_data
54+
low_level_extractor: /mnt/data/extractors/beta5/streaming_extractor_music
55+
high_level_extractor: /mnt/data/extractors/beta5/streaming_extractor_music_svm
56+
high_level_profile:
57+
highlevel:
58+
svm_models:
59+
- /mnt/data/extractors/beta5/svm_models/danceability.history
60+
- /mnt/data/extractors/beta5/svm_models/gender.history
61+
- /mnt/data/extractors/beta5/svm_models/genre_rosamerica.history
62+
- /mnt/data/extractors/beta5/svm_models/mood_acoustic.history
63+
- /mnt/data/extractors/beta5/svm_models/mood_aggressive.history
64+
- /mnt/data/extractors/beta5/svm_models/mood_electronic.history
65+
- /mnt/data/extractors/beta5/svm_models/mood_happy.history
66+
- /mnt/data/extractors/beta5/svm_models/mood_party.history
67+
- /mnt/data/extractors/beta5/svm_models/mood_relaxed.history
68+
- /mnt/data/extractors/beta5/svm_models/mood_sad.history
69+
- /mnt/data/extractors/beta5/svm_models/voice_instrumental.history
70+
```
71+
72+
First of all, you will need adjust all paths. Put the paths of the extractor binaries in `low_level_extractor`and `high_level_extractor`, substitute the location of the SVM models with your local path under the `svm_models` desction. And finally, set the `output_path` to indicate where the extracted data files will be stored. I you do not set this, a temporary path will be used.
73+
74+
By default both `keep_output` and `keep_profile` options are set to `no`. This means that after extraction (and the storage of the important information) the profile files used to pass to the extractors and the json files created by the extractors will be deleted. There are various reasons you might want to keep these files. One is for debugging purposes. Another is to see what else is in these files (there is a lot) and maybe to use them with some other projects of yours. Lastly, you might want to keep these because the plugin only extracts data if these files are not present. If you store them, on a successive extraction, the plugin will skip the extraction and use these files (they are named by `mb_trackid`) - speeding up the process a lot.
75+
76+
The `items_per_run` set to 0 will execute on all items. If you want to limit the number of items per execution (maybe because you want to run a nightly cron job in a limited timeframe) you can use this.
77+
78+
The `force` option instructs the plugin to execute on items which already have the required properties.
79+
80+
The `threads` option sets the number of concurrent executions. If you remove this option the number of cores present on your machine will be used. The extraction is quite a CPU intensive process so there might be cases when you want to limit it to just 1.
81+
82+
The `write` option instructs the plugin to write the extracted attributes to the media file right away. Note that only `bpm` is actually written to the media file, all the other attributes are flex attributes and are only stored in the database.
83+
84+
The `dry-run` option shows what would be done without actually doing it.
85+
86+
**NOTE**: Please note that the `auto` option is not yet implemented. For now you will have to call the xtractor plugin manually.
87+
88+
## Usage
89+
90+
Invoke the plugin as:
2491

25-
[SVM Models](https://essentia.upf.edu/svm_models/)
92+
$ beet xtractor [options] [QUERY...]
93+
94+
For a more verbose reporting use the `-v` flag on `beet`:
2695

27-
[Essentia Licensing](https://essentia.upf.edu/licensing_information.html)
96+
$ beet -v xtractor [options] [QUERY...]
97+
98+
The plugin has also got a shorthand `xt` so you can also invoke it like this:
99+
100+
$ beet xt [options] [QUERY...]
101+
102+
103+
The following command line options are available:
104+
105+
**--dry-run [-d]**: Only show what would be done - displays the extracted values but does not store them in the library.
106+
107+
**--write [-w]**: Write the values (bpm only) to the media files.
108+
109+
**--threads=THREADS [-t THREADS]**: The number of concurrently running executions.
110+
111+
**--force [-f]**: Force the analysis of all items (skip attribute checks).
112+
113+
**--count-only [-c]**: Show the number of items to be processed and exit. Extraction will not be executed.
114+
115+
**--quiet [-q]**: Run without any output.
116+
117+
**--version [-v]**: Display the version number of the plugin. Useful when you need to report some issue and you have to state the version of the plugin you are using.
118+
119+
These command line options will override those specified in the configuration file.
120+
121+
122+
## Issues
123+
- If something is not working as expected please use the Issue tracker.
124+
- If the documentation is not clear please use the Issue tracker.
125+
- If you have a feature request please use the Issue tracker.
126+
- In any other situation please use the Issue tracker.
127+
128+
129+
## Other plugins by the same author
130+
131+
- [beets-goingrunning](https://github.com/adamjakab/BeetsPluginGoingRunning)
132+
- [beets-xtractor](https://github.com/adamjakab/BeetsPluginXtractor)
133+
- [beets-yearfixer](https://github.com/adamjakab/BeetsPluginYearFixer)
134+
- [beets-autofix](https://github.com/adamjakab/BeetsPluginAutofix)
135+
- [beets-describe](https://github.com/adamjakab/BeetsPluginDescribe)
136+
- [beets-bpmanalyser](https://github.com/adamjakab/BeetsPluginBpmAnalyser)
137+
- [beets-template](https://github.com/adamjakab/BeetsPluginTemplate)
138+
139+
140+
## Credits
141+
Essentia is an open-source C++ library with Python bindings for audio analysis and audio-based music information retrieval. It is released under the Affero GPLv3 license and is also available under proprietary license upon request. This plugin is just a mere wrapper around this library. [Learn more about the Essentia project](http://essentia.upf.edu)
142+
143+
144+
## References
145+
- [Essentia](https://essentia.upf.edu/index.html)
146+
- [SVM Models](https://essentia.upf.edu/svm_models/)
147+
- [Essentia Licensing](https://essentia.upf.edu/licensing_information.html)
148+
- [MTG Github - Music Technology Group](https://github.com/MTG)
149+
- [Acousticbrainz Downloads](https://acousticbrainz.org/download)
28150

29-
[MTG Github - Music Technology Group](https://github.com/MTG)
30151

31-
[Acousticbrainz Downloads](https://acousticbrainz.org/download)
152+
## Final Remarks
153+
Enjoy!
32154

beetsplug/xtractor/about.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright: Copyright (c) 2020., Adam Jakab
2+
# Author: Adam Jakab <adam at jakab dot pro>
3+
# License: See LICENSE.txt
4+
5+
__author__ = u'Adam Jakab'
6+
__email__ = u'[email protected]'
7+
__copyright__ = u'Copyright (c) 2020, {} <{}>'.format(__author__, __email__)
8+
__license__ = u'License :: OSI Approved :: MIT License'
9+
__version__ = u'0.2.3'
10+
__status__ = u'Kickstarted'
11+
12+
__PACKAGE_TITLE__ = u'Xtractor'
13+
__PACKAGE_NAME__ = u'beets-xtractor'
14+
__PACKAGE_DESCRIPTION__ = u'A beets plugin that extracts music descriptors ' \
15+
u'from your audio files',
16+
__PACKAGE_URL__ = u'https://github.com/adamjakab/BeetsPluginXtractor'
17+
__PLUGIN_NAME__ = u'xtractor'
18+
__PLUGIN_ALIAS__ = u'xt'
19+
__PLUGIN_SHORT_DESCRIPTION__ = u'get more out of your music...'

0 commit comments

Comments
 (0)