Created
September 2, 2025 21:51
-
-
Save LaptopDev/2754e68b0d8866faa30d762a0a9d0137 to your computer and use it in GitHub Desktop.
Lists ebook matches in user's default calibre library by title and (with arg) path.
This file contains hidden or 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
| calibfind () | |
| { | |
| local cmd; | |
| local title; | |
| while [[ $# -gt 0 ]]; do | |
| case "$1" in | |
| -h | --h | -help | --help) | |
| echo "Usage:"; | |
| echo " calibfind <title> # list ebook info by title"; | |
| echo " calibfind -path <title> # return space-delimited quoted file paths"; | |
| return 0 | |
| ;; | |
| -path | --path) | |
| cmd="paths"; | |
| shift; | |
| title="$1" | |
| ;; | |
| *) | |
| cmd="find"; | |
| title="$1" | |
| ;; | |
| esac; | |
| shift; | |
| done; | |
| if [[ -z "$title" ]]; then | |
| echo "Usage: calibfind [-path] <title>"; | |
| return 1; | |
| fi; | |
| case "$cmd" in | |
| find) | |
| ( stty cols 500; | |
| calibredb list --search "title:$title" -f title ) | |
| ;; | |
| paths) | |
| ( stty cols 500; | |
| calibredb list --search "title:$title" -f formats ) | perl -ne 'print "\"$1\" " if /\[(.*?)\]/' | |
| ;; | |
| esac | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage