Ezwen/bandcamp-collection-downloader

Collection download fails for release with no download

Closed this issue · 5 comments

As per the title, downloading my collection fails when it hits this release which does not have a download (Vinyl only release)

https://wrong-music.bandcamp.com/album/jez-north-kill-all-cover-band

Found release "Jez North - Kill All Cover Band" (2020) by wrong-music (Bandcamp ID: p102753531).                                  
Exception in thread "main" java.lang.NullPointerException
	at bandcampcollectiondownloader.BandcampAPIConnector.retrieveRealDownloadURL(BandcampAPIConnector.kt:184)
	at bandcampcollectiondownloader.BandcampCollectionDownloader.manageDownloadPage(BandcampCollectionDownloader.kt:164)
	at bandcampcollectiondownloader.BandcampCollectionDownloader.access$manageDownloadPage(BandcampCollectionDownloader.kt:14)
	at bandcampcollectiondownloader.BandcampCollectionDownloader$downloadAll$task$1.run(BandcampCollectionDownloader.kt:108)
	at bandcampcollectiondownloader.BandcampCollectionDownloader.downloadAll(BandcampCollectionDownloader.kt:118)
	at bandcampcollectiondownloader.MainKt.main(Main.kt:37)
Ezwen commented

Thanks for the report! This is strange, we should already manage such cases with this piece of code that we have just before line 184 :

        // Some releases have no digital items (eg. vinyl only)
        if (digitalItem == null) {
            return null
        }

I wonder why this does not work. Hm maybe there is a digitalItem, but without any downloads inside of it.

@ryanwalder I made a test build that maybe solves your problem, can you try it? Link: https://framagit.org/Ezwen/bandcamp-collection-downloader/-/jobs/1186805/artifacts/raw/build/libs/bandcamp-collection-downloader.jar?inline=false

Thanks for taking a look! Unfortunately using the provided build didn't work:

~/downloads $ java -jar ./bandcamp-collection-downloader.jar --version
v2020-10-31

java -jar ./bandcamp-collection-downloader.jar --download-folder=/media/ftp/Uploads/bandcamp zombietwiglet --audio-format=flac --jobs=1 --retries=100
Target bandcamp account: zombietwiglet
Target download folder: /media/ftp/Uploads/bandcamp
Target audio format: flac
------------                                                                                                                      
No provided cookies file, using Firefox cookies…
Trying cookies from: /home/ryan/.mozilla/firefox/4eww0a31.default-release/cookies.sqlite
------------
Connecting to Bandcamp…
Found "zombietwiglet's collection | Bandcamp" with 95 items.
Ignoring 37 already downloaded items (based on '/media/ftp/Uploads/bandcamp/bandcamp-collection-downloader.cache').
------------
Managing item 1/58
Found release "Jez North - Kill All Cover Band" (2020) by wrong-music (Bandcamp ID: p102753531).
Exception in thread "main" java.lang.NullPointerException
	at bandcampcollectiondownloader.BandcampAPIConnector.retrieveRealDownloadURL(BandcampAPIConnector.kt:180)
	at bandcampcollectiondownloader.BandcampCollectionDownloader.manageDownloadPage(BandcampCollectionDownloader.kt:164)
	at bandcampcollectiondownloader.BandcampCollectionDownloader.access$manageDownloadPage(BandcampCollectionDownloader.kt:14)
	at bandcampcollectiondownloader.BandcampCollectionDownloader$downloadAll$task$1.run(BandcampCollectionDownloader.kt:108)
	at bandcampcollectiondownloader.BandcampCollectionDownloader.downloadAll(BandcampCollectionDownloader.kt:118)
	at bandcampcollectiondownloader.MainKt.main(Main.kt:37)

That works!

Found release "Jez North - Kill All Cover Band" (2020) by wrong-music (Bandcamp ID: p102753531).                                  
Could not download item: No URL found for item (maybe the release has no digital item, or the provided download format is invalid)

Thanks so much for you help and the great program, keep up the great work!

Ezwen commented

All right then I'll merge my change in the master branch, and make a release eventually.