meeb / bandcampsync

Downloads your Bandcamp purchases automatically
BSD 3-Clause "New" or "Revised" License
133 stars 6 forks source link

A particular single always gets redownloaded despite already being synced #5

Closed jfurrow closed 10 months ago

jfurrow commented 10 months ago

Hi, great script here!

I have 87 Bandcamp purchases and just this one particular release keeps getting redownloaded every time I run the script. The release in question is https://thefieryfurnaces.bandcamp.com/album/down-at-the-so-and-so-on-somewhere

Let me know if I can help debug this. Here's the script output from the last time I ran it:

...
2023-09-20 19:18:43,637 sync [INFO] New media item, will download: "The Fiery Furnaces / Down at the So and So on Somewhere "(id:3159597158) in "flac"
2023-09-20 19:18:44,187 sync [INFO] Downloading item "The Fiery Furnaces / Down at the So and So on Somewhere" (id:3159597158) from https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874881 to /tmp/tmppiabqv_f
2023-09-20 19:18:44,848 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874881: 10%
2023-09-20 19:18:45,101 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874881: 20%
2023-09-20 19:18:45,489 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874881: 30%
2023-09-20 19:18:46,027 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874881: 40%
2023-09-20 19:18:46,582 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874881: 50%
2023-09-20 19:18:47,126 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874881: 60%
2023-09-20 19:18:47,815 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874881: 70%
2023-09-20 19:18:48,484 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874881: 80%
2023-09-20 19:18:49,143 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874881: 90%
2023-09-20 19:18:49,932 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874881: 100%
2023-09-20 19:18:49,933 sync [INFO] Decompressing downloaded zip "/tmp/tmppiabqv_f" to "/tmp/tmpzjtj7awv"
2023-09-20 19:18:50,050 sync [INFO] Moving extracted file: "/tmp/tmpzjtj7awv/cover.jpg" to "/media/store-f/music/sorted/The Fiery Furnaces/Down at the So and So on Somewhere/cover.jpg"
2023-09-20 19:18:50,099 sync [INFO] Moving extracted file: "/tmp/tmpzjtj7awv/The Fiery Furnaces - Down at the So and So on Somewhere - 01 Down at the So and So on Somewhere.flac" to "/media/store-f/music/sorted/The Fiery Furnaces/Down at the So and So on Somewhere/The Fiery Furnaces - Down at the So and So on Somewhere - 01 Down at the So and So on Somewhere.flac"
2023-09-20 19:18:50,570 media [INFO] Writing bandcamp item id:3159597158 to: /media/store-f/music/sorted/The Fiery Furnaces/Down at the So and So on Somewhere/bandcamp_item_id.txt
2023-09-20 19:18:50,584 sync [INFO] Already locally downloaded, skipping: "The Fiery Furnaces / Down at the So and So on Somewhere "(id:2569082990)
...

And I can see the file is definitely there:

-rw-rw-r-- 1 john john   11 Sep 20 19:15  bandcamp_item_id.txt
-rw-rw-r-- 1 john john 4.8M Sep 20 19:15  cover.jpg
-rw-rw-r-- 1 john john  54M Sep 20 19:15 'The Fiery Furnaces - Down at the So and So on Somewhere - 01 Down at the So and So on Somewhere.flac'

Thanks!

meeb commented 10 months ago

Interesting. What's in that bandcamp_item_id.txt file? It should contain just 3159597158. Also can you search your logs from the start for 3159597158? There should be a line about detecting the release directory at the start of the script. Something like this:

2023-09-21 03:32:15,836 media [INFO] Detected locally downloaded media: 3159597158 = /downloads/artist/album-somewhere

That line is the local media scanner detecting the previously downloaded album so if that line is missing it's not being detected which is why it's being downloaded repeatedly.

Also please check you're running the latest release which is 0.3.1 (pull :latest again if you're running it in a container).

jfurrow commented 10 months ago

Thanks for the quick response!

bandcamp_item_id.txt contains 3159597158

The logs do show that it was locally detected:

2023-09-20 22:26:15,465 media [INFO] Detected locally downloaded media: 3159597158 = /media/store-f/music/sorted/The Fiery Furnaces/Down at the So and So on Somewhere

I'm on version 0.3.1, installed via pip

I just noticed it outputs Already locally downloaded right before New media item, will download for this release:

2023-09-20 22:26:16,836 sync [INFO] Already locally downloaded, skipping: "The Fiery Furnaces / Down at the So and So on Somewhere "(id:3159597158)
2023-09-20 22:26:16,836 sync [INFO] New media item, will download: "The Fiery Furnaces / Down at the So and So on Somewhere "(id:2569082990) in "flac"
2023-09-20 22:26:17,608 sync [INFO] Downloading item "The Fiery Furnaces / Down at the So and So on Somewhere" (id:2569082990) from https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874888 to /tmp/tmpkx67asvu
2023-09-20 22:26:18,412 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874888: 10%
2023-09-20 22:26:18,635 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874888: 20%
2023-09-20 22:26:18,910 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874888: 30%
2023-09-20 22:26:19,181 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874888: 40%
2023-09-20 22:26:19,539 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874888: 50%
2023-09-20 22:26:19,895 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874888: 60%
2023-09-20 22:26:20,249 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874888: 70%
2023-09-20 22:26:20,597 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874888: 80%
2023-09-20 22:26:20,938 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874888: 90%
2023-09-20 22:26:21,284 download [INFO] Downloading https://popplers5.bandcamp.com/download/album?enc=flac&id=2569082990&sig=[masked]&sitem_id=119874888: 100%
2023-09-20 22:26:21,286 sync [INFO] Decompressing downloaded zip "/tmp/tmpkx67asvu" to "/tmp/tmp2vygy025"
2023-09-20 22:26:21,396 sync [INFO] Moving extracted file: "/tmp/tmp2vygy025/cover.jpg" to "/media/store-f/music/sorted/The Fiery Furnaces/Down at the So and So on Somewhere/cover.jpg"
2023-09-20 22:26:21,505 sync [INFO] Moving extracted file: "/tmp/tmp2vygy025/The Fiery Furnaces - Down at the So and So on Somewhere - 01 Down at the So and So on Somewhere.flac" to "/media/store-f/music/sorted/The Fiery Furnaces/Down at the So and So on Somewhere/The Fiery Furnaces - Down at the So and So on Somewhere - 01 Down at the So and So on Somewhere.flac"
2023-09-20 22:26:22,196 media [INFO] Writing bandcamp item id:2569082990 to: /media/store-f/music/sorted/The Fiery Furnaces/Down at the So and So on Somewhere/bandcamp_item_id.txt
meeb commented 10 months ago

Ah, this may well be caused by your release having two releases with different IDs?

2023-09-20 22:26:16,836 sync [INFO] Already locally downloaded, skipping: "The Fiery Furnaces / Down at the So and So on Somewhere "(id:3159597158)
2023-09-20 22:26:16,836 sync [INFO] New media item, will download: "The Fiery Furnaces / Down at the So and So on Somewhere "(id:2569082990) in "flac"

This is with item ID 3159597158 and item ID 2569082990. I expect what's happening here is one release is being downloaded and one ID being written, then on next run the other release is being downloaded and the ID being overwritten on loop.

Can you check if this release does seem to have two releases on your Bandcamp account?

jfurrow commented 10 months ago

Ohh yep, totally, that's it. I bought the digital release that's still available for sale and later bought the physical 7" release, which is no longer visible publicly:

Screenshot 2023-09-20 at 10 36 42 PM
meeb commented 10 months ago

OK, I'll add a uniqueness check on the "The Fiery Furnaces / Down at the So and So on Somewhere" string as well as the ID to prevent this.

jfurrow commented 10 months ago

Cool, thanks for looking into it 🙏

meeb commented 10 months ago

This is fixed in the latest 0.3.2 release. Give it a few minutes to build the container then pull :latest again (or pip update, however you're running it).

meeb commented 10 months ago

Also you'll now see something like this in the logs when the ID mismatch occurs:

2023-09-21 06:54:11,281 media [INFO] Detected album at "/some/directory/Artist/Album" but with an item ID mismatch (bandcamp_item_id.txt file does not contain 123456789), you may want to check this item is correctly downloaded
jfurrow commented 10 months ago

Yep, working well for me, thank you!