Skip to content

Commit

Permalink
新版本
Browse files Browse the repository at this point in the history
  • Loading branch information
wxnacy committed Jul 5, 2019
1 parent e0888bc commit a0dcb7a
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 6 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,22 @@ $ ws datetime # 获取当前日期和时间

如果你本地配置了 mutt 邮件发送,然后安装如下方式配置好你的 Kindle 邮箱即可推送

**配置 kindle 接收邮箱**

```bash
$ echo "[email protected]" > ~/.config/wshell/kindle/kindrc
```

**配置 mutt 推送邮箱配置**

```bash
# 配置邮箱
$ echo "[email protected]" > ~/.config/wshell/kindle
set smtp_url = "smtp://<your_send_email>@<smtp_url>:<smtp_port>"
set smtp_pass = "<your_send_email_password>"
set from = "<your_send_email>"
```

**推送**

```bash
$ ws kindle push <bookfile> # 推送
```
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.2
1.5.8
2 changes: 2 additions & 0 deletions bin/base/bf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def format_size(size: int):
print(line)

filelists.sort(key=lambda x: x['size'], reverse=True)
if len(filelists) <= 10:
sys.exit(0)
print('\n排序后,最大的 10 个文件')

for f in filelists[:10]:
Expand Down
29 changes: 29 additions & 0 deletions bin/book/publish
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Author: wxnacy([email protected])
# Description: 将书发布到 https://github.com/wxnacy/book

filepath=$1

publish(){
book_dir=$1
goss -r book -p book/${book_dir}/ $2
}

if [ -f $filepath ]
then
names=($(ws py parse_filename.py $filepath))
book_dir=${names[2]}
publish $book_dir $filepath
else
filepath=$(python -c "print('${filepath}'.rstrip('/'))")
book_dir=$(python -c "print('${filepath}'.split('/')[-1])")

for f in `ls $filepath`
do
fp=$filepath/$f
echo $fp
publish $book_dir $fp
done

fi

11 changes: 8 additions & 3 deletions bin/kindle/push
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/usr/bin/env bash
# Author: wxnacy([email protected])
# Description: 推送书籍到 kindle
# vim ${HOME}/.config/wshell/kindle
# vim ${HOME}/.config/wshell/kindle/kindrc
# [email protected]
# vim ${HOME}/.config/wshell/kindle/muttrc
# set smtp_url = "smtp://<your_email>@<smtp_url>:<smtp_port>"
# set smtp_pass = "<email_password>"
# set from = "<your_email>"

. ${HOME}/.config/wshell/kindle
. ${HOME}/.config/wshell/kindle/kindrc

path=$1

Expand All @@ -14,6 +18,7 @@ then
exit 0
fi

mutt $email -a $path < /dev/null
echo "Begin push $path"
mutt $email -F ${HOME}/.config/wshell/kindle/muttrc -s $path -a $path < /dev/null
echo 'Success!'

29 changes: 29 additions & 0 deletions bin/mutt/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Author: wxnacy([email protected])
# Description:


OS=`ws os`
OSS=(${OS})
SYS=${OSS[0]}
VER=${OSS[1]}
PKG=${OSS[2]}

case $SYS in
debian|ubuntu|devuan|deepin)
sudo apt update -y
sudo apt install mutt -y
;;
centos|fedora|rhel|amzn)
sudo yum update -y
sudo yum install mutt -y
;;
Darwin)
brew install mutt
;;
*)
echo '暂时不支持该系统'
;;
esac


24 changes: 24 additions & 0 deletions bin/py/parse_filename.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: wxnacy([email protected])
# Description: 解析文件名

import os

def parse(filename):
filedir, name = os.path.split(filename)
names = name.split(".")
result = [filedir or '.', name]
result.extend(names)
return result

if __name__ == "__main__":
import sys
filename = sys.argv[1]
# filename = '~/Downloads/人间失格/人间失格.mobi'
# filename = '~/Downloads/人间失格/'
a, b, c, d = parse(filename)
print(a, b, c, d)



3 changes: 3 additions & 0 deletions conf/bash/bash_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ alias gt="git tag -l"
# for system
alias ll="ls -l"
alias la="ls -la"
alias lh="ls -lh"
alias dfh="df -h"
alias du1="du -d 1 -h"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
Expand Down

0 comments on commit a0dcb7a

Please sign in to comment.