cvzi / Bandcamp-script-deluxe-edition

A discography player for bandcamp.com and manager for your played albums
https://greasyfork.org/en/scripts/390404-bandcamp-script-deluxe-edition
MIT License
35 stars 1 forks source link

Bandcamp Tag Search #126

Closed Nzzyme closed 2 years ago

Nzzyme commented 2 years ago

Hello, hope you are fine. I wanted to check with you if it is possible to include a Tag search feature in your Bandcamp script that allows the user to input multiple tags and perform a search.

Currently, your script shows two icons on the top: "L" and "Settings". Can you include a search icon (magnifying glass icon) such that when we click that, it brings up a window (similar to the Settings window) and which includes search boxes to enter the Tag and a Search button. Ability to add multiple tags would be really useful.

I have been using the Camp Explorer site (https://campexplorer.io/) and the Chrome extension but that doesn't work often as seen here: https://prnt.sc/1vkt1n8

Some logic that I can think of (expand this to view): 1. Whatever the user enters as a tag in the first Tag search box, should be passed to the following URL: https://bandcamp.com/tags/tag_name where "tag_name" is the tag that the user inputs in the search box (Ex: https://bandcamp.com/tag/metal) 2. Now on this page, we don't want to view just the highlights suggested by Bandcamp, but would like to view all the albums that have been tagged as "metal". So we click on the link "all metal releases" as seen here (https://prnt.sc/1vkpvns). Doing that adds the following parameter "?tab=all_releases" to the URL. The URL now is: includes an additional parameter "?tab=all_releases" 3. Now Bandcamp allows to add further tag using the button "add a tag". Now when we add another tag on the page, an additional parameter is added to the URL which is "&t=tag_name" where tag_name is the second tag name that is input in the additional tag box as seen here (https://prnt.sc/1vkqknu). Now the URL is https://bandcamp.com/tag/metal?tab=all_releases&t=hip-hop 4. Going one level further, if we add one more tag by clicking on "add another tag", we see an additional parameter "%2Ctag_name" getting added to the URL as seen here: https://prnt.sc/1vkqwpa The URL now is https://bandcamp.com/tag/metal?tab=all_releases&t=hip-hop%2Cpunk 5. The ability to add further tag is limited now. But continuing by this logic, if I include "%2C" followed by tag_name, Bandcamp performs a search and shows us the results as seen here: https://prnt.sc/1vkr7va In short, the URL syntax for a multi-tag search is: https://bandcamp.com/tag/tag_name1?tab=all_releases&t=tag_name2%2Ctag_name3%2Ctag_name4 where tag_name1, tag_name2, tag_name3, tag_name4 are the user provided tags (in the multiple search boxes). Now all you need to do is map the tags entered in the search boxes and pass that as parameters in the URL to perform a multi-tag search. **Note**: Tags with multiple words (Ex: Hip Hop) are passed in the URL and are separated by a hyphen. That is, it would pass as "hip-hop" in the URL (see above URLs as example).

I am thinking this should not be difficult but Is this something that you are able to add to your awesome script? Let me know!

Thanks & Regards!

cvzi commented 2 years ago

Yes I think I can add that as you described it

Note to myself: There is a bandcamp API to get the tag suggestion while typing: https://reqbin.com/c-9y7qlyq9

Nzzyme commented 2 years ago

Thank you!

cvzi commented 2 years ago

I should work now

Nzzyme commented 2 years ago

That was quick. I did an initial test and it works like a charm. Thank you so much!!

Nzzyme commented 2 years ago

@cvzi : Quick question: Is your script designed to run only on artist / album pages and not the main home page of Bandcamp? I observed that on bandcamp.com, I don't see the three icons for Search, Library & Options that we usually see on the top-right side of the page. Is this for a reason? Are you able to add them on the homepage too?

cvzi commented 2 years ago

It works for me on https://bandcamp.com/ I will check what could be the problem.

cvzi commented 2 years ago

The bar on top of the page where the icons appear is a little bit different on the homepage if you're not logged in. Because I am logged in bandcamp, I didn't see it.

Nzzyme commented 2 years ago

You are right. I observed that the Settings icon appears as a square icon instead of the gear icon as seen below. Can you check this please? (I am on Windows 7 (64 bit) and checking in Chrome)

Screenshot_2

Nzzyme commented 2 years ago

Thanks for fixing the Settings icon. I observed that when I moved my mouse pointer (and not click) over the Tag 'Search' icon, the other two icons vanish automatically as seen below:

Opening bandcamp.com:

image

Hovering Mouse pointer over the TAG Search icon:

image

Additionally, I noticed that when I clicked on the Library icon, it displays the list of listened tracks but there is no close button on this window just like there is on the Settings window. As a result, I am unable to remove this window (see screenshot).

https://prnt.sc/1yaxv69

Can you please look into this?

Thanks & have a great day!!

cvzi commented 2 years ago

It was good for testing with the mouseover because it's faster, so now I guess click would be better. I make the two icons vanish on purpose because sometimes there is not enough space if you add three or more long tags.

The library thing is a work in progress, I wanted to make it like a real music player but I don't have the time right now. It is actually just a frame of the site https://bandcamp.com/robots.txt?player . If you open that url it triggers the library to open, so I guess instead of a frame I can just make it a link that opens a new tab to https://bandcamp.com/robots.txt?player

Another thing: There is a small "we are hiring" banner that sometimes appears on bandcamp over the search and buttons, I'll have to move that out of the way

Nzzyme commented 2 years ago

Yes, indeed the "We're hiring!" text shows up which interferes with your icons. Maybe you can check these later when you have some free time. Thanks & have a great day!

image