You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
863 B
Bash
34 lines
863 B
Bash
11 years ago
|
#!/bin/bash
|
||
|
## Convert PDF to text and send to Pocket
|
||
|
## Written Nov 24, 2013
|
||
|
## Taha Ahmed
|
||
|
|
||
|
# Usage:
|
||
|
# pdf2pocket.sh worthreading.pdf
|
||
|
# Note: requires python and the python script "sendfromgmail.py"
|
||
|
|
||
|
|
||
|
pdffile=$1
|
||
|
# Filename without extension part
|
||
|
jobname=${pdffile%.*}
|
||
|
txtfile=$jobname.txt
|
||
|
htmlfile=$jobname.html
|
||
|
|
||
|
|
||
|
# convert PDF to txt (saved in the current directory)
|
||
|
# it seems txt works better than HTML (Pocket cannot reformat HTML files for reasons unknown to me...)
|
||
|
pdftotext $pdffile
|
||
|
|
||
|
|
||
|
# copy the created file to my Dropbox public folder
|
||
|
cp $txtfile /home/taha/Dropbox/Public/$txtfile
|
||
|
|
||
|
|
||
|
# construct the corresponding Dropbox public URL
|
||
|
htmlurl="https://dl.dropboxusercontent.com/u/47462551/$txtfile"
|
||
|
|
||
|
|
||
|
# email url of htmlfile in public Dropbox to Pocket
|
||
|
python ~/chepec/chetex/common/bash/sendfromgmail.py "add@getpocket.com" "dropbox2pocket" "$htmlurl"
|
||
|
|