Closed quantenschaum closed 3 years ago
Strange, this works in my setup. Please attach the mpd verbose and the myMPD debug log.
Yupp, there is the problem (from mympm log): mympd searches with
"search "((Track == '1') AND (Disc == '1') AND (Album contains 'songbird'))" sort AlbumArtistSort window 0:100"
which does not get any hit, where as search "(Album contains 'songbird')"
does.
Why does mympd add (Track == '1') AND (Disc == '1')
?
With Track == '1'
the search yields the first track of the album, but the files do not have the disk field set in their tags (because there is only one), so querying for it yields nothing.
It is probably done to reduce the amount of returned results, but assumes that the track and disk fields are present and contain the value of 1
. This is not guarantied to be the case. It should be something like "track==1 or track is undefined". But this leaves the case of an album without a track==1
.
Track and Disc is added to get unique album results. If you do not maintain the disc tag you should disable it. Or searches are not possible with mpd.
OK. Where to disable it? Disk tag is maintained, but only for albums with more than one disk.
Or searches are not possible with mpd.
Why not? mpc search album songbird
works.
If you disable it you would get 2 entries for multidisc albums. You can disable it in settings -> general.
Why not?
mpc album songbird
works.
This is no or search, look at the mpd documentation for the new filter syntax since mpd 0.21. Your search searches the needle songbird in the haystack of album names.
Found the settings.
Typo, I meant mpc search album songbird
.This works, I just tried it. Or mpc search "(Album contains 'songbird')"
.
Of course, the you get multiple results per album, which need to be reduced afterwards.
It should be something like "track==1 or track is undefined"
This is not possible with mpd filter syntax.
Your search searches the needle songbird in the haystack of album names.
Yes, that is exactly what I want. Give me all albums with "songbird" in the album name. Isn't this what the search is supposed to do?
But that’s only the list of unique album tags. The list has no reference to the associated albumartists.
But that’s only the list of unique album tags.
What do mean by that? - So just from (my) user perspective. Given the album view (one cover per album) and a search box for album title, I would expect to get all the albums with the entered string in their name. This should be independent of the presence and value of any other tag fields, like track, disk or albumartist.
In this view you can search also by artist, genre etc. An album title is not unique, think about albums like greatest hits.
Yes, sure. But what do you mean by "unique"? You will get many albums, all those, that have the search string in their name, no only a single (unique) one. You can of course filter by other fields as well. (Boolean operations other than AND
, will say OR
, would be cool as well. There are ==
, !=
, ..., but can I search for (album contains song OR album contains bird)
?)
I think, the problem here is, that the mpd search does not return albums, it returns songs (single files) but you want to display them as albums (in the case of the album view).
IMHO it should work like this
((artist == "Kraftwerk") AND (title == "Metall auf Metall"))
(do not add any additional fields in order to try to make the search results "unique")This works for any view with any filter. filter -> map ->reduce
but can I search for (album contains song OR album contains bird)?)
No, this can not be done.
I hopped I could avoid to get the individual files and reduce the result set manually. This method Hase also some disadvantages: higher resource usage and more complicated code
I can totally understand that you did it this way to get it working quickly and to let mpd do all the work handling the db query. And the search is super fast (>100k songs in the db), nice. But the downside is, that it produces wrong/crippled results (compared to my expectations). But I actually doubt that the filter-map-reduce thing would actually cause high resource usage and it is not really complicated, but necessary.
So removing the disc==1
condition would like improve the situation, then you multiple hits, one for each disk, but probably all albums, since very album is very likely to have track 1.
Turning the use of the disk tag off in the settings leads to many untitled empty albums when browsing the album view w/o filters. mympd queries mpd with search "((Track == '1'))"
. How is it possible that there are empty albums in search results?
I can not reproduce your issue with the untitled empty albums. Are there any errors in the myMPD log or the JavaScript console? Can you grab the api response from the network tab?
Actually myMPD relies on accurately taged files, momentanely I would not implement a workaround as you described, but the behavior should be documented to avoid issues with it.
The mpd database queries have many limitations. Eventually it is better to implement a own tag database in the future instead creating many small workarounds.
I will have into the logs...
Actually it is nice to let mpd do the db search work.
myMPD v6.9.0 shows now a hint for enabled tags and I added some documentation to the wiki: https://github.com/jcorporation/myMPD/wiki/Tags
I will have into the logs...
any news? @quantenschaum
I close this stale issue. Do not hesitate to reopen if you can provide logs.
OK. I downloaded some MP3s from the podcast https://www.mdr.de/tweens/podcast/figarino/index.html and placed them in a directory. I set this directory as music_directory
in mpd and let it rescan the database with mpc rescan
. The downloaded example files were the only files in the library.
Then I entered the album search view in mympd w/o any search string. I looks like this.
Clocking on any of the albums show an empty album, not a single track.
The disc
field is disabled in mympd, the MPDs log says:
client: [1] process command "search "((Track == '1'))" sort AlbumArtistSort window 0:100"
Running mpc search "((Track == '1'))"
yields a list of files like
2017-01-16t0001040100-eiskalte-gefahr.mp3
2017-02-18t1805000100-beatboxing.mp3
2017-12-24t0001030100-der-verruckte-professor.mp3
2018-12-08t1805000100-geschenke.mp3
2018-12-10t0001020100-glasblaser.mp3
2019-02-12t1025000100-gluck.mp3
2019-03-08t1159000100-werwolf.mp3
2019-03-08t1209000100-adventskalender.mp3
2019-03-08t1209000100-bob.mp3
2019-03-08t1209000100-geld.mp3
...
Maybe the tags in the files are not as mympd expects them, but I (as user) expect mympd to handle this correctly.
What is strange here is, that even if mympd treats every file a single file album, all of the albums are empty!
I downloaded the last episode of this podcast. The mp3 files are not tagged with id3 (id3v2 -l shows no tag values. Despite missing tags the search (Track == '1') returns a list of files. To solve this myMPD should ignore results with empty album, artist, albumartist tags.
myMPD version: 6.8.3 from your docker image
There are 2 search boxes in myMPD
In my mpd database in an album called "morning songbirds"
It is found by myMPD when searching for in the search tab
But when I search for it in the browse tab, it is not found
Am I doing something wrong, or is this a bug?