Skip to content

Fix mpdstats CLI option overrides#6699

Open
Tsuizxgo wants to merge 1 commit into
beetbox:masterfrom
Tsuizxgo:fix-mpdstats-cli-host
Open

Fix mpdstats CLI option overrides#6699
Tsuizxgo wants to merge 1 commit into
beetbox:masterfrom
Tsuizxgo:fix-mpdstats-cli-host

Conversation

@Tsuizxgo
Copy link
Copy Markdown

@Tsuizxgo Tsuizxgo commented Jun 1, 2026

Description

Fixes #5404.

The mpdstats command already overlays CLI options onto the mpd config with mpd_config.set_args(opts). After that, it tried to manually apply the same options again, which caused two problems on Python 3:

  • --host and --password values are already strings, so calling .decode("utf-8") crashed.
  • --port was accidentally assigned to mpd_config["host"], producing an invalid host configuration.

This change removes the redundant manual override block and relies on set_args() to preserve the correct option types.

To Do

  • Documentation. This is a bug fix for existing CLI options.
  • Changelog. Added an entry to docs/changelog.rst.
  • Tests. Added regression coverage for CLI --host, --port, and --password overrides.

Tests

BEETSDIR=/private/tmp/beets-test-config UV_CACHE_DIR=/private/tmp/uv-cache uv run pytest test/plugins/test_mpdstats.py
# 4 passed

@Tsuizxgo Tsuizxgo requested a review from a team as a code owner June 1, 2026 15:58
@github-actions github-actions Bot added the mpdstats mpdstats plugin label Jun 1, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.66%. Comparing base (52a7ba6) to head (cf7c5e4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6699      +/-   ##
==========================================
+ Coverage   72.59%   72.66%   +0.06%     
==========================================
  Files         162      162              
  Lines       20811    20805       -6     
  Branches     3293     3290       -3     
==========================================
+ Hits        15107    15117      +10     
+ Misses       4980     4964      -16     
  Partials      724      724              
Files with missing lines Coverage Δ
beetsplug/mpdstats.py 60.21% <ø> (+7.09%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@snejus
Copy link
Copy Markdown
Member

snejus commented Jun 4, 2026

Can you rebase this on top of master? I don't seem to have permissions to do so.

@snejus snejus enabled auto-merge June 4, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mpdstats mpdstats plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MPDStats Shell Parameters --host crashes the Application: AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?

2 participants