X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=scripts.git;a=blobdiff_plain;f=arxiv-rename-pdf.sh;h=b165c5e67df954ce4c436040f3b21c016c4c40c1;hp=1cc408a35e099cf9604ee1a3c64c8394f100c640;hb=HEAD;hpb=3067965aacf2d5b62f951e2a393f420f5daba7de diff --git a/arxiv-rename-pdf.sh b/arxiv-rename-pdf.sh deleted file mode 100755 index 1cc408a..0000000 --- a/arxiv-rename-pdf.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash - -######################################################################### -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the version 3 of the GNU General Public License # -# as published by the Free Software Foundation. # -# # -# This program is distributed in the hope that it will be useful, but # -# WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # -# General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -# Written by and Copyright (C) Francois Fleuret # -# Contact for comments & bug reports # -######################################################################### - - -set -e -set -o pipefail - -[[ "${ARXIV_BIBFILE}" ]] || (echo >&2 "Define \$ARXIV_BIBFILE"; exit 2) -[[ "${ARXIV_BIBDIR}" ]] || (echo >&2 "Define \$ARXIV_BIBDIR"; exit 2) - -tmp=$(mktemp /tmp/arxiv-bib.sh.XXXXXX) - -while [[ "$1" ]] -do - - if [[ $1 =~ ^http ]] || [[ $1 =~ ^[0-9\.]*$ ]] - then - id="$(echo "$1" | sed -e 's|^.*/\([0-9.]*\)$|\1|')" - wget "https://arxiv.org/pdf/${id}" - filename="${id}.pdf" - else - filename="$1" - id="$(basename ${filename} .pdf)" - fi - - while [[ -f "${id}.pdf.part" ]] # dealing with firefox's download - do - echo "Waiting for ${id}.pdf.part to vanish" - sleep 1 - done - - echo -n "Fetching info from arxiv.org ... " - - curl -s > "${tmp}" "https://arxiv.org/abs/${id}" - - echo "done." - - ###################################################################### - # Bibtex entry - - AUTHORS="" - - while read line - do - [[ "${AUTHORS}" ]] && AUTHORS="${AUTHORS} and " - AUTHORS="${AUTHORS}${line}" - done < <(grep '> ${ARXIV_BIBFILE} <