mirror of
https://github.com/Googolplexed0/zotify.git
synced 2026-04-25 06:15:55 +03:00
[GH-ISSUE #158] [Bug Report] Unwanted Track Copies In Shared Directory #141
Labels
No labels
bug
considering
discussion
documentation
enhancement
enhancement
good first issue
help wanted
pull-request
question
stale
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/zotify#141
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @carlyd95 on GitHub (Jan 22, 2026).
Original GitHub issue: https://github.com/Googolplexed0/zotify/issues/158
Originally assigned to: @Googolplexed0 on GitHub.
Zotify Version
v0.15.3 (new-hierarchy)
Bug Description
There are 2 scenarios that have unfavorable outcomes with optimized downloading (OD) on or off.
Scenario 1:
Description: first download of track shared by multiple playlists (batch download playlists required)
Outcome:
Scenario 2:
Description: download a track that already has a file saved via a different track ID
Example tracks:
https://open.spotify.com/track/0Ftrkz2waaHcjKb4qYvLmz
https://open.spotify.com/track/3wJrBiiTIRRfKSL2TQWR60
Outcome:
Bug Triggering Command
sudo -u pi /home/pi/.local/bin/zotify -f tz.txt --download-format mp3 --download-quality very_high --root-path /media/pi/X9/DJ/Music --output "{artist} - {song_name}" --download-real-time True --md-save-genres True --client-id XXXXXXXXXXXXXXXXXX --debug --optimized-downloading (False or True)
Error Traceback / Logs
OUTPUT:
Scenario 1 (OD=True):
No output issues.
Scenario 1 (OD=False):
`DEBUG
Duplicate Check
File Already Exists: False
id in Local Archive: False
id in Global Archive: False
[∙∙∙] Preparing Download...
[∙∙●] Fetching lyrics...
SKIPPING: LYRICS FOR "Billie Eilish - BIRDS OF A FEATHER" (LYRICS NOT AVAILABLE)
[∙∙●] Converting File...
### WARNING: ATTEMPT TO CLONE TRACK "KREAM - Sweat" FAILED ###
### FALLING BACK TO REDOWNLOAD ###
### EXPECTED SOURCE FILES THAT DO NOT EXIST: ###
### ERROR: UNEXPECTED ERROR DURING DOWNLOADS ###
### ATTEMPTING TO CLEAN UP ###
Traceback (most recent call last):
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/api.py", line 1478, in download
try: super().download(ParentStack([self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/api.py", line 1095, in download
item.download(parent_stack)
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/api.py", line 1095, in download
item.download(parent_stack)
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/api.py", line 738, in download
elif self.downloaded and self.clone_file(parent_stack):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/api.py", line 495, in clone_file
Printer.json_dump(self.real_filepaths)
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/termoutput.py", line 202, in json_dump
obj = Printer._api_shrink(obj)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/termoutput.py", line 129, in _api_shrink
for k, v in obj.items():
RuntimeError: dictionary changed size during iteration
### ERROR: CLEAN UP COMPLETE ###
### LOGGING ERROR AND TRACEBACK ###
DEBUG
Total API Calls: 6
Traceback (most recent call last):
File "/home/pi/.local/bin/zotify", line 7, in
sys.exit(main())
^^^^^^
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/main.py", line 143, in main
client(args, modes)
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/app.py", line 186, in client
perform_query(args)
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/app.py", line 178, in perform_query
raise e
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/app.py", line 149, in perform_query
Query(Zotify.DATETIME_LAUNCH).request(urls).execute()
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/api.py", line 1519, in execute
self.download()
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/api.py", line 1508, in download
raise interrupt
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/api.py", line 1478, in download
try: super().download(ParentStack([self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/api.py", line 1095, in download
item.download(parent_stack)
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/api.py", line 1095, in download
item.download(parent_stack)
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/api.py", line 738, in download
elif self.downloaded and self.clone_file(parent_stack):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/api.py", line 495, in clone_file
Printer.json_dump(self.real_filepaths)
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/termoutput.py", line 202, in json_dump
obj = Printer._api_shrink(obj)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/.local/share/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/termoutput.py", line 129, in _api_shrink
for k, v in obj.items():
RuntimeError: dictionary changed size during iteration`
Scenario 2 output is the same respective of the OD setting
DEBUG:
Scenario 1 (OD=True):
zotify_DEBUG_2026-01-22_00-23-15.log
Scenario 1 (OD=False):
zotify_DEBUG_2026-01-22_00-25-28.log
Scenario 2 (OD=True):
zotify_DEBUG_2026-01-22_00-53-57.log
Scenario 2 (OD=False):
zotify_DEBUG_2026-01-22_00-57-53.log
Config File
config_DEBUG.json
Additional Comments
Saving all songs to a shared Music folder is potentially dependent to repeat these errors. I saved the tracks with the format: {artist} - {song_name}. I am not using Zotify's m3u8 feature currently.
Thank you!
@Googolplexed0 commented on GitHub (Jan 29, 2026):
All four testcases should be fixed and behave as expected after
github.com/Googolplexed0/zotify@c1575b96d3. I accidentally both skipped some important checks when cloning and had a few checks against a value never updated from its initialNonestate.For most use cases, there should still be cloning of the same track between file locations. For yours specifically, since all potential clones would be in the same directory and share a filename/filepath with the originals, there should be no cloning and therefore no duplicates. Please confirm if it does work for you.
@carlyd95 commented on GitHub (Feb 26, 2026):
@Googolplexed0 Sorry for the lack of response I was sick for a week and just got behind on a lot of responsibilities.
Thank you for your support! Looks like there still seems to be some issues with batch playlists from file.
Scenario 1 (OD Issues):
Description: first download of track shared by multiple playlists (batch download playlists required)
Output:
`DEBUG
### config_DEBUG.json saved to /home/pi/.config/zotify ###
### zotify_DEBUG_2026-02-25_22-49-16.log logging to /media/pi/X9/DJ/Music ###
[∙●∙] Logging in...
### WARNING: LOGIN FAILED (111) ###
### TRYING AGAIN AFTER SMALL WAIT ###
[∙∙∙] Logging in...
DEBUG
Session Initialized Successfully
User Subscription Type: PREMIUM
Request Parsed as 2 URLs
[∙∙●] Fetching playlist information...
[∙∙●] Fetching playlist information...
[●∙∙] Parsing playlist information...
[∙∙●] Fetching bulk genre information...
[∙∙●] Fetching bulk track/disc total information...
DEBUG
Total API Calls: 4`
Command Used:
sudo -u pi /home/pi/.local/bin/zotify -f tz.txt --download-format mp3 --download-quality very_high --root-path /media/pi/X9/DJ/Music --output "{artist} - {song_name}" --download-real-time True --md-save-genres True --client-id XXXXXXXXXXXXXXXXXXXX --debug --optimized-downloading True
Debug Log:
zotify_DEBUG_2026-02-25_22-49-16.log
Additional Note:
The original test was done with 2 playlists that both have the same single song which I have not downloaded before. I did another test by adding another song to both playlists that has already been downloaded and it outputs the following twice (once per playlist) but never outputs anything related to the track that has never been downloaded:
Scenario 2 (FIXED):
Description: download a track that already has a file saved via a different track ID
Example in my .song_ids: