预设视频相关内容

This commit is contained in:
Yutousama 2021-08-17 08:10:58 +08:00
parent d8acadf2d7
commit 2f1bd267bf
21 changed files with 3728 additions and 24 deletions

View File

@ -0,0 +1,8 @@
package com.yutou.nas.Services;
import java.io.File;
public interface IVideoToolsService {
void scanVideo();
// void outSubtitle(int id, String code, File file);
}

View File

@ -0,0 +1,220 @@
package com.yutou.nas.Services.impl;
import com.alibaba.fastjson.JSONObject;
import com.yutou.nas.Services.IVideoToolsService;
import com.yutou.nas.bangumi.BangumiTools;
import com.yutou.nas.interfaces.ObjectInterface;
import com.yutou.nas.mybatis.dao.VideoDataDao;
import com.yutou.nas.mybatis.dao.VideoInfoDao;
import com.yutou.nas.mybatis.dao.VideoSubtitlesDao;
import com.yutou.nas.mybatis.model.VideoData;
import com.yutou.nas.mybatis.model.VideoInfo;
import com.yutou.nas.mybatis.model.VideoInfoExample;
import com.yutou.nas.mybatis.model.VideoSubtitles;
import com.yutou.nas.utils.AppTools;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File;
import java.util.*;
@Service("VideoToolsService")
public class VideoToolsService implements IVideoToolsService {
@Resource
VideoInfoDao infoDao;
@Resource
VideoDataDao dataDao;
@Resource
VideoSubtitlesDao subtitlesDao;
@Override
public void scanVideo() {
scanVideoDir(new File("Z:\\download\\anim\\打了300年的史莱姆不知不觉就练到了满级"));
scanVideo(new File("Z:\\download\\anim\\打了300年的史莱姆不知不觉就练到了满级"));
List<VideoInfo> videoInfos = videoDirInfo(new File("Z:\\download\\anim\\打了300年的史莱姆不知不觉就练到了满级"));
for (VideoInfo videoInfo : videoInfos) {
System.out.println(videoInfo.getTitleCn());
}
System.out.println("输入新番信息:");
String name = "一弦定音!第二季";
for (VideoInfo videoInfo : videoInfos) {
if (videoInfo.getId() == 292969) {
VideoInfoExample example = new VideoInfoExample();
example.createCriteria().andTitleCnEqualTo("打了300年的史莱姆不知不觉就练到了满级");
VideoInfo info = infoDao.selectByExample(example).get(0);
videoInfo.setId(info.getId());
videoInfo.setPath(info.getPath());
infoDao.updateByPrimaryKey(videoInfo);
}
if (videoInfo.getId() == 270060) {
VideoInfoExample example = new VideoInfoExample();
example.createCriteria().andTitleCnEqualTo("s2");
VideoInfo info = infoDao.selectByExample(example).get(0);
videoInfo.setId(info.getId());
videoInfo.setPath(info.getPath());
infoDao.updateByPrimaryKey(videoInfo);
}
}
}
public void scanVideoDir(File dirPath) {
int dirCount = 0;
for (File file : dirPath.listFiles()) {
if (file.isDirectory()) {
VideoInfo info = new VideoInfo();
info.setTitleCn(file.getName());
info.setPath(file.getAbsolutePath());
infoDao.insert(info);
dirCount++;
}
}
if (dirCount != dirPath.listFiles().length) {
VideoInfo info = new VideoInfo();
info.setTitleCn(dirPath.getName());
info.setPath(dirPath.getAbsolutePath());
infoDao.insert(info);
}
}
public void scanVideo(File dir) {
for (File file : dir.listFiles()) {
if (file.isDirectory()) {
scanVideo(file);
} else {
if (file.getName().endsWith(".mp4")
|| file.getName().endsWith("mkv")
) {
VideoInfoExample example = new VideoInfoExample();
example.createCriteria().andPathEqualTo(dir.getAbsolutePath());
videoInfo(infoDao.selectByExample(example).get(0).getId(), file);
}
}
}
}
private void videoInfo(int vid, File file) {
AppTools.exec("ffmpeg -i \"" + file.getAbsolutePath() + "\"", new ObjectInterface() {
@Override
public void out(String data) {
super.out(data);
String[] ffmpegData = data.split("\n");
Map<String, String> map = new LinkedHashMap<>();
for (String ffmpegDatum : ffmpegData) {
if (ffmpegDatum.trim().startsWith("Stream #")) {
String[] metadata = ffmpegDatum.split(": ");
map.put(metadata[0].trim() + "_" + metadata[1], metadata[2]);
}
if (ffmpegDatum.trim().startsWith("Duration: ")) {
map.put("Duration", ffmpegDatum.replace("Duration: ", "").trim().split("\\,")[0]);
}
}
//System.out.println(data);
VideoData videoData = new VideoData();
videoData.setVid(vid);
videoData.setPath(file.getAbsolutePath());
videoData.setFiletitle(file.getName());
videoData.setIsplay(0);
videoData.setLastplaytime("00:00:00");
for (String key : map.keySet()) {
System.out.println("vid = " + vid + " file = " + file.getName() + " key = " + key + " value = " + map.get(key));
if (key.endsWith("Video")) {
videoData.setVideodata(map.get(key));
}
if (key.endsWith("Audio")) {
videoData.setSounddata(map.get(key));
}
if ("Duration".equals(key)) {
videoData.setVideotimer(map.get(key));
}
}
dataDao.insert(videoData);
for (String key : map.keySet()) {
if (key.endsWith("Subtitle")) {
String code = key.replace("Stream #", "").split("\\(")[0];
String title = key.replace("Stream #" + code, "")
.split("_Subtitle")[0]
.replace("(", "")
.replace(")", "");
new SubtitleTrack().outFFMpegSubtitle(videoData.getId(), code, title, file);
}
}
}
}, false, false);
}
public class SubtitleTrack {
private void outFFMpegSubtitle(int id, String code, String title, File file) {
if (new File(file.getAbsolutePath() + "." + title + ".srt").exists()) {
new File(file.getAbsolutePath() + "." + title + ".srt").deleteOnExit();
}
new Thread(new Runnable() {
@Override
public void run() {
String exec = "ffmpeg -i \"" + file.getAbsolutePath() + "\" -vn -an -map " + code + " \"" + file.getAbsolutePath() + "." + title + ".srt\"";
System.out.println("exec = " + exec);
AppTools.exec(exec + "\n", new ObjectInterface() {
@Override
public void out(String data) {
super.out(data);
System.out.println("保存字幕文件:" + title);
VideoSubtitles subtitles = new VideoSubtitles();
subtitles.setVid(id);
subtitles.setPath(file.getAbsolutePath() + "." + title + ".srt");
subtitles.setSubtitle(title);
subtitlesDao.insert(subtitles);
}
}, false, false);
}
}).start();
}
public void selectFile(int id,String code,File sub){
}
}
private List<VideoInfo> videoDirInfo(File file) {
List<VideoInfo> videoInfos = new ArrayList<>();
JSONObject main = BangumiTools.search(file.getName());
if (main.getInteger("results") > 0) {
List<JSONObject> list = main.getJSONArray("list").toJavaList(JSONObject.class);
Collections.reverse(list);
for (JSONObject item : list) {
VideoInfo info = new VideoInfo();
info.setId(item.getInteger("id"));
info.setTitleCn(item.getString("name_cn"));
info.setTitleJp(item.getString("name"));
info.setAirData(item.getString("air_date"));
info.setAirWeekday(item.getInteger("air_weekday") + "");
info.setBangumiRating(Double.valueOf(item.getJSONObject("rating").getFloat("score")));
info.setBangumiUrl(item.getString("url"));
info.setEpsCount(item.getInteger("eps") + "");
info.setEpsNow("0");
if (item.containsKey("crt")) {
info.setCrts(item.getJSONArray("crt").toJSONString());
}
if (item.containsKey("staff")) {
info.setStaffs(item.getJSONArray("staff").toJSONString());
}
info.setImage(item.getJSONObject("images").getString("large"));
info.setInfo(item.getString("summary"));
info.setPath(file.getAbsolutePath());
videoInfos.add(info);
}
}
return videoInfos;
}
public static void main(String[] args) {
// videoInfo(0,new File("Z:\\download\\anim\\小林家的龙女仆S\\[NC-Raws] 小林家的龙女仆S - 01 [B-Global][WEB-DL][2160p][AVC AAC][CHS_CHT_ENG_TH_SRT][MKV].mkv"));
//videoDirInfo(new File("Z:\\download\\anim\\小林家的龙女仆S\\"));
/* List<VideoInfo> list = videoDirInfo(new File("Z:\\download\\anim\\小林家的龙女仆S\\"));
for (VideoInfo videoInfo : list) {
System.out.println(videoInfo.getTitle());
}*/
}
}

View File

@ -0,0 +1,5 @@
package com.yutou.nas.interfaces;
public abstract class ObjectInterface {
public void out(String data){};
}

View File

@ -0,0 +1,33 @@
package com.yutou.nas.mybatis.dao;
import com.yutou.nas.mybatis.model.VideoData;
import com.yutou.nas.mybatis.model.VideoDataExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface VideoDataDao {
long countByExample(VideoDataExample example);
int deleteByExample(VideoDataExample example);
int deleteByPrimaryKey(Integer id);
int insert(VideoData record);
int insertSelective(VideoData record);
List<VideoData> selectByExample(VideoDataExample example);
VideoData selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") VideoData record, @Param("example") VideoDataExample example);
int updateByExample(@Param("record") VideoData record, @Param("example") VideoDataExample example);
int updateByPrimaryKeySelective(VideoData record);
int updateByPrimaryKey(VideoData record);
}

View File

@ -0,0 +1,32 @@
package com.yutou.nas.mybatis.dao;
import com.yutou.nas.mybatis.model.VideoInfo;
import com.yutou.nas.mybatis.model.VideoInfoExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface VideoInfoDao {
long countByExample(VideoInfoExample example);
int deleteByExample(VideoInfoExample example);
int deleteByPrimaryKey(Integer id);
int insert(VideoInfo record);
int insertSelective(VideoInfo record);
List<VideoInfo> selectByExample(VideoInfoExample example);
VideoInfo selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") VideoInfo record, @Param("example") VideoInfoExample example);
int updateByExample(@Param("record") VideoInfo record, @Param("example") VideoInfoExample example);
int updateByPrimaryKeySelective(VideoInfo record);
int updateByPrimaryKey(VideoInfo record);
}

View File

@ -0,0 +1,32 @@
package com.yutou.nas.mybatis.dao;
import com.yutou.nas.mybatis.model.VideoSubtitles;
import com.yutou.nas.mybatis.model.VideoSubtitlesExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface VideoSubtitlesDao {
long countByExample(VideoSubtitlesExample example);
int deleteByExample(VideoSubtitlesExample example);
int deleteByPrimaryKey(Integer id);
int insert(VideoSubtitles record);
int insertSelective(VideoSubtitles record);
List<VideoSubtitles> selectByExample(VideoSubtitlesExample example);
VideoSubtitles selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") VideoSubtitles record, @Param("example") VideoSubtitlesExample example);
int updateByExample(@Param("record") VideoSubtitles record, @Param("example") VideoSubtitlesExample example);
int updateByPrimaryKeySelective(VideoSubtitles record);
int updateByPrimaryKey(VideoSubtitles record);
}

View File

@ -0,0 +1,31 @@
package com.yutou.nas.mybatis.model;
import java.io.Serializable;
import lombok.Data;
/**
* video_data
* @author
*/
@Data
public class VideoData implements Serializable {
private Integer id;
private Integer vid;
private String filetitle;
private String path;
private String videotimer;
private String videodata;
private String sounddata;
private Integer isplay;
private String lastplaytime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,801 @@
package com.yutou.nas.mybatis.model;
import java.util.ArrayList;
import java.util.List;
public class VideoDataExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public VideoDataExample() {
oredCriteria = new ArrayList<>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andVidIsNull() {
addCriterion("vid is null");
return (Criteria) this;
}
public Criteria andVidIsNotNull() {
addCriterion("vid is not null");
return (Criteria) this;
}
public Criteria andVidEqualTo(Integer value) {
addCriterion("vid =", value, "vid");
return (Criteria) this;
}
public Criteria andVidNotEqualTo(Integer value) {
addCriterion("vid <>", value, "vid");
return (Criteria) this;
}
public Criteria andVidGreaterThan(Integer value) {
addCriterion("vid >", value, "vid");
return (Criteria) this;
}
public Criteria andVidGreaterThanOrEqualTo(Integer value) {
addCriterion("vid >=", value, "vid");
return (Criteria) this;
}
public Criteria andVidLessThan(Integer value) {
addCriterion("vid <", value, "vid");
return (Criteria) this;
}
public Criteria andVidLessThanOrEqualTo(Integer value) {
addCriterion("vid <=", value, "vid");
return (Criteria) this;
}
public Criteria andVidIn(List<Integer> values) {
addCriterion("vid in", values, "vid");
return (Criteria) this;
}
public Criteria andVidNotIn(List<Integer> values) {
addCriterion("vid not in", values, "vid");
return (Criteria) this;
}
public Criteria andVidBetween(Integer value1, Integer value2) {
addCriterion("vid between", value1, value2, "vid");
return (Criteria) this;
}
public Criteria andVidNotBetween(Integer value1, Integer value2) {
addCriterion("vid not between", value1, value2, "vid");
return (Criteria) this;
}
public Criteria andFiletitleIsNull() {
addCriterion("fileTitle is null");
return (Criteria) this;
}
public Criteria andFiletitleIsNotNull() {
addCriterion("fileTitle is not null");
return (Criteria) this;
}
public Criteria andFiletitleEqualTo(String value) {
addCriterion("fileTitle =", value, "filetitle");
return (Criteria) this;
}
public Criteria andFiletitleNotEqualTo(String value) {
addCriterion("fileTitle <>", value, "filetitle");
return (Criteria) this;
}
public Criteria andFiletitleGreaterThan(String value) {
addCriterion("fileTitle >", value, "filetitle");
return (Criteria) this;
}
public Criteria andFiletitleGreaterThanOrEqualTo(String value) {
addCriterion("fileTitle >=", value, "filetitle");
return (Criteria) this;
}
public Criteria andFiletitleLessThan(String value) {
addCriterion("fileTitle <", value, "filetitle");
return (Criteria) this;
}
public Criteria andFiletitleLessThanOrEqualTo(String value) {
addCriterion("fileTitle <=", value, "filetitle");
return (Criteria) this;
}
public Criteria andFiletitleLike(String value) {
addCriterion("fileTitle like", value, "filetitle");
return (Criteria) this;
}
public Criteria andFiletitleNotLike(String value) {
addCriterion("fileTitle not like", value, "filetitle");
return (Criteria) this;
}
public Criteria andFiletitleIn(List<String> values) {
addCriterion("fileTitle in", values, "filetitle");
return (Criteria) this;
}
public Criteria andFiletitleNotIn(List<String> values) {
addCriterion("fileTitle not in", values, "filetitle");
return (Criteria) this;
}
public Criteria andFiletitleBetween(String value1, String value2) {
addCriterion("fileTitle between", value1, value2, "filetitle");
return (Criteria) this;
}
public Criteria andFiletitleNotBetween(String value1, String value2) {
addCriterion("fileTitle not between", value1, value2, "filetitle");
return (Criteria) this;
}
public Criteria andPathIsNull() {
addCriterion("`path` is null");
return (Criteria) this;
}
public Criteria andPathIsNotNull() {
addCriterion("`path` is not null");
return (Criteria) this;
}
public Criteria andPathEqualTo(String value) {
addCriterion("`path` =", value, "path");
return (Criteria) this;
}
public Criteria andPathNotEqualTo(String value) {
addCriterion("`path` <>", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThan(String value) {
addCriterion("`path` >", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThanOrEqualTo(String value) {
addCriterion("`path` >=", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThan(String value) {
addCriterion("`path` <", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThanOrEqualTo(String value) {
addCriterion("`path` <=", value, "path");
return (Criteria) this;
}
public Criteria andPathLike(String value) {
addCriterion("`path` like", value, "path");
return (Criteria) this;
}
public Criteria andPathNotLike(String value) {
addCriterion("`path` not like", value, "path");
return (Criteria) this;
}
public Criteria andPathIn(List<String> values) {
addCriterion("`path` in", values, "path");
return (Criteria) this;
}
public Criteria andPathNotIn(List<String> values) {
addCriterion("`path` not in", values, "path");
return (Criteria) this;
}
public Criteria andPathBetween(String value1, String value2) {
addCriterion("`path` between", value1, value2, "path");
return (Criteria) this;
}
public Criteria andPathNotBetween(String value1, String value2) {
addCriterion("`path` not between", value1, value2, "path");
return (Criteria) this;
}
public Criteria andVideotimerIsNull() {
addCriterion("videoTimer is null");
return (Criteria) this;
}
public Criteria andVideotimerIsNotNull() {
addCriterion("videoTimer is not null");
return (Criteria) this;
}
public Criteria andVideotimerEqualTo(String value) {
addCriterion("videoTimer =", value, "videotimer");
return (Criteria) this;
}
public Criteria andVideotimerNotEqualTo(String value) {
addCriterion("videoTimer <>", value, "videotimer");
return (Criteria) this;
}
public Criteria andVideotimerGreaterThan(String value) {
addCriterion("videoTimer >", value, "videotimer");
return (Criteria) this;
}
public Criteria andVideotimerGreaterThanOrEqualTo(String value) {
addCriterion("videoTimer >=", value, "videotimer");
return (Criteria) this;
}
public Criteria andVideotimerLessThan(String value) {
addCriterion("videoTimer <", value, "videotimer");
return (Criteria) this;
}
public Criteria andVideotimerLessThanOrEqualTo(String value) {
addCriterion("videoTimer <=", value, "videotimer");
return (Criteria) this;
}
public Criteria andVideotimerLike(String value) {
addCriterion("videoTimer like", value, "videotimer");
return (Criteria) this;
}
public Criteria andVideotimerNotLike(String value) {
addCriterion("videoTimer not like", value, "videotimer");
return (Criteria) this;
}
public Criteria andVideotimerIn(List<String> values) {
addCriterion("videoTimer in", values, "videotimer");
return (Criteria) this;
}
public Criteria andVideotimerNotIn(List<String> values) {
addCriterion("videoTimer not in", values, "videotimer");
return (Criteria) this;
}
public Criteria andVideotimerBetween(String value1, String value2) {
addCriterion("videoTimer between", value1, value2, "videotimer");
return (Criteria) this;
}
public Criteria andVideotimerNotBetween(String value1, String value2) {
addCriterion("videoTimer not between", value1, value2, "videotimer");
return (Criteria) this;
}
public Criteria andVideodataIsNull() {
addCriterion("videoData is null");
return (Criteria) this;
}
public Criteria andVideodataIsNotNull() {
addCriterion("videoData is not null");
return (Criteria) this;
}
public Criteria andVideodataEqualTo(String value) {
addCriterion("videoData =", value, "videodata");
return (Criteria) this;
}
public Criteria andVideodataNotEqualTo(String value) {
addCriterion("videoData <>", value, "videodata");
return (Criteria) this;
}
public Criteria andVideodataGreaterThan(String value) {
addCriterion("videoData >", value, "videodata");
return (Criteria) this;
}
public Criteria andVideodataGreaterThanOrEqualTo(String value) {
addCriterion("videoData >=", value, "videodata");
return (Criteria) this;
}
public Criteria andVideodataLessThan(String value) {
addCriterion("videoData <", value, "videodata");
return (Criteria) this;
}
public Criteria andVideodataLessThanOrEqualTo(String value) {
addCriterion("videoData <=", value, "videodata");
return (Criteria) this;
}
public Criteria andVideodataLike(String value) {
addCriterion("videoData like", value, "videodata");
return (Criteria) this;
}
public Criteria andVideodataNotLike(String value) {
addCriterion("videoData not like", value, "videodata");
return (Criteria) this;
}
public Criteria andVideodataIn(List<String> values) {
addCriterion("videoData in", values, "videodata");
return (Criteria) this;
}
public Criteria andVideodataNotIn(List<String> values) {
addCriterion("videoData not in", values, "videodata");
return (Criteria) this;
}
public Criteria andVideodataBetween(String value1, String value2) {
addCriterion("videoData between", value1, value2, "videodata");
return (Criteria) this;
}
public Criteria andVideodataNotBetween(String value1, String value2) {
addCriterion("videoData not between", value1, value2, "videodata");
return (Criteria) this;
}
public Criteria andSounddataIsNull() {
addCriterion("soundData is null");
return (Criteria) this;
}
public Criteria andSounddataIsNotNull() {
addCriterion("soundData is not null");
return (Criteria) this;
}
public Criteria andSounddataEqualTo(String value) {
addCriterion("soundData =", value, "sounddata");
return (Criteria) this;
}
public Criteria andSounddataNotEqualTo(String value) {
addCriterion("soundData <>", value, "sounddata");
return (Criteria) this;
}
public Criteria andSounddataGreaterThan(String value) {
addCriterion("soundData >", value, "sounddata");
return (Criteria) this;
}
public Criteria andSounddataGreaterThanOrEqualTo(String value) {
addCriterion("soundData >=", value, "sounddata");
return (Criteria) this;
}
public Criteria andSounddataLessThan(String value) {
addCriterion("soundData <", value, "sounddata");
return (Criteria) this;
}
public Criteria andSounddataLessThanOrEqualTo(String value) {
addCriterion("soundData <=", value, "sounddata");
return (Criteria) this;
}
public Criteria andSounddataLike(String value) {
addCriterion("soundData like", value, "sounddata");
return (Criteria) this;
}
public Criteria andSounddataNotLike(String value) {
addCriterion("soundData not like", value, "sounddata");
return (Criteria) this;
}
public Criteria andSounddataIn(List<String> values) {
addCriterion("soundData in", values, "sounddata");
return (Criteria) this;
}
public Criteria andSounddataNotIn(List<String> values) {
addCriterion("soundData not in", values, "sounddata");
return (Criteria) this;
}
public Criteria andSounddataBetween(String value1, String value2) {
addCriterion("soundData between", value1, value2, "sounddata");
return (Criteria) this;
}
public Criteria andSounddataNotBetween(String value1, String value2) {
addCriterion("soundData not between", value1, value2, "sounddata");
return (Criteria) this;
}
public Criteria andIsplayIsNull() {
addCriterion("isPlay is null");
return (Criteria) this;
}
public Criteria andIsplayIsNotNull() {
addCriterion("isPlay is not null");
return (Criteria) this;
}
public Criteria andIsplayEqualTo(Integer value) {
addCriterion("isPlay =", value, "isplay");
return (Criteria) this;
}
public Criteria andIsplayNotEqualTo(Integer value) {
addCriterion("isPlay <>", value, "isplay");
return (Criteria) this;
}
public Criteria andIsplayGreaterThan(Integer value) {
addCriterion("isPlay >", value, "isplay");
return (Criteria) this;
}
public Criteria andIsplayGreaterThanOrEqualTo(Integer value) {
addCriterion("isPlay >=", value, "isplay");
return (Criteria) this;
}
public Criteria andIsplayLessThan(Integer value) {
addCriterion("isPlay <", value, "isplay");
return (Criteria) this;
}
public Criteria andIsplayLessThanOrEqualTo(Integer value) {
addCriterion("isPlay <=", value, "isplay");
return (Criteria) this;
}
public Criteria andIsplayIn(List<Integer> values) {
addCriterion("isPlay in", values, "isplay");
return (Criteria) this;
}
public Criteria andIsplayNotIn(List<Integer> values) {
addCriterion("isPlay not in", values, "isplay");
return (Criteria) this;
}
public Criteria andIsplayBetween(Integer value1, Integer value2) {
addCriterion("isPlay between", value1, value2, "isplay");
return (Criteria) this;
}
public Criteria andIsplayNotBetween(Integer value1, Integer value2) {
addCriterion("isPlay not between", value1, value2, "isplay");
return (Criteria) this;
}
public Criteria andLastplaytimeIsNull() {
addCriterion("lastPlayTime is null");
return (Criteria) this;
}
public Criteria andLastplaytimeIsNotNull() {
addCriterion("lastPlayTime is not null");
return (Criteria) this;
}
public Criteria andLastplaytimeEqualTo(String value) {
addCriterion("lastPlayTime =", value, "lastplaytime");
return (Criteria) this;
}
public Criteria andLastplaytimeNotEqualTo(String value) {
addCriterion("lastPlayTime <>", value, "lastplaytime");
return (Criteria) this;
}
public Criteria andLastplaytimeGreaterThan(String value) {
addCriterion("lastPlayTime >", value, "lastplaytime");
return (Criteria) this;
}
public Criteria andLastplaytimeGreaterThanOrEqualTo(String value) {
addCriterion("lastPlayTime >=", value, "lastplaytime");
return (Criteria) this;
}
public Criteria andLastplaytimeLessThan(String value) {
addCriterion("lastPlayTime <", value, "lastplaytime");
return (Criteria) this;
}
public Criteria andLastplaytimeLessThanOrEqualTo(String value) {
addCriterion("lastPlayTime <=", value, "lastplaytime");
return (Criteria) this;
}
public Criteria andLastplaytimeLike(String value) {
addCriterion("lastPlayTime like", value, "lastplaytime");
return (Criteria) this;
}
public Criteria andLastplaytimeNotLike(String value) {
addCriterion("lastPlayTime not like", value, "lastplaytime");
return (Criteria) this;
}
public Criteria andLastplaytimeIn(List<String> values) {
addCriterion("lastPlayTime in", values, "lastplaytime");
return (Criteria) this;
}
public Criteria andLastplaytimeNotIn(List<String> values) {
addCriterion("lastPlayTime not in", values, "lastplaytime");
return (Criteria) this;
}
public Criteria andLastplaytimeBetween(String value1, String value2) {
addCriterion("lastPlayTime between", value1, value2, "lastplaytime");
return (Criteria) this;
}
public Criteria andLastplaytimeNotBetween(String value1, String value2) {
addCriterion("lastPlayTime not between", value1, value2, "lastplaytime");
return (Criteria) this;
}
}
/**
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,41 @@
package com.yutou.nas.mybatis.model;
import java.io.Serializable;
import lombok.Data;
/**
* video_info
* @author
*/
@Data
public class VideoInfo implements Serializable {
private Integer id;
private String titleCn;
private String titleJp;
private String airData;
private String airWeekday;
private String bangumiUrl;
private Double bangumiRating;
private String epsCount;
private String epsNow;
private String crts;
private String staffs;
private String image;
private String info;
private String path;
private static final long serialVersionUID = 1L;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
package com.yutou.nas.mybatis.model;
import java.io.Serializable;
import lombok.Data;
/**
* video_subtitles
* @author
*/
@Data
public class VideoSubtitles implements Serializable {
private Integer id;
private Integer vid;
private String subtitle;
private String path;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,461 @@
package com.yutou.nas.mybatis.model;
import java.util.ArrayList;
import java.util.List;
public class VideoSubtitlesExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public VideoSubtitlesExample() {
oredCriteria = new ArrayList<>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andVidIsNull() {
addCriterion("vid is null");
return (Criteria) this;
}
public Criteria andVidIsNotNull() {
addCriterion("vid is not null");
return (Criteria) this;
}
public Criteria andVidEqualTo(Integer value) {
addCriterion("vid =", value, "vid");
return (Criteria) this;
}
public Criteria andVidNotEqualTo(Integer value) {
addCriterion("vid <>", value, "vid");
return (Criteria) this;
}
public Criteria andVidGreaterThan(Integer value) {
addCriterion("vid >", value, "vid");
return (Criteria) this;
}
public Criteria andVidGreaterThanOrEqualTo(Integer value) {
addCriterion("vid >=", value, "vid");
return (Criteria) this;
}
public Criteria andVidLessThan(Integer value) {
addCriterion("vid <", value, "vid");
return (Criteria) this;
}
public Criteria andVidLessThanOrEqualTo(Integer value) {
addCriterion("vid <=", value, "vid");
return (Criteria) this;
}
public Criteria andVidIn(List<Integer> values) {
addCriterion("vid in", values, "vid");
return (Criteria) this;
}
public Criteria andVidNotIn(List<Integer> values) {
addCriterion("vid not in", values, "vid");
return (Criteria) this;
}
public Criteria andVidBetween(Integer value1, Integer value2) {
addCriterion("vid between", value1, value2, "vid");
return (Criteria) this;
}
public Criteria andVidNotBetween(Integer value1, Integer value2) {
addCriterion("vid not between", value1, value2, "vid");
return (Criteria) this;
}
public Criteria andSubtitleIsNull() {
addCriterion("subTitle is null");
return (Criteria) this;
}
public Criteria andSubtitleIsNotNull() {
addCriterion("subTitle is not null");
return (Criteria) this;
}
public Criteria andSubtitleEqualTo(String value) {
addCriterion("subTitle =", value, "subtitle");
return (Criteria) this;
}
public Criteria andSubtitleNotEqualTo(String value) {
addCriterion("subTitle <>", value, "subtitle");
return (Criteria) this;
}
public Criteria andSubtitleGreaterThan(String value) {
addCriterion("subTitle >", value, "subtitle");
return (Criteria) this;
}
public Criteria andSubtitleGreaterThanOrEqualTo(String value) {
addCriterion("subTitle >=", value, "subtitle");
return (Criteria) this;
}
public Criteria andSubtitleLessThan(String value) {
addCriterion("subTitle <", value, "subtitle");
return (Criteria) this;
}
public Criteria andSubtitleLessThanOrEqualTo(String value) {
addCriterion("subTitle <=", value, "subtitle");
return (Criteria) this;
}
public Criteria andSubtitleLike(String value) {
addCriterion("subTitle like", value, "subtitle");
return (Criteria) this;
}
public Criteria andSubtitleNotLike(String value) {
addCriterion("subTitle not like", value, "subtitle");
return (Criteria) this;
}
public Criteria andSubtitleIn(List<String> values) {
addCriterion("subTitle in", values, "subtitle");
return (Criteria) this;
}
public Criteria andSubtitleNotIn(List<String> values) {
addCriterion("subTitle not in", values, "subtitle");
return (Criteria) this;
}
public Criteria andSubtitleBetween(String value1, String value2) {
addCriterion("subTitle between", value1, value2, "subtitle");
return (Criteria) this;
}
public Criteria andSubtitleNotBetween(String value1, String value2) {
addCriterion("subTitle not between", value1, value2, "subtitle");
return (Criteria) this;
}
public Criteria andPathIsNull() {
addCriterion("`path` is null");
return (Criteria) this;
}
public Criteria andPathIsNotNull() {
addCriterion("`path` is not null");
return (Criteria) this;
}
public Criteria andPathEqualTo(String value) {
addCriterion("`path` =", value, "path");
return (Criteria) this;
}
public Criteria andPathNotEqualTo(String value) {
addCriterion("`path` <>", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThan(String value) {
addCriterion("`path` >", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThanOrEqualTo(String value) {
addCriterion("`path` >=", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThan(String value) {
addCriterion("`path` <", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThanOrEqualTo(String value) {
addCriterion("`path` <=", value, "path");
return (Criteria) this;
}
public Criteria andPathLike(String value) {
addCriterion("`path` like", value, "path");
return (Criteria) this;
}
public Criteria andPathNotLike(String value) {
addCriterion("`path` not like", value, "path");
return (Criteria) this;
}
public Criteria andPathIn(List<String> values) {
addCriterion("`path` in", values, "path");
return (Criteria) this;
}
public Criteria andPathNotIn(List<String> values) {
addCriterion("`path` not in", values, "path");
return (Criteria) this;
}
public Criteria andPathBetween(String value1, String value2) {
addCriterion("`path` between", value1, value2, "path");
return (Criteria) this;
}
public Criteria andPathNotBetween(String value1, String value2) {
addCriterion("`path` not between", value1, value2, "path");
return (Criteria) this;
}
}
/**
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -3,6 +3,7 @@ package com.yutou.nas.other;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yutou.nas.NasApplication; import com.yutou.nas.NasApplication;
import com.yutou.nas.Services.IVideoToolsService;
import com.yutou.nas.utils.AppTools; import com.yutou.nas.utils.AppTools;
import com.yutou.nas.utils.DepotManager; import com.yutou.nas.utils.DepotManager;
import com.yutou.nas.utils.RedisTools; import com.yutou.nas.utils.RedisTools;
@ -19,6 +20,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -135,15 +137,18 @@ public class tools {
DepotManager.scan(); DepotManager.scan();
return "ok"; return "ok";
} }
@Resource
IVideoToolsService videoToolsService;
@ResponseBody @ResponseBody
@RequestMapping("/public/test.do") @RequestMapping("/public/test.do")
public String test(){ public String test(){
List<Class> list= AppTools.scanClass("com.yutou.nas",Controller.class); /* List<Class> list= AppTools.scanClass("com.yutou.nas",Controller.class);
System.out.println("list size = "+list.size()); System.out.println("list size = "+list.size());
for (Class aClass : list) { for (Class aClass : list) {
System.out.println(aClass.getName()); System.out.println(aClass.getName());
System.out.println(aClass.getAnnotation(RequestMapping.class)); System.out.println(aClass.getAnnotation(RequestMapping.class));
} }*/
videoToolsService.scanVideo();
return "ok"; return "ok";
} }

View File

@ -1,5 +1,6 @@
package com.yutou.nas.utils; package com.yutou.nas.utils;
import com.yutou.nas.interfaces.ObjectInterface;
import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.annotation.AnnotationUtils;
@ -20,7 +21,7 @@ public class AppTools {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
} }
public static void exec(String exec) { public static void exec(String exec, ObjectInterface objectInterface, boolean isOutQQBot, boolean isInput) {
try { try {
Process process; Process process;
if (AppTools.isRuntimeSystemOfWindow()) { if (AppTools.isRuntimeSystemOfWindow()) {
@ -38,10 +39,15 @@ public class AppTools {
} }
); );
} }
processOut(process.getInputStream()); if (isInput) {
processOut(process.getErrorStream()); processOut(process.getInputStream(), objectInterface, isOutQQBot);
processOut(process.getErrorStream());
} else {
processOut(process.getErrorStream(), objectInterface, isOutQQBot);
processOut(process.getInputStream());
}
process.destroy(); process.destroy();
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -82,17 +88,17 @@ public class AppTools {
return classList; return classList;
} }
public static List<String> getUrls(String packageName,String className){ public static List<String> getUrls(String packageName, String className) {
List<Class> list= AppTools.scanClass(packageName, Controller.class); List<Class> list = AppTools.scanClass(packageName, Controller.class);
List<String> urls=new ArrayList<>(); List<String> urls = new ArrayList<>();
for (Class aClass : list) { for (Class aClass : list) {
if(className!=null&&!aClass.getSimpleName().equals(className)){ if (className != null && !aClass.getSimpleName().equals(className)) {
continue; continue;
} }
Method[] methods= aClass.getDeclaredMethods(); Method[] methods = aClass.getDeclaredMethods();
for (Method method : methods) { for (Method method : methods) {
RequestMapping ls=method.getAnnotation(RequestMapping.class); RequestMapping ls = method.getAnnotation(RequestMapping.class);
if(ls!=null) { if (ls != null) {
urls.add(ls.value()[0]); urls.add(ls.value()[0]);
} }
} }

View File

@ -5,18 +5,32 @@ import com.yutou.nas.interfaces.DownloadInterface;
import com.yutou.nas.utils.Interfaces.NetworkInterface; import com.yutou.nas.utils.Interfaces.NetworkInterface;
import com.yutou.nas.utils.StringUtils; import com.yutou.nas.utils.StringUtils;
import javax.net.ssl.HttpsURLConnection;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Set; import java.util.Set;
public class HttpTools { public class HttpTools {
public static final String serverKey="zIrsh9TUZP2lfRW753PannG49E7VJvor"; public static final String serverKey="zIrsh9TUZP2lfRW753PannG49E7VJvor";
public static String get(String url) { private static final int HttpRequestIndex=3;
public static String get(String url){
return new HttpTools().http_get(url,0);
}
public static void post(final String url, final byte[] body, final NetworkInterface networkInterface){
new HttpTools().http_post(url, body,0, networkInterface);
}
public static File syncDownload(final String url, final String saveName){
return new HttpTools().http_syncDownload(url, saveName);
}
public String http_get(String url,int index) {
try { try {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); HttpsURLConnection connection = (HttpsURLConnection) new URL(url).openConnection();
connection.setRequestProperty("User-Agent", getExtUa()); connection.setRequestProperty("User-Agent", getExtUa());
connection.connect();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
String tmp; String tmp;
@ -27,12 +41,16 @@ public class HttpTools {
connection.disconnect(); connection.disconnect();
return str.toString(); return str.toString();
} catch (Exception e) { } catch (Exception e) {
if(index<HttpRequestIndex){
return http_get(url,++index);
}
System.err.println("error url = "+url);
e.printStackTrace(); e.printStackTrace();
} }
return null; return null;
} }
public static void post(final String url, final byte[] body, final NetworkInterface networkInterface) { public void http_post(final String url, final byte[] body,final int index, final NetworkInterface networkInterface) {
new Thread(new Runnable() { new Thread(new Runnable() {
@ -74,7 +92,11 @@ public class HttpTools {
connection.disconnect(); connection.disconnect();
reader.close(); reader.close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); if(index<HttpRequestIndex){
http_post(url, body, index+1, networkInterface);
}else {
e.printStackTrace();
}
} }
} }
}).start(); }).start();
@ -189,7 +211,7 @@ public class HttpTools {
}).start(); }).start();
} }
public synchronized static File syncDownload(final String url, final String saveName) { public synchronized File http_syncDownload(final String url, final String saveName) {
if(StringUtils.isEmpty(url)){ if(StringUtils.isEmpty(url)){
return null; return null;
} }

View File

@ -265,7 +265,7 @@ public class QQBotManager {
case QQCommands.QQ_SYSTEM_RESTART: case QQCommands.QQ_SYSTEM_RESTART:
getInstance().sendMessage("正在重启服务"); getInstance().sendMessage("正在重启服务");
System.out.println("结束进程"); System.out.println("结束进程");
AppTools.exec("cd /media/yutou/4t/public/servier/tools && ./start.sh"); AppTools.exec("cd /media/yutou/4t/public/servier/tools && ./start.sh",null,true,false);
break; break;
case QQCommands.QQ_HELP: case QQCommands.QQ_HELP:
builder = new StringBuilder(); builder = new StringBuilder();

View File

@ -1,6 +1,8 @@
package com.yutou.nas.utils; package com.yutou.nas.utils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yutou.nas.interfaces.DownloadInterface;
import com.yutou.nas.interfaces.ObjectInterface;
import redis.clients.jedis.Jedis; import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig; import redis.clients.jedis.JedisPoolConfig;
@ -276,9 +278,11 @@ public class RedisTools {
} }
} }
public static void processOut(InputStream inputStream) { public static void processOut(InputStream inputStream) {
processOut(inputStream,null,true);
}
public static void processOut(InputStream inputStream, ObjectInterface objectInterface, boolean isOutQQBot){
String tmp; String tmp;
StringBuilder str = new StringBuilder("null"); StringBuilder str = new StringBuilder();
try { try {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
while ((tmp = reader.readLine()) != null) { while ((tmp = reader.readLine()) != null) {
@ -289,8 +293,13 @@ public class RedisTools {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
com.yutou.nas.utils.Log.i("cmd > " + str); if(objectInterface!=null){
QQBotManager.getInstance().sendMessage(str.toString()); objectInterface.out(str.toString());
}
// com.yutou.nas.utils.Log.i("cmd > " + str);
if(isOutQQBot) {
QQBotManager.getInstance().sendMessage(str.toString());
}
} }
public static void main(String[] args) { public static void main(String[] args) {
RedisTools.pullMsg("msg", "abc"); RedisTools.pullMsg("msg", "abc");

View File

@ -0,0 +1,268 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yutou.nas.mybatis.dao.VideoDataDao">
<resultMap id="BaseResultMap" type="com.yutou.nas.mybatis.model.VideoData">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="vid" jdbcType="INTEGER" property="vid" />
<result column="fileTitle" jdbcType="VARCHAR" property="filetitle" />
<result column="path" jdbcType="VARCHAR" property="path" />
<result column="videoTimer" jdbcType="VARCHAR" property="videotimer" />
<result column="videoData" jdbcType="VARCHAR" property="videodata" />
<result column="soundData" jdbcType="VARCHAR" property="sounddata" />
<result column="isPlay" jdbcType="INTEGER" property="isplay" />
<result column="lastPlayTime" jdbcType="VARCHAR" property="lastplaytime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, vid, fileTitle, `path`, videoTimer, videoData, soundData, isPlay, lastPlayTime
</sql>
<select id="selectByExample" parameterType="com.yutou.nas.mybatis.model.VideoDataExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from video_data
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from video_data
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from video_data
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.yutou.nas.mybatis.model.VideoDataExample">
delete from video_data
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yutou.nas.mybatis.model.VideoData" useGeneratedKeys="true">
insert into video_data (vid, fileTitle, `path`,
videoTimer, videoData, soundData,
isPlay, lastPlayTime)
values (#{vid,jdbcType=INTEGER}, #{filetitle,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR},
#{videotimer,jdbcType=VARCHAR}, #{videodata,jdbcType=VARCHAR}, #{sounddata,jdbcType=VARCHAR},
#{isplay,jdbcType=INTEGER}, #{lastplaytime,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yutou.nas.mybatis.model.VideoData" useGeneratedKeys="true">
insert into video_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="vid != null">
vid,
</if>
<if test="filetitle != null">
fileTitle,
</if>
<if test="path != null">
`path`,
</if>
<if test="videotimer != null">
videoTimer,
</if>
<if test="videodata != null">
videoData,
</if>
<if test="sounddata != null">
soundData,
</if>
<if test="isplay != null">
isPlay,
</if>
<if test="lastplaytime != null">
lastPlayTime,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="vid != null">
#{vid,jdbcType=INTEGER},
</if>
<if test="filetitle != null">
#{filetitle,jdbcType=VARCHAR},
</if>
<if test="path != null">
#{path,jdbcType=VARCHAR},
</if>
<if test="videotimer != null">
#{videotimer,jdbcType=VARCHAR},
</if>
<if test="videodata != null">
#{videodata,jdbcType=VARCHAR},
</if>
<if test="sounddata != null">
#{sounddata,jdbcType=VARCHAR},
</if>
<if test="isplay != null">
#{isplay,jdbcType=INTEGER},
</if>
<if test="lastplaytime != null">
#{lastplaytime,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.yutou.nas.mybatis.model.VideoDataExample" resultType="java.lang.Long">
select count(*) from video_data
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update video_data
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.vid != null">
vid = #{record.vid,jdbcType=INTEGER},
</if>
<if test="record.filetitle != null">
fileTitle = #{record.filetitle,jdbcType=VARCHAR},
</if>
<if test="record.path != null">
`path` = #{record.path,jdbcType=VARCHAR},
</if>
<if test="record.videotimer != null">
videoTimer = #{record.videotimer,jdbcType=VARCHAR},
</if>
<if test="record.videodata != null">
videoData = #{record.videodata,jdbcType=VARCHAR},
</if>
<if test="record.sounddata != null">
soundData = #{record.sounddata,jdbcType=VARCHAR},
</if>
<if test="record.isplay != null">
isPlay = #{record.isplay,jdbcType=INTEGER},
</if>
<if test="record.lastplaytime != null">
lastPlayTime = #{record.lastplaytime,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update video_data
set id = #{record.id,jdbcType=INTEGER},
vid = #{record.vid,jdbcType=INTEGER},
fileTitle = #{record.filetitle,jdbcType=VARCHAR},
`path` = #{record.path,jdbcType=VARCHAR},
videoTimer = #{record.videotimer,jdbcType=VARCHAR},
videoData = #{record.videodata,jdbcType=VARCHAR},
soundData = #{record.sounddata,jdbcType=VARCHAR},
isPlay = #{record.isplay,jdbcType=INTEGER},
lastPlayTime = #{record.lastplaytime,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.yutou.nas.mybatis.model.VideoData">
update video_data
<set>
<if test="vid != null">
vid = #{vid,jdbcType=INTEGER},
</if>
<if test="filetitle != null">
fileTitle = #{filetitle,jdbcType=VARCHAR},
</if>
<if test="path != null">
`path` = #{path,jdbcType=VARCHAR},
</if>
<if test="videotimer != null">
videoTimer = #{videotimer,jdbcType=VARCHAR},
</if>
<if test="videodata != null">
videoData = #{videodata,jdbcType=VARCHAR},
</if>
<if test="sounddata != null">
soundData = #{sounddata,jdbcType=VARCHAR},
</if>
<if test="isplay != null">
isPlay = #{isplay,jdbcType=INTEGER},
</if>
<if test="lastplaytime != null">
lastPlayTime = #{lastplaytime,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yutou.nas.mybatis.model.VideoData">
update video_data
set vid = #{vid,jdbcType=INTEGER},
fileTitle = #{filetitle,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR},
videoTimer = #{videotimer,jdbcType=VARCHAR},
videoData = #{videodata,jdbcType=VARCHAR},
soundData = #{sounddata,jdbcType=VARCHAR},
isPlay = #{isplay,jdbcType=INTEGER},
lastPlayTime = #{lastplaytime,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,347 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yutou.nas.mybatis.dao.VideoInfoDao">
<resultMap id="BaseResultMap" type="com.yutou.nas.mybatis.model.VideoInfo">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="title_cn" jdbcType="VARCHAR" property="titleCn" />
<result column="title_jp" jdbcType="VARCHAR" property="titleJp" />
<result column="air_data" jdbcType="VARCHAR" property="airData" />
<result column="air_weekday" jdbcType="VARCHAR" property="airWeekday" />
<result column="bangumi_url" jdbcType="VARCHAR" property="bangumiUrl" />
<result column="bangumi_rating" jdbcType="FLOAT" property="bangumiRating" />
<result column="eps_count" jdbcType="VARCHAR" property="epsCount" />
<result column="eps_now" jdbcType="VARCHAR" property="epsNow" />
<result column="crts" jdbcType="VARCHAR" property="crts" />
<result column="staffs" jdbcType="VARCHAR" property="staffs" />
<result column="image" jdbcType="VARCHAR" property="image" />
<result column="info" jdbcType="VARCHAR" property="info" />
<result column="path" jdbcType="VARCHAR" property="path" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, title_cn, title_jp, air_data, air_weekday, bangumi_url, bangumi_rating, eps_count,
eps_now, crts, staffs, image, info, `path`
</sql>
<select id="selectByExample" parameterType="com.yutou.nas.mybatis.model.VideoInfoExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from video_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from video_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from video_info
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.yutou.nas.mybatis.model.VideoInfoExample">
delete from video_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yutou.nas.mybatis.model.VideoInfo" useGeneratedKeys="true">
insert into video_info (title_cn, title_jp, air_data,
air_weekday, bangumi_url, bangumi_rating,
eps_count, eps_now, crts,
staffs, image, info,
`path`)
values (#{titleCn,jdbcType=VARCHAR}, #{titleJp,jdbcType=VARCHAR}, #{airData,jdbcType=VARCHAR},
#{airWeekday,jdbcType=VARCHAR}, #{bangumiUrl,jdbcType=VARCHAR}, #{bangumiRating,jdbcType=FLOAT},
#{epsCount,jdbcType=VARCHAR}, #{epsNow,jdbcType=VARCHAR}, #{crts,jdbcType=VARCHAR},
#{staffs,jdbcType=VARCHAR}, #{image,jdbcType=VARCHAR}, #{info,jdbcType=VARCHAR},
#{path,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yutou.nas.mybatis.model.VideoInfo" useGeneratedKeys="true">
insert into video_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="titleCn != null">
title_cn,
</if>
<if test="titleJp != null">
title_jp,
</if>
<if test="airData != null">
air_data,
</if>
<if test="airWeekday != null">
air_weekday,
</if>
<if test="bangumiUrl != null">
bangumi_url,
</if>
<if test="bangumiRating != null">
bangumi_rating,
</if>
<if test="epsCount != null">
eps_count,
</if>
<if test="epsNow != null">
eps_now,
</if>
<if test="crts != null">
crts,
</if>
<if test="staffs != null">
staffs,
</if>
<if test="image != null">
image,
</if>
<if test="info != null">
info,
</if>
<if test="path != null">
`path`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="titleCn != null">
#{titleCn,jdbcType=VARCHAR},
</if>
<if test="titleJp != null">
#{titleJp,jdbcType=VARCHAR},
</if>
<if test="airData != null">
#{airData,jdbcType=VARCHAR},
</if>
<if test="airWeekday != null">
#{airWeekday,jdbcType=VARCHAR},
</if>
<if test="bangumiUrl != null">
#{bangumiUrl,jdbcType=VARCHAR},
</if>
<if test="bangumiRating != null">
#{bangumiRating,jdbcType=FLOAT},
</if>
<if test="epsCount != null">
#{epsCount,jdbcType=VARCHAR},
</if>
<if test="epsNow != null">
#{epsNow,jdbcType=VARCHAR},
</if>
<if test="crts != null">
#{crts,jdbcType=VARCHAR},
</if>
<if test="staffs != null">
#{staffs,jdbcType=VARCHAR},
</if>
<if test="image != null">
#{image,jdbcType=VARCHAR},
</if>
<if test="info != null">
#{info,jdbcType=VARCHAR},
</if>
<if test="path != null">
#{path,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.yutou.nas.mybatis.model.VideoInfoExample" resultType="java.lang.Long">
select count(*) from video_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update video_info
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.titleCn != null">
title_cn = #{record.titleCn,jdbcType=VARCHAR},
</if>
<if test="record.titleJp != null">
title_jp = #{record.titleJp,jdbcType=VARCHAR},
</if>
<if test="record.airData != null">
air_data = #{record.airData,jdbcType=VARCHAR},
</if>
<if test="record.airWeekday != null">
air_weekday = #{record.airWeekday,jdbcType=VARCHAR},
</if>
<if test="record.bangumiUrl != null">
bangumi_url = #{record.bangumiUrl,jdbcType=VARCHAR},
</if>
<if test="record.bangumiRating != null">
bangumi_rating = #{record.bangumiRating,jdbcType=FLOAT},
</if>
<if test="record.epsCount != null">
eps_count = #{record.epsCount,jdbcType=VARCHAR},
</if>
<if test="record.epsNow != null">
eps_now = #{record.epsNow,jdbcType=VARCHAR},
</if>
<if test="record.crts != null">
crts = #{record.crts,jdbcType=VARCHAR},
</if>
<if test="record.staffs != null">
staffs = #{record.staffs,jdbcType=VARCHAR},
</if>
<if test="record.image != null">
image = #{record.image,jdbcType=VARCHAR},
</if>
<if test="record.info != null">
info = #{record.info,jdbcType=VARCHAR},
</if>
<if test="record.path != null">
`path` = #{record.path,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update video_info
set id = #{record.id,jdbcType=INTEGER},
title_cn = #{record.titleCn,jdbcType=VARCHAR},
title_jp = #{record.titleJp,jdbcType=VARCHAR},
air_data = #{record.airData,jdbcType=VARCHAR},
air_weekday = #{record.airWeekday,jdbcType=VARCHAR},
bangumi_url = #{record.bangumiUrl,jdbcType=VARCHAR},
bangumi_rating = #{record.bangumiRating,jdbcType=FLOAT},
eps_count = #{record.epsCount,jdbcType=VARCHAR},
eps_now = #{record.epsNow,jdbcType=VARCHAR},
crts = #{record.crts,jdbcType=VARCHAR},
staffs = #{record.staffs,jdbcType=VARCHAR},
image = #{record.image,jdbcType=VARCHAR},
info = #{record.info,jdbcType=VARCHAR},
`path` = #{record.path,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.yutou.nas.mybatis.model.VideoInfo">
update video_info
<set>
<if test="titleCn != null">
title_cn = #{titleCn,jdbcType=VARCHAR},
</if>
<if test="titleJp != null">
title_jp = #{titleJp,jdbcType=VARCHAR},
</if>
<if test="airData != null">
air_data = #{airData,jdbcType=VARCHAR},
</if>
<if test="airWeekday != null">
air_weekday = #{airWeekday,jdbcType=VARCHAR},
</if>
<if test="bangumiUrl != null">
bangumi_url = #{bangumiUrl,jdbcType=VARCHAR},
</if>
<if test="bangumiRating != null">
bangumi_rating = #{bangumiRating,jdbcType=FLOAT},
</if>
<if test="epsCount != null">
eps_count = #{epsCount,jdbcType=VARCHAR},
</if>
<if test="epsNow != null">
eps_now = #{epsNow,jdbcType=VARCHAR},
</if>
<if test="crts != null">
crts = #{crts,jdbcType=VARCHAR},
</if>
<if test="staffs != null">
staffs = #{staffs,jdbcType=VARCHAR},
</if>
<if test="image != null">
image = #{image,jdbcType=VARCHAR},
</if>
<if test="info != null">
info = #{info,jdbcType=VARCHAR},
</if>
<if test="path != null">
`path` = #{path,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yutou.nas.mybatis.model.VideoInfo">
update video_info
set title_cn = #{titleCn,jdbcType=VARCHAR},
title_jp = #{titleJp,jdbcType=VARCHAR},
air_data = #{airData,jdbcType=VARCHAR},
air_weekday = #{airWeekday,jdbcType=VARCHAR},
bangumi_url = #{bangumiUrl,jdbcType=VARCHAR},
bangumi_rating = #{bangumiRating,jdbcType=FLOAT},
eps_count = #{epsCount,jdbcType=VARCHAR},
eps_now = #{epsNow,jdbcType=VARCHAR},
crts = #{crts,jdbcType=VARCHAR},
staffs = #{staffs,jdbcType=VARCHAR},
image = #{image,jdbcType=VARCHAR},
info = #{info,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,190 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yutou.nas.mybatis.dao.VideoSubtitlesDao">
<resultMap id="BaseResultMap" type="com.yutou.nas.mybatis.model.VideoSubtitles">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="vid" jdbcType="INTEGER" property="vid" />
<result column="subTitle" jdbcType="VARCHAR" property="subtitle" />
<result column="path" jdbcType="VARCHAR" property="path" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, vid, subTitle, `path`
</sql>
<select id="selectByExample" parameterType="com.yutou.nas.mybatis.model.VideoSubtitlesExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from video_subtitles
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from video_subtitles
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from video_subtitles
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.yutou.nas.mybatis.model.VideoSubtitlesExample">
delete from video_subtitles
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yutou.nas.mybatis.model.VideoSubtitles" useGeneratedKeys="true">
insert into video_subtitles (vid, subTitle, `path`
)
values (#{vid,jdbcType=INTEGER}, #{subtitle,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yutou.nas.mybatis.model.VideoSubtitles" useGeneratedKeys="true">
insert into video_subtitles
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="vid != null">
vid,
</if>
<if test="subtitle != null">
subTitle,
</if>
<if test="path != null">
`path`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="vid != null">
#{vid,jdbcType=INTEGER},
</if>
<if test="subtitle != null">
#{subtitle,jdbcType=VARCHAR},
</if>
<if test="path != null">
#{path,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.yutou.nas.mybatis.model.VideoSubtitlesExample" resultType="java.lang.Long">
select count(*) from video_subtitles
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update video_subtitles
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.vid != null">
vid = #{record.vid,jdbcType=INTEGER},
</if>
<if test="record.subtitle != null">
subTitle = #{record.subtitle,jdbcType=VARCHAR},
</if>
<if test="record.path != null">
`path` = #{record.path,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update video_subtitles
set id = #{record.id,jdbcType=INTEGER},
vid = #{record.vid,jdbcType=INTEGER},
subTitle = #{record.subtitle,jdbcType=VARCHAR},
`path` = #{record.path,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.yutou.nas.mybatis.model.VideoSubtitles">
update video_subtitles
<set>
<if test="vid != null">
vid = #{vid,jdbcType=INTEGER},
</if>
<if test="subtitle != null">
subTitle = #{subtitle,jdbcType=VARCHAR},
</if>
<if test="path != null">
`path` = #{path,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yutou.nas.mybatis.model.VideoSubtitles">
update video_subtitles
set vid = #{vid,jdbcType=INTEGER},
subTitle = #{subtitle,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -1,13 +1,24 @@
package com.yutou.nas; package com.yutou.nas;
import com.yutou.nas.Services.IVideoToolsService;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import javax.annotation.Resource;
import java.io.File;
@SpringBootTest @SpringBootTest
class NasApplicationTests { class NasApplicationTests {
@Resource
IVideoToolsService toolsService;
@Test @Test
void contextLoads() { void contextLoads() {
} }
@Test
void testOutSub(){
toolsService.scanVideo();
// toolsService.outSubtitle(0,"0:2",new File("Z:\\download\\anim\\小林家的龙女仆S\\[NC-Raws] 小林家的龙女仆S - 01 [B-Global][WEB-DL][2160p][AVC AAC][CHS_CHT_ENG_TH_SRT][MKV].mkv"));
}
} }