Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add configuration option to prevent MPD from looking up cover art. #379

Open
SkyLined opened this issue Feb 20, 2023 · 5 comments
Open
Labels
mpd mpd Addon

Comments

@SkyLined
Copy link

Which addon?
MPD

Is your feature request related to a problem? Please describe.
When you play a media file through MPD, MPD attempts to look for cover art by making requests to the server for cover.png, cover.jpg, cover.tiff and cover.bmp. These requests do not have the required ?authSig=... query parameter and subsequently trigger alerts in Home Assistant that a request with invalid authentication is made, like so:

Login attempt or request with invalid authentication from 243ffc37-mpd.local.hass.io (172.30.33.4). Requested URL: '/media/local/cover.png'. (Music Player Daemon 0.22.3)
Login attempt or request with invalid authentication from 243ffc37-mpd.local.hass.io (172.30.33.4). Requested URL: '/media/local/cover.jpg'. (Music Player Daemon 0.22.3)
Login attempt or request with invalid authentication from 243ffc37-mpd.local.hass.io (172.30.33.4). Requested URL: '/media/local/cover.tiff'. (Music Player Daemon 0.22.3)
Login attempt or request with invalid authentication from 243ffc37-mpd.local.hass.io (172.30.33.4). Requested URL: '/media/local/cover.bmp'. (Music Player Daemon 0.22.3)

It would be great if we could get MPD to stop doing that if possible.

Describe the solution you'd like
I want to tell MPD not to look for cover art, either by default, through a configuration setting, or through an additional argument when I call media_player.play_media

Describe alternatives you've considered
It's been reported that you can tell HA to ignore these requests by whitelisting a certain IP range. That does remove the notifications about the invalid authentication but give MPD access without any authentication, which is a (minor) security risk.

Additional context
N/A

@Poeschl Poeschl added the mpd mpd Addon label Feb 20, 2023
@aurimassiaulys
Copy link

same problem, how to solve this?

@aurimassiaulys
Copy link

hello anyone?

@whc2001
Copy link

whc2001 commented Nov 24, 2023

IIRC this behaviour is baked into MPD without a tunable option. Also trusted_networks won't hide the warning notification due to 404 not found. For a long time to come the only option is to get used to it.

@whc2001
Copy link

whc2001 commented Nov 24, 2023

There is an alternative which is to set up an automation to automatically remove the notification from only MPD. It's by no mean a perfect solution and the notification still blinks for a split second, but at least it's less annoying to me. The link above is for older version of HASS which no longer works due to API change. Here is my version that's working:

alias: Remove MPD invalid request notification
description: ""
trigger:
  - platform: persistent_notification
    update_type:
      - added
    notification_id: http-login
condition:
  - condition: template
    value_template: "{{ 'mpd.local.hass.io' in trigger.notification.message }}"
action:
  - service: persistent_notification.dismiss
    data:
      notification_id: "{{ trigger.notification.notification_id }}"
mode: restart

@HannesK-ME
Copy link

HannesK-ME commented Jan 19, 2024

Can you actually whitelist MPD though to remove the requirement for authentication? as @SkyLined mentions?! I've not found a way to do this that actually works. My MPD gets ip banned as soon as I play a file :D

EDIT:
If there's only a few files you need to play regularly (for example, I use a timer expired sound), you can put those in the www directory in the home assistant config and play them on MPD using the media_player.play_media service using the following details:
Content ID: http://HA IP and port/local/filename
Content Type: audio/mpeg (for mp3 files)

Hope this helps somebody. This workaround works perfectly for my use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mpd mpd Addon
Projects
None yet
Development

No branches or pull requests

5 participants