Skip to content

Commit

Permalink
Don’t make any WS2 requests for --force-submit
Browse files Browse the repository at this point in the history
Move logic for checking for `option.force_submit` in
Disc.select_release() before fetching (potential) matching
releases in MusicBrainz.

This both speeds up the handling of `--force-submit` and also
decreases net load ever so slightly (probably unnoticeably),
both for the user and for MB. :)

Fixes JonnyJD#128
  • Loading branch information
Freso committed May 5, 2021
1 parent a9efcbd commit 87de46a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions isrcsubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,13 +728,15 @@ def select_release(self):
This will ask the user to choose if the discID is ambiguous.
"""
if options.force_submit:
# If asked to force submission, just return None straight
# away and skip all other logic, e.g. unneeded WS2 requests.
print("\nSubmission forced.")
return None
includes = self._common_includes
results = ws2.get_releases_by_discid(self.id, includes=includes)
num_results = len(results)
if options.force_submit:
print("\nSubmission forced.")
selected_release = None
elif num_results == 0:
if num_results == 0:
print("\nThis Disc ID is not in the database.")
selected_release = None
elif num_results > 1:
Expand Down

0 comments on commit 87de46a

Please sign in to comment.