tAdd articlesearch script - scholarref - tools for DOI and BiBTeX reference ext… | |
git clone git://src.adamsgaard.dk/scholarref | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit a2e5e0d81addbf4ff5172b75aeddae3ba079401e | |
parent f1a6605ced4f8aa9ccb77ab2cd7bf6a5d3defe48 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Mon, 16 Sep 2019 16:15:23 +0200 | |
Add articlesearch script | |
Diffstat: | |
M README | 9 +++++++-- | |
A articlesearch | 24 ++++++++++++++++++++++++ | |
2 files changed, 31 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/README b/README | |
t@@ -1,14 +1,16 @@ | |
# scholarref | |
POSIX shell tools to extract, fetch, and parse DOIs and BiBTeX bibliography | |
-references. | |
+references. The following scripts provide the core functionality: | |
- getdoi: takes a file or a search query and returns its DOI | |
- getref: takes a DOI and returns the corresponding BiBTeX entry | |
- shdl: takes a DOI and fetches the corresponding pdf from sci-hub.tw | |
The script `scholarref` is an example where `getref` and `getdoi` are | |
-combined to obtain a BiBTeX entry from a search query. | |
+combined to obtain a BiBTeX entry from a search query. The `articlesearch` | |
+script is an interactive PDF opener, reference manager, and publication | |
+fetcher for X11 using dmenu[0] and the scholarref tools. | |
## Installation | |
Use locally or run `make install` to install under `/usr/local/bin`. Run | |
t@@ -71,3 +73,6 @@ OPTIONS are one or more of the following: | |
-n, --notify send desktop notification when complete | |
-o, --open open downloaded document when complete | |
-- do not consider any following args as options | |
+ | |
+## References | |
+0: https://tools.suckless.org/dmenu/ | |
diff --git a/articlesearch b/articlesearch | |
t@@ -0,0 +1,24 @@ | |
+#!/bin/sh | |
+set -e | |
+ | |
+# List of directory paths that contain PDFs | |
+dir="$HOME/articles $HOME/books" | |
+ | |
+query="$(find $dir -type f | sed "s|$HOME/||" | dmenu -i -l 10 -p "Search publ… | |
+action="$(printf "Open\nGet DOI\nSci-Hub\nAdd reference" | dmenu -i -p "Action… | |
+ | |
+if [ "$action" = "Open" ]; then | |
+ if [ -f "$HOME/$query" ]; then | |
+ xdg-open "$HOME/$query" | |
+ else | |
+ xdg-open "https://scholar.google.com/scholar?q=$query" | |
+ fi | |
+elif [ "$action" = "Get DOI" ]; then | |
+ getdoi -n -c "$query" | |
+elif [ "$action" = "Sci-Hub" ]; then | |
+ getdoi "$query" | shdl --tor-socks --notify --open | |
+elif [ "$action" = "Add reference" ]; then | |
+ scholarref --add "$query" | |
+else | |
+ notify-send --category=error "${0##*/}" "Action not understood" | |
+fi |