Closed RiffyDivine closed 9 months ago
Ah this might be an edge case I know about but hadn't caught in the wild to account for. Can you open your Bandcamp account in your browser, head to the "The Classy Wrecks / Bedrocksteady" release and click "download". Do you go to a page that asks for your email address to "reconfirm" your purchase? You may need to enter your email address and click a link in an email to be able to download this item.
Sorry for the delay, hell of a week. Anyway ran it now after doing what you said, I clicked the download for an album and it loaded up like it should on bandcamp. I went back to the cli and fire off the program and it is downloading but when it finished the download it gets the error "2023-10-11 22:50:32,895 sync [INFO] Downloading item "Gloryhammer / Return to the Kingdom of Fife" (id:234393023) from https://popplers5.bandcamp.com/download/album?enc=flac&id=234393023&sig=[masked]&sitem_id=246927766 to C:\Users\user\AppData\Local\Temp\tmp3toytfq7 2023-10-11 22:51:41,313 sync [ERROR] Downloaded file for "Gloryhammer / Return to the Kingdom of Fife" (id:234393023) at "C:\Users\Riffy\AppData\Local\Temp\tmp3toytfq7" is not a zip archive or a single track, skipping" so I am not sure if it is expecting to rename the files and then uncompressed it?
That error basically means that Bandcamp returned an HTML document (probably) and not either a single audio file or a zip of audio files. Typically this is either the download requires re-authentication or that the item doesn't have a functional download link. What do you see on that items download page in a browser? Do you actually see a download link and does it work? Are there downloads available in your selected format like flac?
I went to double check but when I goto my full list of albums, click the download link on one of them, it goes to another page that starts prepping the album to download and also gives the choice to pick the format I want flac or mp3 and after a moment it is ready to download. If you don't care I can just get a screen grab of each step if it helps explain it better.
That's the standard way to download media, this looks to be specific to the "Gloryhammer / Return to the Kingdom of Fife" download. Is that media item the same?
Edit: ah I note the different media items in the examples. Do all downloads fail? Or just one? Can you paste the full run log?
They all give that error but yes I only grabbed a snippet, I will do a full log and put it into a file tonight and add it to this when I get in. I didn't want to just throw a wall of text at you. They all run but give the same error of not being a zip file or having any music. But I will get the full log tonight but it will be long I got a lot of albums on it.
Here is the dump, minus my cookie information.
Ah interesting, thanks, that looks like two different issues. The files are being downloaded correctly but the check on them being "is a ZIP file" is failing. I'm not entirely sure why this is, but it might be something platform-specific on Windows as I've never tested this on Windows. I'll dig into the ZipFile library docs and see if there's anything weird in there.
As a test can you download an album as a ZIP file manually, then open a CLI window and do something like this:
C:\> python
The in the Python terminal / REPL:
from zipfile import ZipFile
with ZipFile('path/to/your/downloaded_album.zip') as z:
z.infolist()
And just see what that outputs?
That's the check BandcampSync does internally to check if the downloaded file is a ZIP or not. I'm assuming that's failing somehow with an exception / error.
The other error you're seeing in the logs:
NotADirectoryError: [WinError 267] The directory name is invalid: ...
Looks like some characters being used on NTFS aren't allowed or possibly some other Windows path based issues. I'll add some additional escaping / read the docs for that.
Any update on this @RiffyDivine ?
I'll close this for now, but feel free to re-open it if you can perform the testing described above.
I tried running this today and got it working okay as it was making folders but not grabbing any songs. I looked at the output and saw 2023-10-08 16:11:32,990 sync [ERROR] Downloaded file for "The Classy Wrecks / Bedrocksteady" (id:2279975560) at "C:\Users\username\AppData\Local\Temp\tmp247tma8f" is not a zip archive or a single track, skipping
and then it stops running after
2023-10-08 16:11:45,361 sync [INFO] New media item, will download: "The Holophonics / MaSKArades Vol. 14: Not A Cover Band" (id:398541076) in "flac" Traceback (most recent call last): File "C:\Users\user\AppData\Local\Programs\Python\Python312\Scripts\bandcampsync", line 49, in
do_sync(cookies_path, cookies, dir_path, media_format, temp_dir)
File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\bandcampsync__init__.py", line 30, in do_sync
local_path.mkdir(parents=True, exist_ok=True)
File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\pathlib.py", line 1312, in mkdir
os.mkdir(self, mode)
NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\Users\user\Music\The Holophonics\MaSKArades Vol. 14: Not A Cover Band'
Any idea what I did wrong?