def manual_search(singleton): """Input either an artist and album (for full albums) or artist and track name (for singletons) for manual search. """ artist = input_('Artist:') name = input_('Track:' if singleton else 'Album:') return artist.strip(), name.strip()
def manual_id(singleton): """Input a MusicBrainz ID, either for an album ("release") or a track ("recording"). If no valid ID is entered, returns None. """ prompt = 'Enter MusicBrainz %s ID:' % \ ('recording' if singleton else 'release') entry = input_(prompt).strip() # Find the first thing that looks like a UUID/MBID. match = re.search('[a-f0-9]{8}(-[a-f0-9]{4}){3}-[a-f0-9]{12}', entry) if match: return match.group() else: log.error('Invalid MBID.') return None