Process suggestion according to option
This commit is contained in:
26
send_data.py
26
send_data.py
@@ -152,18 +152,24 @@ def main():
|
||||
if args.ALL or args.no_suggest:
|
||||
print("Process suggestion:")
|
||||
if args.DELETE: # TODO Do a method?
|
||||
mapping_suggest = load_file(args.mapping_suggest, DEFAULT_MAPPING_SUGGEST_FILE)
|
||||
if not args.quiet:
|
||||
print("Mapping of suggest index file: '{}'".format(mapping_suggest.name))
|
||||
|
||||
delete_index(SUGGEST_INDEX, args.quiet)
|
||||
put_mapping(SUGGEST_INDEX, mapping_suggest, args.quiet)
|
||||
|
||||
suggs_docs = 0
|
||||
suggs_docs += process_file('/home/budd/workspace/iTunes/es-albums.json', 'Album')
|
||||
print('Created documents: ' + str(suggs_docs))
|
||||
suggs_docs += process_file('/home/budd/workspace/iTunes/es-artists.json', 'Artist', 'Album Artist')
|
||||
print('Created documents: ' + str(suggs_docs))
|
||||
if not args.ALL and not args.album_file and not args.artist_file:
|
||||
print('Only song file processed. No suggestion to process.')
|
||||
else:
|
||||
if args.DELETE:
|
||||
mapping_suggest = load_file(args.mapping_suggest, DEFAULT_MAPPING_SUGGEST_FILE)
|
||||
if not args.quiet:
|
||||
print("Mapping of suggest index file: '{}'".format(mapping_suggest.name))
|
||||
put_mapping(SUGGEST_INDEX, mapping_suggest, args.quiet)
|
||||
|
||||
suggs_docs = 0
|
||||
if args.album_file or args.ALL:
|
||||
suggs_docs += process_file(DEFAULT_ALBUM_FILE, 'Album')
|
||||
print('Created suggestion documents: ' + str(suggs_docs))
|
||||
if args.artist_file or args.ALL:
|
||||
suggs_docs += process_file(DEFAULT_ARTIST_FILE, 'Artist', 'Album Artist')
|
||||
print('Created suggestion documents: ' + str(suggs_docs))
|
||||
|
||||
print("I'm done!")
|
||||
if check_is_ok.count(False) > 0:
|
||||
|
||||
Reference in New Issue
Block a user