11715 Commits
Author SHA1 Message Date
Serene b88c09720c Add a workflow for easily creating releases (#4952)
I humbly present a solution our lack of releases: a workflow that can be
triggered to automatically create one. This workflow builds the project,
creates a GitHub release, and publishes beets to PyPi, for a one-stop
solution.

@sampsyo this would make it much easier to create releases, as it
requires only one little interaction: going to the actions tab and
entering a version number. Once that's done, the workflow should take
care of the rest.

I have only tested the `build` job so far, since I can't do anything
about the pypi or do a release just to test, but the code is lifted from
other similar actions and should work fine.

It also requires one piece of setup. This is that PyPi must be set up
with a [trusted publisher](https://docs.pypi.org/trusted-publishers/) to
receive the new package. Once that's done, the process should go off
automatically.
v2.0.0
2024-05-30 08:57:02 +10:00
Šarūnas Nejus c75f07a0da Define paths to lint in mypy configuration 2024-05-07 21:16:24 +01:00
Šarūnas Nejus 1713011089 Move mypy configuration to setup.cfg 2024-05-07 21:16:24 +01:00
Benedikt 329098a0b4 Merge pull request #5220 from snejus/improve-build-output-and-coverage
Improve GitHub build output and configure coverage
2024-05-04 12:21:51 +02:00
Šarūnas Nejus cdaefe698c Show diff when isort or black fails 2024-05-04 10:24:28 +01:00
Šarūnas Nejus 8b4983fe7c Add pytest and coverage configuration
Add `pytest-cov` which automatically measures coverage while tests are
executing and update tox and ci build configuration accordingly.

Add configuration for coverage:
  1. Enable analysing logical branches
  2. Save coverage details as HTML for local development use
  3. Configure the HTML output to include coverage context: on the
     right-hand side of each covered code line there is an expandable
     section which lists every test that ran that line.
2024-05-04 10:24:28 +01:00
Šarūnas Nejus 34a59f98b3 Merge pull request #5210 from snejus/add-in-query-and-remove-named-query
Enforce the same interface across all `...Query` implementations

### Make `PlaylistQuery` a `FieldQuery`
While working on the DB optimization and looking at updates upstream I discovered one query which does not follow the `FieldQuery` interface —`PlaylistQuery`, so I looked into it in more detail and ended up integrating it as a `FieldQuery`.

One special thing about it is that it uses **IN** SQL operator, so I added implementation for this sort of query outside the playlist context, see `InQuery`.

Otherwise, it seems like `PlaylistQuery` is a field query with a special way of resolving values it wants to query. In the future, we may want to consider moving this kind of custom _initialization_ logic away from `init` methods to factory/@classmethod: this should make it more clear that the purpose of such logic is to resolve the data that is required to define a particular `FieldQuery` class fully.


### Remove `NamedQuery` since it is unused

This simplifies query parsing logic in `queryparse.py`. We know that this logic can only receive `FieldQuery` classes thus I adjusted types and removed the logic that handles other cases.

Effectively, this means that the query parsing logic does not need to care whether the query is named by the corresponding DB field. Instead, queries like `SingletonQuery` and `PlaylistQuery` are initialized with the same data as others and take things from there themselves: in this case they translate `singleton` and `playlist` queries to the underlying DB filters.
2024-05-01 16:36:52 +01:00
Šarūnas Nejus b5e98b59f2 Configure mypy to require types for generics 2024-04-30 22:20:37 +01:00
Šarūnas Nejus 7d636d8f22 Add support for a specific type in InQuery 2024-04-30 22:20:36 +01:00
Šarūnas Nejus a57c164348 Remove NamedQuery
Remove 'NamedQuery' since it is not being used by any queries any more.

This simplifies query parsing logic in 'queryparse.py'. We know that
this logic can only receive 'FieldQuery' thus I adjusted types and
removed the logic that handles other cases.

Effectively, this means that the query parsing logic does not any more
care whether the query is named by the corresponding DB field. Instead,
queries like 'SingletonQuery' and 'PlaylistQuery' are responsible for
translating 'singleton' and 'playlist' to the underlying DB filters.
2024-04-30 22:20:36 +01:00
Šarūnas Nejus 68eee96c03 Define InQuery and use it in PlaylistQuery
While working on the DB optimisation I discovered one query which does
not follow the 'FieldQuery' interface - 'PlaylistQuery', so I looked
into it in more detail.

One special thing about it is that it uses 'IN' SQL operator, so
I defined 'InQuery' query class to have this logic outside of the
playlist context.

Otherwise, it seems like 'PlaylistQuery' is a field query, even if it
has a very special way of resolving values it wants to query. In the
future, we may want to consider moving this kind of custom
_initialisation_ logic away from '__init__' methods to
factory/@classmethod: this should make it more clear that the purpose of
such logic is to resolve the data that is required to define
a particular FieldQuery class fully.
2024-04-30 22:20:36 +01:00
Šarūnas Nejus 4354ba4f97 Merge pull request #5214 from beetbox/handle-null-path
Handle NULL values in the path column
2024-04-30 19:53:26 +01:00
Šarūnas Nejus 065f091656 Handle NULL values in the path column
As I was devving, I did something wrong and had 'beet mv' command fail on me.

Later, having spent an hour investigating why beets kept throwing me
'User-defined function raised exception' I discovered that it was
failing because that previous 'beet mv' command ended up writing value
'NULL' in one of the items 'path' column. This was not handled well by
the 'BYTELOWER' implementation.

Since we do not have a NOT NULL constraint for the 'path' column, it's
best to insure ourselves against this kind of stuff anyways.
2024-04-30 17:13:17 +01:00
Serene 92fb830559 Merge pull request #5212 from wisp3rwind/lyrics-cleanup
lyrics: remove version switch that became obsolete when we dropped Python 3.5
2024-04-28 19:13:18 +10:00
wisp3rwind a9423b7b2d lyrics: remove version switch that became obsolete when we dropped Python 3.5 2024-04-27 16:02:26 +02:00
Serene 7543a351ed Merge pull request #5184 from freddiewanah/master
Enhancement: Refactor Test Code for Efficiency and Quality
2024-04-21 09:06:38 +10:00
Han Wang f46bbbdb60 Revert back to time.sleep
Signed-off-by: Han Wang <freddie.wanah@gmail.com>
2024-04-20 21:33:35 +01:00
J0J0 Todos d510177820 Merge pull request #5121 from mgoltzsche/generate-playlist-item-attributes 2024-04-20 08:04:32 +02:00
Max Goltzsche 2e9308f713 docs: mention autogenre plugin 2024-04-20 05:33:48 +02:00
Max Goltzsche 2821eac973 docs: add smartplaylist example config and m3u 2024-04-20 05:33:20 +02:00
Han Wang e2cef11249 reformat test file to pass the formatting check.
Signed-off-by: Han Wang <freddie.wanah@gmail.com>
2024-04-18 20:25:08 +01:00
Serene 3adca9769b Merge pull request #5191 from ktetzlaff/config-edit--prefer-visual-over-editor
Prefer VISUAL environment variable over EDITOR (for e.g. `beet config -e`)
2024-04-16 12:47:48 +10:00
ktetzlaff b47635dc29 Prefer VISUAL environment variable over EDITOR
When unix tools make use of an external editor, they typically check the
environment variable VISUAL and fall back to EDITOR. This commit adds the
additional check for VISUAL to the existing EDITOR check (where VISUAL is
preferred over EDITOR).
2024-04-14 12:15:30 +02:00
Serene 125f26fdb1 Merge pull request #5160 from Dr-Blank/bug-unimported-failing-to-ignore-subdirectories 2024-04-14 12:58:53 +10:00
Max Goltzsche 3c6309fe22 docs: mention Beetstream and webrouter plugins
Also, moves the webm3u plugin link from tne interoperability section to the "Other Plugins" section of the documentation.
2024-04-13 04:55:43 +02:00
Max Goltzsche 883bbb3e4b smartplaylist: rename output format m3u8 to extm3u 2024-04-13 04:55:43 +02:00
Max Goltzsche c0afd3eb3c smartplaylist: allow exporting item fields
Allow generating extm3u playlists so that they contain additional item fields such as the `id`.

The feature is required by the mgoltzsche/beets-webm3u plugin (M3U server) to transform playlists using a request based item URI template which may require additional fields such as the `id`, e.g. `beets:library:track;$id`.
2024-04-13 04:55:37 +02:00
Serene cc941df025 Merge pull request #5187 from Dr-Blank/missing-changelog 2024-04-12 21:10:50 +10:00
SereneandDr.Blank 5793635a39 Remove redundant checks
Co-authored-by: Dr.Blank <64108942+Dr-Blank@users.noreply.github.com>
2024-04-12 11:28:05 +10:00
Dr-Blank c3e922e2d2 missing changelog for #5153 2024-04-11 14:12:46 -04:00
freddiewanah c64d3e3f24 fix logic issue 2024-04-11 19:04:50 +02:00
Dr-Blank 640c9613c0 add changelog for bug fix 2024-04-11 13:01:04 -04:00
freddiewanah dba24a7d96 reformat with black 2024-04-11 18:44:32 +02:00
freddiewanah 52271bc093 update changelog 2024-04-10 15:57:37 +02:00
freddiewanah a3b5101d1a resort the import library 2024-04-10 15:40:40 +02:00
freddiewanah 96c9a9531f update lint issues 2024-04-10 15:21:57 +02:00
freddiewanah 672a348852 fix a typo when during the refactoring. 2024-04-10 15:11:29 +02:00
freddiewanah 9a843e5d6b Refactor to merge similar test methods 2024-04-09 17:02:08 +02:00
freddiewanah 67d14a2e12 remove extra setups in the test class 2024-04-09 16:46:35 +02:00
freddiewanah e0de6e1b89 refactor the test methods to avoid suboptimal asserts. 2024-04-08 21:39:25 +08:00
freddiewanah dcad94d2c6 refactor the test methods to avoid sleepy test or should consider comment the sleep command 2024-04-08 19:16:51 +08:00
freddiewanah 3045550368 remove redundant prints 2024-04-08 19:14:42 +08:00
Serene 6077b7a3a1 Merge pull request #5153 from Dr-Blank/barcode-support 2024-03-24 17:41:29 +10:00
Dr-Blank c88953805b bugfix: ignore subdirectories of ignored
directories in unimported plugin
2024-03-22 18:20:47 -04:00
Dr-Blank 0e7d35fd69 tests for barcode field 2024-03-18 13:23:10 -04:00
Dr-Blank 812fbca9da Add barcode field to AlbumInfo and update related files 2024-03-18 13:22:04 -04:00
J0J0 Todos b09806e0df Merge pull request #5134 from InvisibleFunction/fix-media-headers
Fix Media Headers on Import
2024-03-17 00:48:39 +01:00
InvisibleFunction b9ab0c9867 Run black 2024-03-09 14:28:17 -05:00
InvisibleFunction 33c8ae7a4b Update in response to comments 2024-03-07 09:11:54 -05:00
InvisibleFunction 94e294581b Update Changelog 2024-03-06 09:12:58 -05:00