Skip to content

Commit

Permalink
Update update_dblp_auto.py
Browse files Browse the repository at this point in the history
Adds an option to select auto/manual mode.
  • Loading branch information
lancercat authored Oct 23, 2023
1 parent 74ba162 commit 0241983
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions bin/update_dblp_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,24 @@ def main():
default=bibtex_dblp.config.MAX_SEARCH_RESULTS)

parser.add_argument('--verbose', '-v', help='print more output', action="store_true")
parser.add_argument('--semiauto', '-a', help='enable semi-auto mode', action="store_true")

args = parser.parse_args()

logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG if args.verbose else logging.INFO)
outfile = args.infile if args.out is None else args.out
bib_format = args.format
max_search_results = args.max_results

semiauto=args.semiauto;
# Load bibliography
bib = bibtex_dblp.database.load_from_file(args.infile)
new_entries = deepcopy(bib.entries)
missings=[];
# Iterate over all entries
no_changes = 0
for entry_str, entry in bib.entries.items():
time.sleep(4);
if(semiauto):
time.sleep(10);

# Check for id
dblp_id = bibtex_dblp.dblp_api.extract_dblp_id(entry)
Expand Down Expand Up @@ -93,14 +96,18 @@ def main():
for i in range(len(search_results.results)):
result = search_results.results[i]
print("({})\t{}".format(i + 1, result.publication))
if(len(val_results)>1):
# Let user select correct publication
select = bibtex_dblp.io.get_user_number("Select the intended publication (0 to abort): ", 0,
search_results.total_matches)
elif(len(val_results)==0):
select=1;
if(semiauto):
if(len(val_results)>1):
# Let user select correct publication
select = bibtex_dblp.io.get_user_number("Select the intended publication (0 to abort): ", 0,
search_results.total_matches)
elif(len(val_results)==0):
select=1;
else:
select=val_results[0];
else:
select=val_results[0];
select = bibtex_dblp.io.get_user_number("Select the intended publication (0 to abort): ", 0,
search_results.total_matches);

if select == 0:
print("Cancelled.")
Expand Down

0 comments on commit 0241983

Please sign in to comment.