Hassio-Addons icon indicating copy to clipboard operation
Hassio-Addons copied to clipboard

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

Open SkyLined opened this issue 2 years ago • 5 comments

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

SkyLined avatar Feb 20 '23 17:02 SkyLined

same problem, how to solve this?

aurimassiaulys avatar May 12 '23 06:05 aurimassiaulys

hello anyone?

aurimassiaulys avatar May 26 '23 13:05 aurimassiaulys

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 avatar Nov 24 '23 13:11 whc2001

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

whc2001 avatar Nov 24 '23 14:11 whc2001

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.

HannesK-ME avatar Jan 19 '24 16:01 HannesK-ME