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

Commit

Permalink
Fix delete on success check
Browse files Browse the repository at this point in the history
  • Loading branch information
thebigmunch committed Feb 15, 2016
1 parent 0cd883c commit cab9041
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions gmusicapi_wrapper/gmusicapi_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,13 @@ def upload(self, filepaths, enable_matching=False, transcode_quality='320k', del

not_uploaded_songs.update(not_uploaded)

if (uploaded or matched) and delete_on_success:
try:
os.remove(filepath)
except:
logger.warning("Failed to remove {} after successful upload".format(filepath))
success = (uploaded or matched) or (not_uploaded and 'ALREADY_EXISTS' in not_uploaded[filepath])

if success and delete_on_success:
try:
os.remove(filepath)
except:
logger.warning("Failed to remove {} after successful upload".format(filepath))

if errors:
logger.info("\n\nThe following errors occurred:\n")
Expand Down

0 comments on commit cab9041

Please sign in to comment.