beets icon indicating copy to clipboard operation
beets copied to clipboard

web plugin querystring search doesn't behave as documented

Open clach04 opened this issue 2 years ago • 5 comments

Problem

Using the web plugin to search does not yield the same results as beets ls.

For example:

# beet ls avril 14
Aphex Twin - Drukqs (US Release) - Avril 14th (LP Version)
# beet ls 14 avril
Aphex Twin - Drukqs (US Release) - Avril 14th (LP Version)

Entering the same strings into the search form in the web browser appears to generate the following URLs:

http://HOSTNAME:8337/#item/query/14%20avril
"GET /item/query/14,avril HTTP/1.1" 200 

NOTE the comma.

This yields no results.

According to https://github.com/beetbox/beets/blob/master/docs/plugins/web.rst#get-itemqueryquerystring two search words would be "AND"'d together (see https://beets.readthedocs.io/en/stable/reference/query.html).

At this point I'm not sure if this is intended or not.

I'm also not clear if the issue is the frontend where it generates the GET request or the web service.

If anyone can update this with some thoughts I can dig into the code a little.

Setup

beets version 1.6.0 Python version 3.8.4 plugins: play, web

Can provide config file if really needed.

Thanks for making Beets available, its working great for casting to my Google Chromecast/Speaker!

clach04 avatar Jun 30 '22 03:06 clach04

From https://beets.readthedocs.io/en/stable/reference/query.html

Note that the comma has to be followed by a space (e.g., foo,bar will be treated as a single keyword, not as an OR-query).

So maybe the frontend is indeed generating the wrong request? But how come this has not been noticed before?

wisp3rwind avatar Jun 30 '22 20:06 wisp3rwind

From https://beets.readthedocs.io/en/stable/reference/query.html

Note that the comma has to be followed by a space (e.g., foo,bar will be treated as a single keyword, not as an OR-query).

I definitely do NOT want a comma and I never entered one.

So maybe the frontend is indeed generating the wrong request? But how come this has not been noticed before?

That's been my guess. That is a great follow on question ;-)

Thanks for taking the time to respond, it gives me more confidence in my understanding in what it should be doing. Here is a screen shot (that matches the original text description I posted) to try and back up my claims that the client URL is space, but that the request sent on to beets has the comma.

image

I tested both Firefox and Chrome based browser and see the same behavior.

clach04 avatar Jun 30 '22 22:06 clach04

Very tricky! I'm not entirely sure what's going on here, but it sure seems related to #4182. Do you know if you're running the latest source version of beets? That might be worth doing to confirm—if my guess is right, that PR fixed this issue.

sampsyo avatar Jul 01 '22 11:07 sampsyo

@sampsyo I was definitely not at headsrevs, I'd installed via pip and pypi.

I took your advice and installed latest using:

pip install git+https://github.com/beetbox/beets.git

I manually viewed and confirmed that beetsplug/web/init.py contained the update to https://github.com/beetbox/beets/blob/master/beetsplug/web/init.py#L264 - so I'm at headrevs as of a few minutes ago.

Ran the same test (in a chrome based browser), and got the same result :-(

Is anyone NOT seeing the behavior I'm seeing? Be good to collect versions and browsers information that are being used.

clach04 avatar Jul 02 '22 00:07 clach04

I also opened https://github.com/beetbox/beets/pull/4395

clach04 avatar Jul 02 '22 00:07 clach04

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 24 '22 10:09 stale[bot]