owntone / owntone-server

Linux/FreeBSD DAAP (iTunes) and MPD audio server with support for AirPlay 1 and 2 speakers (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.
https://owntone.github.io/owntone-server
GNU General Public License v2.0
2.07k stars 234 forks source link

Play folder request fails with query syntax error #1432

Closed d-kj closed 2 years ago

d-kj commented 2 years ago

Recently upgraded to Owntone 28.3 running on Armbian 21.08.8, compiled with support for ffmpeg, Without Spotify, LastFM, Chromecast, MPD, Websockets, ALSA, Webinterface, Regex.

Attempting to play folders by clicking in the library results in a web popup message:

Request failed (status: 500 Internal Server Error, url: http://owntone.my.domain.net:3689/api/queue/items/add?expression=path+starts+with+%22%2Fsrv%2Fdev-disk-by-uuid-05d27831-4c9a-aaaa-8f11-879488761bd5%2Fmedia%2Faudio%2Fmp3%2Fall%2Fjames_taylor-greatest_1%22+order+by+pa

With a corresponding DEBUG log as follows on the server:

[2022-03-07 07:40:26] [DEBUG] web: JSON api request: '/api/queue/items/add?expression=path+starts+with+%22%2Fsrv%2Fdev-disk-by-uuid-05d27831-aaaa-4205-8f11-879488761bd5%2Fmedia%2Faudio%2Fmp3%2Fall%2Fjames_taylor-greatest_1%22+order+by+path+asc&shuffle=false&clear=true&playback=start' [2022-03-07 07:40:26] [DEBUG] db: Running query 'BEGIN TRANSACTION;' [2022-03-07 07:40:26] [DEBUG] db: Running query 'SELECT value FROM admin a WHERE a.key = 'queue_version';' [2022-03-07 07:40:26] [DEBUG] db: Running query 'DELETE FROM queue where id <> 0;' [2022-03-07 07:40:26] [DEBUG] db: Running query 'INSERT OR REPLACE INTO admin (key, value) VALUES ('queue_version', '142');' [2022-03-07 07:40:26] [DEBUG] db: Running query 'END TRANSACTION;' [2022-03-07 07:40:26] [DEBUG] mpd: Asynchronous listener callback called with event type 2. [2022-03-07 07:40:26] [DEBUG] mpd: Notify clients waiting for idle results: 2 [2022-03-07 07:40:26] [DEBUG] web: notify callback reason: 11 [2022-03-07 07:40:26] [DEBUG] web: notify callback reply: 2 [2022-03-07 07:40:26] [DEBUG] player: Status update - status: 2, events: 16, caller: options_generic_bh [2022-03-07 07:40:26] [DEBUG] mpd: Asynchronous listener callback called with event type 16. [2022-03-07 07:40:26] [ LOG] scan: Could not parse '"query" { path starts with "/srv/dev-disk-by-uuid-05d27831-aaaa-4205-8f11-879488761bd5/media/audio/mp3/all/james_taylor-greatest_1" order by path asc }': syntax error, unexpected $undefined, expecting SMARTPL_T_IS or SMARTPL_T_INCLUDES [2022-03-07 07:40:26] [ LOG] web: JSON api request failed with error code 500 (/api/queue/items/add?expression=path+starts+with+%22%2Fsrv%2Fdev-disk-by-uuid-05d27831-aaaa-4205-8f11-879488761bd5%2Fmedia%2Faudio%2Fmp3%2Fall%2Fjames_taylor-greatest_1%22+order+by+path+asc&shuffle=false&clear=true&playback=start)

Error occurs from the 3-dot menu on the folder within the list of folders (play, play-next, and add options), the "play" button inside the folder, and the play, play-next, and add options in the 3-dot menu inside the folder view.

Clicking on an individual track inside the folder plays the track, however, so it's not an obvious permissions or access problem.

I'm certainly willing to help drill into the problem if something in my environment uniquely triggers this. The only thing unusual I might guess is that most of my library folders are symlinked into my library root. Based on the grey text in the UI and various logging, it looks like those symlinks are being correctly dereferenced.

ejurgensen commented 2 years ago

Thanks a lot for reporting. It's a regression coming from changing parsers recently, so the error is pretty clear. Seems there is some syntax that I overlooked. Will get it fixed asap.

d-kj commented 2 years ago

Thanks, you're amazing. I saw those changes, but I'm not familiar enough to isolate the syntax generation problem. It worked fine on my previous forked-daapd version, 27.2.108.

ejurgensen commented 2 years ago

Yes, 28.3.117 should also work. It's a pretty recent regression.

cdlenfert commented 2 years ago

I just came to chime in with the same note. I've found that when you navigate to a folder, clicking the first track listed has the same effect as clicking the "play" option (either the button or the ... that leads to the modal). image

d-kj commented 2 years ago

I think I have a patch for it, should I paste it here, email, or clone and do a pull request?

So far, I did not propagate it to the file layer for .smartpl, so you may want to do that to keep the features sync'd. Hence, I also did not update the README_SMARTPL.md.

ejurgensen commented 2 years ago

Should be fixed in master now. I will make an update to the RPi version in a few days.