Skip to content
This repository was archived by the owner on Oct 20, 2018. It is now read-only.

Commit cab9041

Browse files
committed
Fix delete on success check
1 parent 0cd883c commit cab9041

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

gmusicapi_wrapper/gmusicapi_wrapper.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,13 @@ def upload(self, filepaths, enable_matching=False, transcode_quality='320k', del
536536

537537
not_uploaded_songs.update(not_uploaded)
538538

539-
if (uploaded or matched) and delete_on_success:
540-
try:
541-
os.remove(filepath)
542-
except:
543-
logger.warning("Failed to remove {} after successful upload".format(filepath))
539+
success = (uploaded or matched) or (not_uploaded and 'ALREADY_EXISTS' in not_uploaded[filepath])
540+
541+
if success and delete_on_success:
542+
try:
543+
os.remove(filepath)
544+
except:
545+
logger.warning("Failed to remove {} after successful upload".format(filepath))
544546

545547
if errors:
546548
logger.info("\n\nThe following errors occurred:\n")

0 commit comments

Comments
 (0)