ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA - Create a text doc of an artists discography.

<< < (3/5) > >>

4wd:
That's one of the reasons I became fixated on the allmusic site.-fred dred (November 07, 2020, 04:43 AM)
--- End quote ---

Yes, nicer format but unfortunately in HTML which can be a P.I.T.A to parse.

They might have an API which can be leveraged but I couldn't find one in a quick look at the site.

Addendum: Looks like there is an API through Rovi (TiVo) if you get an API key here - although a quick look seems to indicate no way to get a list of releases for an artist.

fred dred:
It makes me very happy that you mention html to be a pain to work with - maybe I'm not as stupid as I thought I was  :D

AFAIR even when I could get beautiful soup or one of the other html parsers to grab the page, there didn't seem to be any of the relevant information in it !

You've given me a lot to play with, thanks again,

Steve.

Nod5:
Nice 4wd! One idea is to search for artist name and use the first match as artist page URL input into the rest of your program.
The URL format is

--- ---https://www.discogs.com/search/?type=artist&title=ac+dcOther URL parameters can be detected by playing around with options on https://www.discogs.com/search/advanced

This could be a little NANY 2021 app.

4wd:
Nice 4wd!-Nod5 (November 07, 2020, 10:11 AM)
--- End quote ---

Thanks!

One idea is to search for artist name and use the first match as artist page URL input into the rest of your program.
The URL format is

--- ---https://www.discogs.com/search/?type=artist&title=ac+dc
--- End quote ---

I think that given the incomplete records on Discogs, time would be better spent on either MusicBrainz, (filtering their overly complete lists down to just the studio releases, or otherwise selecting what you want), or trying to parse allmusic's HTML, (that'll be fun but it is just one big table, so maybe it won't be that hard - PowerShell can get at elements within HTML, just never really looked at it).

eg. For MusicBrainz, pipe the output into a ListView with checkboxes, select the ones you want, output to a text file - if you want to use manual selection.

This could be a little NANY 2021 app.
--- End quote ---

... it might inspire someone ;)-4wd (November 06, 2020, 09:41 PM)
--- End quote ---

 :P

Looking at AllMusic, their info is a little mixed up also, Live albums in amongst Studio albums whereas MusicBrainz splits Studio and Live.

Since MusicBrainz list the Studio albums first, we can prune everything down to just those easily enough:


--- Code: PowerShell ---<#  .\DiscoFile-MB3.ps1 <Uri>   Given the URI from https://musicbrainz.org for an artist it will retrieve the  discography.   eg.   .\DiscoFile-MB3.ps1 https://musicbrainz.org/artist/66c662b6-6e2f-4930-8610-912e24c63ed1   Will result in a file called 'AC_DC-MB - Discography.txt' in the same directory as  DiscoFile.ps1 #> param (  [string]$Uri) $web = (Invoke-WebRequest -Uri $Uri).RawContent $temp = $web -replace '[\s\S]+application\/ld\+json..([\s\S]+?)<\/script>[\s\S]*$', '$1' $json = $temp | ConvertFrom-Json $outFile = ($json.name + "-MB - Discography.txt").Split([IO.Path]::GetInvalidFileNameChars()) -join '_'if (Test-Path $outFile) {  Remove-Item $outFile -Force} $i = 0do {  if ($json.album[$i].albumProductionType -match 'StudioAlbum') {    $found = $true    $albumUri = ($json.album[$i].'@id' + "?inc=releases&fmt=json") -replace '\.org\/', '.org/ws/2/'    $album = (Invoke-WebRequest -Uri "$($albumUri)") | ConvertFrom-Json    "$($album.releases[0].date) - $($album.title)" | Out-File -FilePath $outFile -Append  } else {    $found = $false  }  $i++} while ($found)
Which makes it a little nicer:

--- Code: Text ---1975-02-17 - High Voltage1975-12-01 - T.N.T.1976-05-14 - High Voltage1976-09-20 - Dirty Deeds Done Dirt Cheap1977-03-21 - Let There Be Rock1978-05-05 - Powerage1979-07-27 - Highway to Hell1980-07-25 - Back in Black1981-11-23 - For Those About to Rock (We Salute You)1983-08-15 - Flick of the Switch1985-06-28 - Fly on the Wall1988-01-18 - Blow Up Your Video1990-09-21 - The Razors Edge1995-09-22 - Ballbreaker2000-02-25 - Stiff Upper Lip2008-10-17 - Black Ice2014-11-28 - Rock or Bust2020-11-13 - Power Up
I guess AllMusic could be parsed using the HTML Agility Pack ... if I could work out how to use it ;D

fred dred:
Wow.  :Thmbsup:

I'm be happy for the list to contain both studio and live albums, the ones I wouldn't want would be compilations.

Still ..... wow :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version