1 Star 7 Fork 4

独行侠 / PyPicGo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

PyPicGo

PyPicGo 是一款图床工具,是PicGo的Python版实现,并支持各种插件自定义插件,目前PyPicGo自带了giteegithubSM.MS七牛云图传,以及renamenotifytypora等插件,并支持从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,请检查pythonScripts文件夹是否被加入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支持的插件分为三种beforeafterfinal

插件类型 运行时间 基类类 示例插件 运行时入参
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]

如果想自定义插件只要根据要求继承任意一个基类插件,并实现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 给图片加盲水印
MIT License Copyright (c) 2021 AnsGoo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

PyPicGo 是一款图床工具,是PicGo的Python版实现,并支持各种插件自定义插件,目前PyPicGo自带了gitee、github、SM.MS和七牛云图传,和rename、notify和typora等插件,并支持从pypi中下载其他插件和Uploader 展开 收起
Python
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/Ranger313/pypicgo.git
git@gitee.com:Ranger313/pypicgo.git
Ranger313
pypicgo
PyPicGo
master

搜索帮助