1. PyPicGo
PyPicGo is a drawing bed tool, but PicGo is the implementation of Python version, and supports various plug-in custom plug-ins. At present, PyPicGo comes with gitee, github, SM. MS and 7 Niuyun pictures, as well as rename, notify and typora plug-ins, and supports downloading other plug-ins and Uploader from pypi
Source address:
“gitee” https://gitee.com/Ranger313/pypicgo
[github] https://github.com/AnsGoo/PyPicGo
1. Installation
pip install pypicgo
2. Configuration
The configuration file is located in the /$HOME/.PyPicGo/config.yml Directory, adopt YAML Configure in the way of. You must configure the uploader uploader , plug-ins plugins Optional quantity of
default: # Default configuration
uploader: gitee # Default chart bed
plugins: # Global plug-in
- module: pypicgo.plugins.rename.ReNamePlugin # Graphic bed plug-in loading address
config:
format: liunx{hash}chenghaiwen{date}-{filename}
- module: pypicgo.plugins.typora.TyporaPlugin
- module: pypicgo.plugins.compress.CompressPlugin
- module: pypicgo.plugins.notify.NotifyPlugin
uploaders: # Available drawing bed
smms: # sm.ms Graphic bed configuration
module: pypicgo.uploaders.smms.uploader.SmmsUploader
config:
secret_token: xxx
gitee: # gitee Graphic bed configuration
module: pypicgo.uploaders.gitee.uploader.GiteeUploader
config:
domain: https://gitee.com
owner: xxx
repo: xxx
img_path: xxx
access_token: xxx
plugins:
github: # github Graphic bed configuration
module: pypicgo.uploaders.github.uploader.GithubUploader
config:
domain: https://api.github.com
owner: xxx
repo: xxx
img_path: xxx
oauth_token: xxx
plugins: # github Graphic bed private plug-in
- module: pypicgo.plugins.jsdelivr.JsDelivrPlugin
qiniu: #7 Configuration of cattle cloud picture bed
moduele: pypicgo.uploaders.qiniu.uploader.QiNiuUploader
config:
domain: http://demo.pypicho.com/
bucket_name: pypicgo
apis:
- http://up-z1.qiniup.com
access_key: xxx
secret_key: xxxx
Refer to the documentation for more configuration instructions
3. Use
Help information
pypicgo -h
Upload a file
pypicgo -f picture1 picture2 ...
Specify the bed for uploading pictures
pypicgo -n github -f picture1 picture2 ...
If the system can’t find it pypicgo , please check python Adj. Scripts Is the folder added Path Environment variable
4. Supported map bed
| 图床名 | 模块地址 |
|---|---|
| gitee | pypicgo.uploaders.gitee.uploader.GiteeUploader |
| 7牛云 | pypicgo.uploaders.github.uploader.QiNiuUploader |
| github | pypicgo.uploaders.qiniu.uploader.GithubUploader |
| SM.MS | pypicgo.uploaders.smms.uploader.SmmsUploader |
5. Supported plug-ins
| 插件名称 | 用途 | windows | linux | mac |
|---|---|---|---|---|
| rename | 上传前重命名图片 | 支持 | 支持 | 支持 |
| notify | 上传成功失败的系统通知 | 支持 | 支持 | 支持 |
| typora | typora编辑器支持 | 支持 | 支持 | 支持 |
| compress | 图片上传前压缩 | 支持 | 支持 | 支持 |
| jsdelivr | github CDN 加速 | 支持 | 支持 | 支持 |
| clipboard | 上传完成将远程地址复制到剪切板 | 支持 | 支持 | 支持 |
6. Uploader uploader
uploader Is a specific upload plug-in, and users need to inherit pypicgo.core.base.uploader.CommonUploader And implement YAML0 Method, and then reference it in the configuration file.
7. Plug-in system
PyPicgo There are three supported plug-ins before , after And final
| 插件类型 | 运行时间 | 基类类 | 示例插件 | 运行时入参 |
|---|---|---|---|---|
| before | 在图片上传前运行 | pypicgo.core.base.plugin.BeforePlugin | rename | File |
| after | 在图片上传后运行 | pypicgo.core.base.plugin.AfterPlugin | notify | Result |
| final | 在所有图片上传后运行 | pypicgo.core.base.plugin.FinallyPlugin | typora | List[Result] |
If you want to customize the plug-in, just inherit any 1 base class plug-in as required, and implement the execute method, and in config.yml You can use the configuration in.
8. Development
git clone git@github.com:AnsGoo/PyPicGo.git
cd pypicgo
pipenv shell
pipenv install
python run.py -n Drawing bed name -f img1.jpg img2.jpg