[WS] Bandcamp (search by Album or Track)

I've looked a little bit closer on the index search part of the web source and noticed that it produces an error if the search term returns no results. This is now fixed.

Also, because searching for A/B Sides 027 on Bandcamp should return plenty of results, I've noticed that there was a small typo for the [WordSeparator] configuration setting in the web source, effectively removing every space character from the query before it is sent to Bandcamp.

Having fixed this should now greatly increase the number of search results provided by this web source.

&Bandcamp#&JSON.src (5.3 KB)

1 Like

Thanks so much for your time and effort! The JSON script is working very well. I'm so glad you caught that WordSeparator typo as I always had to get creative to avoid the error Leo noted. There are two improvements that I think would make it complete. I think both would be good candidates for option settings if the web sources framework and BandCamp's JSON can do it.

Here's the album I used for testing: Demon's and Dark Souls Remixes | Alex Roe

  1. Full quality cover art. The album covers are not the maximum size available. The HTML script will get a 3000x3000 image on the same album that the JSON script pulls a 1200x1200 image. I think it is this section in the HTML script where is selects the "0" jpg, is how it targets the maximum quality art.
# Coverart
gotoline 3
outputto "COVERURL"
findline "link rel=\"shortcut icon\"" 1 1
replace "3.jpg" "0.jpg"
findinline "href=\"" 1 1
sayuntil "\""
  1. Get album and track descriptions. There can be comments for the album as a whole, but there can also be separate, individual comments for each track. I would really like to be able to get both of them into tag fields. Ideally I'd like to have them combined in the comments tag, but that can be done later through Mp3tag Actions easily enough, so long as the web source populates the data in some tag. My thought would be to put the album description in the Comments tag, then put the track description into a "BandCamp Track Comment" custom tag. Below is an image of the track descriptions I'm referencing (they are displayed on a separate page when you click on the info link next to a track).

The script is already a huge help as-is, but if those changes would be feasible it would be basically perfect (at least for my needs).

I've added the suggested configuration settings to optionally use the highest possible quality for cover art as well as a setting for YEAR format and whether albums and tracks are included in the search results.

On macOS, the tag source now also shows cover thumbnails for the search results.

Your second idea to import track details is currently not possible. This would require one additional request per track to the Bandcamp website, because the track details are on the respective track page. Mp3tag can only perform one request to get the details of an album.

I'm also adding this to the initial post now, to make it easier for new users to get the latest version of the tag source. Also, the changelog should give some details on what's added and fixed.

bandcamp-0.4.2.zip (4.5 KB)

3 Likes

:clap: :clap: :clap: Thanks Florian! Seems to be working great!

Too bad about the track "info" comments, but I had a feeling there would be some sort of issue along those lines with the silly way Bandcamp choose to structure their site (and eliminate the public API). Thanks again for your help and all of your hard work on Mp3tag more broadly.

1 Like

It is possible with a separate websource to fetch comments for individual tracks together with something that can iterate the script through the tracklist in mp3tag (autohotkey does this for me). I do this for a review site for individual track reviews.

Basically, my workflow goes like this:

  1. In the main script, save the track url (info link in your pic) to a field, e.g., BANDCAMP_TRACK_URL, if there is a track url for it,
  2. In a separate script, use the saved track url to scrape the track page and save the comment in the appropriate comment tag, and
  3. Use something like autohotkey to iterate the script in step 2 through the tracklist.

My autohotkey script looks like this (Win+S runs it and the websources are activated by alt+key combinations that are set by the websource's filename):

#s::
; Find song reviews from litigious-review-site-that-cannot-be-named using mp3tag
InputBox, times, Number of tracks (more than on album)
	if (times > 0) ; test if it is a number
	{
		Loop % times
		{
			Send !s ; alt+s to bring up tag sources menu
			Send a
			Send s ; run websource that parses track url
			Send {Enter 2} ; pass confirmation windows
			Sleep 1000
			Send {Down} ; go select next track
		}	return
	}
return

The above workflow allowed me to go through huge compilations and scrape individual track reviews to my comment field. Then again, I usually combine track and album reviews into the same COMMMENT tag. Basically, I save the track review and album review(s) in separate fields and use multiple format value functions in the my custom action groups to combine various comment fields into COMMENT.

@Florian Thanks for updating the script. I have really busy lately (such is life with billable hours), so I do not have enough time to update script, especially since it still does what I need it to do.