A simple & powerful tool for pictures uploading built by python
Project description
PyPicGo 是一款图床工具,是PicGo的Python版实现,并支持各种插件自定义插件,目前PyPicGo自带了gitee、github、SM.MS和七牛云图传,以及rename、notify和typora等插件,并支持从pypi中下载其他插件和Uploader
安装
pip install pypicgo
配置
配置文件位于/$HOME/.PyPicGo/config.yml目录下,采用YAML的方式进行配置。必须配置上传器uploader,插件plugins的数量可选
default: # 默认配置
uploader: gitee # 默认图床
plugins: # 全局插件
- module: pypicgo.plugins.rename.ReNamePlugin # 图床插件加载地址
config:
format: liunx{hash}chenghaiwen{date}-{filename}
- module: pypicgo.plugins.typora.TyporaPlugin
- module: pypicgo.plugins.compress.CompressPlugin
- module: pypicgo.plugins.notify.NotifyPlugin
uploaders: # 可用图床
smms: # sm.ms图床配置
module: pypicgo.uploaders.smms.uploader.SmmsUploader
config:
secret_token: xxx
gitee: # gitee 图床配置
module: pypicgo.uploaders.gitee.uploader.GiteeUploader
config:
domain: https://gitee.com
owner: xxx
repo: xxx
img_path: xxx
access_token: xxx
plugins:
github: # github图床配置
module: pypicgo.uploaders.github.uploader.GithubUploader
config:
domain: https://api.github.com
owner: xxx
repo: xxx
img_path: xxx
oauth_token: xxx
plugins: # github 图床私有插件
- module: pypicgo.plugins.jsdelivr.JsDelivrPlugin
qiniu: #七牛云图床配置
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
更多的配置说明参考文档
使用
帮助信息
pypicgo -h
上传文件
pypicgo -f picture1 picture2 ...
指定上传图床
pypicgo -n github -f picture1 picture2 ...
如果系统找不到pypicgo,请检查python的Scripts文件夹是否被加入Path环境变量
支持的图床
图床名 |
模块地址 |
|---|---|
gitee |
pypicgo.uploaders.gitee.uploader.GiteeUploader |
七牛云 |
pypicgo.uploaders.github.uploader.QiNiuUploader |
github |
pypicgo.uploaders.qiniu.uploader.GithubUploader |
SM.MS |
pypicgo.uploaders.smms.uploader.SmmsUploader |
支持的插件
插件名称 |
用途 |
windows |
linux |
mac |
|---|---|---|---|---|
rename |
上传前重命名图片 |
支持 |
支持 |
支持 |
notify |
上传成功失败的系统通知 |
支持 |
支持 |
支持 |
typora |
typora编辑器支持 |
支持 |
支持 |
支持 |
compress |
图片上传前压缩 |
支持 |
支持 |
支持 |
jsdelivr |
github CDN 加速 |
支持 |
支持 |
支持 |
clipboard |
上传完成将远程地址复制到剪切板 |
支持 |
支持 |
支持 |
watermark |
图片加水印 |
支持 |
支持 |
支持 |
Uploader上传器
uploader是具体的上传插件,用户需要继承pypicgo.core.base.uploader.CommonUploader并实现upload方法,然后在配置文件中引用即可.
插件系统
PyPicgo支持的插件分为三种before、after和final
插件类型 |
运行时间 |
基类类 |
示例插件 |
运行时入参 |
|---|---|---|---|---|
before |
在图 片上传前运行 |
`` pypicgo.core. base.plugin.B eforePlugin`` |
rename |
File |
after |
在图 片上传后运行 |
` pypicgo.core .base.plugin. AfterPlugin` |
notify |
Result |
final |
在所有图 片上传后运行 |
p ypicgo.core.b ase.plugin.Fi nallyPlugin |
typora |
List[Result] |
如果想自定义插件只要根据要求继承任意一个基类插件,并实现execute方法,并在config.yml中配置即可使用.
开发
git clone git@github.com:AnsGoo/PyPicGo.git
cd pypicgo
pipenv shell
pipenv install
python run.py -n 图床名 -f img1.jpg img2.jpg
第三方插件
插件名称 |
作用 |
|---|---|
pypicgo-tinypng-plugin |
利用tinypng公开接口来压缩图片 |
pypicgo-blind-watermark-plugin |
给图片加盲水印 |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pypicgo-1.2.1.tar.gz.
File metadata
- Download URL: pypicgo-1.2.1.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d50fc72067a72766b4e7ea1184b9f44bfc40901413764e62297cd745f31e0df6
|
|
| MD5 |
31467c2a162dc6141c5d32e006f09d35
|
|
| BLAKE2b-256 |
718442a51049e78f7d3b84079ffcfaed4ed59faeb5e8be1958d06adf1c9175c4
|