Skip to content

Commit 97f182c

Browse files
committed
new pipeline
1 parent ef14a4b commit 97f182c

File tree

6 files changed

+123
-112
lines changed

6 files changed

+123
-112
lines changed

.github/workflows/pythonpublish.yml

-28
This file was deleted.
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Test & Release & Deploy
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
test:
10+
name: Test
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Python (${{ matrix.python-version }})
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install beets alive-progress
25+
pip install pytest nose coverage mock six pyyaml requests
26+
- name: Test
27+
run: |
28+
pytest
29+
release:
30+
name: Release
31+
runs-on: ubuntu-latest
32+
needs: ["test"]
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Create Release
36+
uses: ncipollo/release-action@v1
37+
# ref.: https://github.com/ncipollo/release-action
38+
with:
39+
name: ${{ github.ref_name }}
40+
draft: false
41+
generateReleaseNotes: true
42+
deploy:
43+
name: Deploy
44+
runs-on: ubuntu-latest
45+
needs: ["release"]
46+
steps:
47+
- uses: actions/checkout@v4
48+
- name: Set up Python
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: "3.12"
52+
- name: Install dependencies
53+
run: |
54+
python -m pip install --upgrade pip
55+
pip install build twine
56+
- name: Build and publish
57+
env:
58+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
59+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
60+
run: |
61+
python -m build
62+
twine check dist/*
63+
twine upload dist/*

README.md

+48-52
Original file line numberDiff line numberDiff line change
@@ -5,87 +5,87 @@
55

66
# Xtractor (Beets Plugin)
77

8-
The *beets-xtractor* plugin lets you, through the use of the [Essentia](https://essentia.upf.edu/index.html) extractors,
8+
The _beets-xtractor_ plugin lets you, through the use of the [Essentia](https://essentia.upf.edu/index.html) extractors,
99
to obtain low and high level musical information from your songs.
1010

1111
Currently, the following attributes are extracted for each library item:
12-
`bpm`, `danceability`, `beats_count`, `average_loudness`, `danceable`, `gender`, `is_male`, `is_female`,
12+
`bpm`, `danceability`, `beats_count`, `average_loudness`, `danceable`, `gender`, `is_male`, `is_female`,
1313
`genre_rosamerica`, `voice_instrumental`, `is_voice`, `is_instrumental`, `mood_acoustic`,
1414
`mood_aggressive`, `mood_electronic`, `mood_happy`, `mood_sad`, `mood_party`, `mood_relaxed`, `mood_mirex`,
1515
`mood_mirex_cluster_1`, `mood_mirex_cluster_2`, `mood_mirex_cluster_3`, `mood_mirex_cluster_4`, `mood_mirex_cluster_5`
1616

1717
## Installation
18+
1819
The plugin can be installed via:
1920

2021
```shell script
21-
$ pip install beets-xtractor
22+
pip install beets-xtractor
2223
```
24+
2325
and activated the usual way by adding `xtractor` to the list of plugins in your configuration:
2426

2527
```yaml
2628
plugins:
27-
- xtractor
29+
- xtractor
2830
```
2931
3032
### Install the Essentia extractors
3133
32-
You will also need the `streaming_extractor_music` binary extractor from the [Essentia project](#credits). You will need
33-
to compile this extractor yourself.
34-
The [official installation documentation](https://essentia.upf.edu/installing.html#compiling-essentia-from-source)
35-
is somewhat complex but with some cross searching on the internet you will make it. If you are stuck you can use
36-
the [Issue tracker](https://github.com/adamjakab/BeetsPluginXtractor/issues). Make sure you compile it with Gaia
37-
support (`--with-gaia`) otherwise will not be able to use the high level models.
38-
34+
You will also need the `streaming_extractor_music` binary extractor from the [Essentia project](#credits).
35+
Please refer to the [official installation documentation](https://essentia.upf.edu/installing.html#compiling-essentia-from-source)
36+
for the installation procedure for your OS. If you are stuck you can use
37+
the [Issue tracker](https://github.com/adamjakab/BeetsPluginXtractor/issues). If you are compiling Essentia from source,
38+
make sure you compile it with Gaia support (`--with-gaia`) otherwise will not be able to use the high level models.
3939

4040
### Download the SVM models
4141

42-
The second extractor uses prebuilt trained models for prediction. You need to download these from
43-
here: [SVM Models](https://essentia.upf.edu/svm_models/). I suggest that you download the more recent beta5 version.
42+
For computing the high-level descriptors you will need the prebuilt trained models for prediction. You need to download these from
43+
here: [SVM Models](https://essentia.upf.edu/svm_models/). I suggest that you download the most recent beta5 version.
4444
This means that your binaries must match this version. Put the downloaded models in any folder from which they can be
4545
accessed.
4646

47-
4847
## Configuration
48+
4949
All your configuration will need to go under the `xtractor` key. This is what your configuration should look like:
5050

5151
```yaml
5252
xtractor:
53-
auto: no
54-
dry-run: no
55-
write: yes
56-
threads: 1
57-
force: no
58-
quiet: no
59-
keep_output: yes
60-
keep_profiles: no
61-
output_path: /mnt/data/xtraction_data
62-
essentia_extractor: /mnt/data/extractors/beta5/streaming_extractor_music
63-
extractor_profile:
64-
highlevel:
65-
svm_models:
66-
- /mnt/data/extractors/beta5/svm_models/danceability.history
67-
- /mnt/data/extractors/beta5/svm_models/gender.history
68-
- /mnt/data/extractors/beta5/svm_models/genre_rosamerica.history
69-
- /mnt/data/extractors/beta5/svm_models/mood_acoustic.history
70-
- /mnt/data/extractors/beta5/svm_models/mood_aggressive.history
71-
- /mnt/data/extractors/beta5/svm_models/mood_electronic.history
72-
- /mnt/data/extractors/beta5/svm_models/mood_happy.history
73-
- /mnt/data/extractors/beta5/svm_models/mood_sad.history
74-
- /mnt/data/extractors/beta5/svm_models/mood_party.history
75-
- /mnt/data/extractors/beta5/svm_models/mood_relaxed.history
76-
- /mnt/data/extractors/beta5/svm_models/voice_instrumental.history
77-
- /mnt/data/extractors/beta5/svm_models/moods_mirex.history
53+
auto: no
54+
dry-run: no
55+
write: yes
56+
threads: 1
57+
force: no
58+
quiet: no
59+
keep_output: yes
60+
keep_profiles: no
61+
output_path: /mnt/data/xtraction_data
62+
essentia_extractor: /mnt/data/extractors/beta5/streaming_extractor_music
63+
extractor_profile:
64+
highlevel:
65+
svm_models:
66+
- /mnt/data/extractors/beta5/svm_models/danceability.history
67+
- /mnt/data/extractors/beta5/svm_models/gender.history
68+
- /mnt/data/extractors/beta5/svm_models/genre_rosamerica.history
69+
- /mnt/data/extractors/beta5/svm_models/mood_acoustic.history
70+
- /mnt/data/extractors/beta5/svm_models/mood_aggressive.history
71+
- /mnt/data/extractors/beta5/svm_models/mood_electronic.history
72+
- /mnt/data/extractors/beta5/svm_models/mood_happy.history
73+
- /mnt/data/extractors/beta5/svm_models/mood_sad.history
74+
- /mnt/data/extractors/beta5/svm_models/mood_party.history
75+
- /mnt/data/extractors/beta5/svm_models/mood_relaxed.history
76+
- /mnt/data/extractors/beta5/svm_models/voice_instrumental.history
77+
- /mnt/data/extractors/beta5/svm_models/moods_mirex.history
7878
```
7979

8080
First of all, you will need adjust all paths. Put the path of the extractor binary in `essentia_extractor` and
8181
substitute the location of the SVM models with your local path under the `svm_models` section. Finally, set
8282
the `output_path` to indicate where the extracted data files will be stored. If you do not set this, a temporary path
83-
will be used.
83+
will be used.
8484

85-
**Note on shell tilde expansion**: Please note that you cannot use shell expansion on the `svm_models` (i.e.: do not use `~` for your home folder).
85+
**Note on shell tilde expansion**: Please note that you cannot use shell expansion on the `svm_models` (i.e.: do not use `~` for your home folder).
8686
The entire section of `extractor_profile` is passed as-is to the essentia extractor binary and it will not do tilde expansion on your paths.
8787
The rest of the path keys such as `essentia_extractor` and `output_path` are used by the plugin itself and it will take
88-
care of expanding the tilde symbol (`~`) to the home directory of the user running the script.
88+
care of expanding the tilde symbol (`~`) to the home directory of the user running the script.
8989

9090
By default both `keep_output` and `keep_profile` options are set to `no`. This means that after extraction (and the
9191
storage of the important information) the profile files used to pass to the extractors, and the json files created by
@@ -107,22 +107,20 @@ The `dry-run` option shows what would be done without actually doing it.
107107

108108
**NOTE**: Please note that the `auto` option is not yet implemented. For now you will have to call the xtractor plugin manually.
109109

110-
111110
## Usage
112111

113112
Invoke the plugin as:
114113

115114
$ beet xtractor [options] [QUERY...]
116-
115+
117116
For a more verbose reporting use the `-v` flag on `beet`:
118117

119118
$ beet -v xtractor [options] [QUERY...]
120-
119+
121120
The plugin has also got a shorthand `xt` so you can also invoke it like this:
122121

123122
$ beet xt [options] [QUERY...]
124123

125-
126124
The following command line options are available:
127125

128126
**--dry-run [-d]**: Only show what would be done - displays the extracted values but does not store them in the library.
@@ -141,14 +139,13 @@ The following command line options are available:
141139

142140
These command line options will override those specified in the configuration file.
143141

144-
145142
## Issues
143+
146144
- If something is not working as expected please use the Issue tracker.
147145
- If the documentation is not clear please use the Issue tracker.
148146
- If you have a feature request please use the Issue tracker.
149147
- In any other situation please use the Issue tracker.
150148

151-
152149
## Other plugins by the same author
153150

154151
- [beets-goingrunning](https://github.com/adamjakab/BeetsPluginGoingRunning)
@@ -159,19 +156,18 @@ These command line options will override those specified in the configuration fi
159156
- [beets-bpmanalyser](https://github.com/adamjakab/BeetsPluginBpmAnalyser)
160157
- [beets-template](https://github.com/adamjakab/BeetsPluginTemplate)
161158

162-
163159
## Credits
164-
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)
165160

161+
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)
166162

167163
## References
164+
168165
- [Essentia](https://essentia.upf.edu/index.html)
169166
- [SVM Models](https://essentia.upf.edu/svm_models/)
170167
- [Essentia Licensing](https://essentia.upf.edu/licensing_information.html)
171168
- [MTG Github - Music Technology Group](https://github.com/MTG)
172169
- [Acousticbrainz Downloads](https://acousticbrainz.org/download)
173170

174-
175171
## Final Remarks
176-
Enjoy!
177172

173+
Enjoy!

beetsplug/xtractor/command.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@
22
# Author: Adam Jakab <adam at jakab dot pro>
33
# License: See LICENSE.txt
44

5+
from concurrent import futures
56
import hashlib
67
import json
7-
import os
88
import multiprocessing
9-
import tempfile
10-
from concurrent import futures
119
from optparse import OptionParser
10+
import os
1211
from subprocess import Popen, PIPE
12+
import tempfile
1313

1414
import yaml
15+
1516
from beets import dbcore
1617
from beets.library import Library, Item, parse_query_string
1718
from beets.ui import Subcommand, decargs
18-
from confuse import Subview
1919
from beetsplug.xtractor import helper
20+
from confuse import Subview
2021

2122

2223
class XtractorCommand(Subcommand):

setup.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@
3737
test_suite='test',
3838
packages=['beetsplug.xtractor'],
3939

40-
python_requires='>=3.6',
40+
python_requires='>=3.8',
4141

4242
install_requires=[
4343
'beets>=1.4.9',
44-
'PyYAML'
44+
'pyyaml'
4545
],
4646

4747
tests_require=[
4848
'pytest', 'nose', 'coverage',
49-
'mock', 'six', 'yaml',
49+
'mock', 'six', 'pyyaml',
5050
],
5151

5252
# Extras needed during testing
@@ -59,8 +59,10 @@
5959
'License :: OSI Approved :: MIT License',
6060
'Environment :: Console',
6161
'Programming Language :: Python :: 3',
62-
'Programming Language :: Python :: 3.6',
63-
'Programming Language :: Python :: 3.7',
6462
'Programming Language :: Python :: 3.8',
63+
'Programming Language :: Python :: 3.9',
64+
'Programming Language :: Python :: 3.10',
65+
'Programming Language :: Python :: 3.11',
66+
'Programming Language :: Python :: 3.12',
6567
],
6668
)

tox.ini

-23
This file was deleted.

0 commit comments

Comments
 (0)