Created
July 18, 2017 12:12
-
-
Save akirak/1f7de06e3b77050cb4a594adf73f64df to your computer and use it in GitHub Desktop.
A tiny shell script to add a book in your Manning library (on Dropbox) to your calibre library using fzf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
python <<PYTHON | fzf -m | xargs -d'\n' calibredb add | |
import os.path | |
import glob | |
root = os.path.expanduser('~/Dropbox/Apps/Manning Books') | |
files = glob.glob(os.path.join(root, '**/*.epub')) | |
result = sorted(list(map(lambda f: (f, os.path.getctime(f)), files)), key=lambda t: t[1], reverse=True) | |
candidates = list(map(lambda f: f[0], result)) | |
for c in candidates: | |
print(c) | |
PYTHON |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment