The `beets/random.py` module was only used by the random plugin, so I
moved its functions into `beetsplug/random.py` to keep core modules
cleaner.
Changes:
- Moved beets/random.py functions into beetsplug/random.py
- Added typehints for better readability and tooling support
- Added additional tests for improved coverage
- General tidy up and refactor, keeping the core functionality unchanged
- Handle list-valued fields when grouping for --field/--equal-chance to avoid
"TypeError: unhashable type: 'list'" (e.g., artists).
- Sort items by the grouping key before building groups so equal-chance
permutation preserves the same item set as `beet list`, only randomized.
Here some changes which I made when works on #5342 , I think we may say
that it actually fixes#5342 because after that we have full colors in
docs and code which allows user to do colours as he would like to.
Normally, the Fish completion plugin won't complete filenames, which is
useful for `beet import` and similar! This removes the `-f` (no filename
completion) flag from various places in the output.
This PR adds support for
[mp3rgain](https://github.com/M-Igashi/mp3rgain) as an alternative to
mp3gain/aacgain in the ReplayGain plugin's command backend.
## What is mp3rgain?
mp3rgain is a modern Rust rewrite of mp3gain that provides:
- **CLI-compatible drop-in replacement** for mp3gain - same command-line
interface and output format
- **Support for both MP3 and AAC/M4A formats** (like aacgain)
- **Security fixes** for vulnerabilities in the original mp3gain:
- CVE-2021-34085 (Critical, CVSS 9.8) - buffer over-read in
`WriteMP3GainAPETag`
- CVE-2019-18359 (Medium, CVSS 5.5) - buffer over-read in
`ReadMP3APETag`
- **Memory-safe implementation** in Rust
- **Works on modern systems** including Windows 11 and macOS with Apple
Silicon
- **Active maintenance** (original mp3gain has not been updated since
2009)
## Changes
1. **beetsplug/replaygain.py**:
- Add `mp3rgain` to the command search list (prioritized first since
it's more secure)
- Update `format_supported()` to correctly handle mp3rgain's AAC/M4A
support
- Update error message to mention mp3rgain
2. **docs/plugins/replaygain.rst**:
- Add mp3rgain to the backend documentation
- Include installation instructions for various platforms
- Document the security benefits
## Testing
mp3rgain has been tested to be fully compatible with the existing
command backend:
- Supports all the same command-line flags (`-o`, `-s s`, `-k`, `-c`,
`-d`, etc.)
- Produces identical tab-delimited output format
- Returns the same exit codes
## Why prioritize mp3rgain in the search order?
The original mp3gain has known security vulnerabilities that have not
been fixed (the project has been inactive since 2009). By searching for
mp3rgain first, users who have it installed will automatically benefit
from the security improvements, while maintaining full backward
compatibility for users who only have mp3gain/aacgain installed.
## Description
was getting permission error because after png is converted to jpg beets
want to delete the png but somehow it is still being used causing the
import to fail. this temporarily fixes the import but still needs a
proper way to know what is using the file and how to delete it.
```
File "C:\Users\DELL\projects\_myForks\beets\beetsplug\fetchart.py", line 1321, in fetch_art
candidate = self.art_for_album(task.album, task.paths, local)
File "C:\Users\DELL\projects\_myForks\beets\beetsplug\fetchart.py", line 1413, in art_for_album
out.resize(self)
~~~~~~~~~~^^^^^^
File "C:\Users\DELL\projects\_myForks\beets\beetsplug\fetchart.py", line 218, in resize
self._resize(plugin, current_check)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\DELL\projects\_myForks\beets\beetsplug\fetchart.py", line 246, in _resize
self.path = ArtResizer.shared.reformat(
~~~~~~~~~~~~~~~~~~~~~~~~~~^
self.path,
^^^^^^^^^^
plugin.cover_format,
^^^^^^^^^^^^^^^^^^^^
deinterlaced=plugin.deinterlace,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\DELL\projects\_myForks\beets\beets\util\artresizer.py", line 658, in reformat
os.unlink(path_in)
~~~~~~~~~^^^^^^^^^
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: b'C:\\Users\\DELL\\AppData\\Local\\Temp\\beets\\beetsplug_fetchart\\4kqx2um2.png'
```
when importing
https://musicbrainz.org/release/5744ddb7-e9b6-4b46-a55c-38e75aa95460
beet config
```yaml
fetchart:
minwidth: 500
maxwidth: 3000
max_filesize: 3500000
sources:
- coverart: release
- coverart: releasegroup
- itunes
- amazon
- filesystem
- albumart
- '*'
cautious: yes
cover_names: cover front art artwork folder album
store_source: yes
cover_format: JPEG
auto: yes
quality: 0
enforce_ratio: no
high_resolution: no
deinterlace: no
```