1 Star 1 Fork 0

孟凡霄 / node-sorry

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

node-sorry

sorry有钱真的可以为所欲为

说明

思路参考sorry,目前已有RubyPythonJava,目前比较火的nodejs当然不能缺席!

node-sorry 使用的技术栈:

  • 1、nodejs 8.1 + express 4 + ejs
  • 2、Express Generator

演示地址:DEMO

sorry客户真的可以为所欲为样例:

目录结构

├─bin
│  │
│  └─www                     //是应用的主入口

├─controller                 // 后端Contoller
│  │  
│  └─render.js               // 核心代码,用ffmpeg生成gif图

├─node_modules               // 依赖

├─public                     // 静态资源
│  │
│  ├─cache                   //gif输出目录
│  │
│  ├─images                  //图片
│  │
│  ├─javascripts             //js
│  │
│  ├─stylesheets             //css样式
│  │
│  └─templates               //gif模板

├─routes                     // 路由目录
│  │
│  └─index.js                // 路由文件

├─views                      // 视图模板
│  │
│  ├─sorry                   // sorry html
│  │
│  ├─wangjingze              // swangjingze  html
│  │
│  └─404.html                // 404页面

├─app.js                     // 主要配置文件

├─ffmpeg.exe                 // 方便window用户使用,linux请安装

└─pageage.json
   
   

准备工作:

安装 NodeJS(请按照node8以上): https://nodejs.org/zh-cn/

安装yarn(可选)

npm install -g yarn

安装cnpm(可选)

npm install -g cnpm --registry=https://registry.npm.taobao.org

部署

# 安装依赖
$ npm install //或 yarn install 或 cnpm install

# 启动
$ npm run start

浏览器打开http://localhost:3000/

服务器部署

CentOS7下ffmpeg安装

wget https://ffmpeg.org/releases/ffmpeg-3.4.2.tar.bz2
yum -y install bzip2
yum -y install yasm
yum -y install libass libass-devel
tar -xf ffmpeg-3.4.2.tar.bz2
cd ffmpeg-3.4.2
./configure --enable-libass

make
make install

安装完成后,输入命令ffmpeg检查是否成功

特别注意:此时生成的gif文字会乱码,因为CentOS7缺少中文字体 安装字体

CentOS7下yum安装node8

首先用node -v检查是否安装或者版本过低 卸载

sudo yum -y remove nodejs

安装

curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum -y install nodejs

适配新Gif

目前,想要适配新的gif,需要改动3个文件(修改前建议备份)

public/templates/sorry/index.html
public/templates/sorry/template.mp4
public/templates/sorry/template.ejs

其中

index.html  按照句子的多少删掉或者增加<input>即可
template.mp4   替换成新视频
template.ejs   替换成新的字幕模板

字幕模板template.ejs

首先使用aegisub为模板视频创建字幕,保存为sorry.template.ass

aegisub教程

图片

然后把文本替换成模板字符串 {{ sentences[n] }} 懒得换图了哈,以这个字符串为准

图片

最后保存为template.ejs

现在这个网站就可以制作新的gif了

空文件

简介

表情包制作工具 node版 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/pingfanrenbiji/node-sorry.git
git@gitee.com:pingfanrenbiji/node-sorry.git
pingfanrenbiji
node-sorry
node-sorry
master

搜索帮助