|
@@ -7,8 +7,10 @@ import cn.reghao.jutil.media.model.MediaProps;
|
|
|
import cn.reghao.jutil.media.model.VideoProps;
|
|
import cn.reghao.jutil.media.model.VideoProps;
|
|
|
import cn.reghao.jutil.jdk.security.DigestUtil;
|
|
import cn.reghao.jutil.jdk.security.DigestUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.commons.io.FileUtils;
|
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.nio.file.FileVisitResult;
|
|
import java.nio.file.FileVisitResult;
|
|
|
import java.nio.file.FileVisitor;
|
|
import java.nio.file.FileVisitor;
|
|
@@ -36,8 +38,7 @@ public class FileTest {
|
|
|
@Override
|
|
@Override
|
|
|
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
|
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
|
|
String absolutePath = file.toString();
|
|
String absolutePath = file.toString();
|
|
|
- //process(absolutePath);
|
|
|
|
|
- unique(absolutePath);
|
|
|
|
|
|
|
+ process(absolutePath);
|
|
|
return FileVisitResult.CONTINUE;
|
|
return FileVisitResult.CONTINUE;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -54,6 +55,13 @@ public class FileTest {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void process(String absolutePath) {
|
|
private void process(String absolutePath) {
|
|
|
|
|
+ String mediaType = FileType.getMediaType(absolutePath);
|
|
|
|
|
+ if (mediaType.startsWith("text")) {
|
|
|
|
|
+ FileUtils.deleteQuietly(new File(absolutePath));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void getMediaInfo(String absolutePath) {
|
|
|
MediaProps mediaProps = FFmpegWrapper.getMediaProps(absolutePath);
|
|
MediaProps mediaProps = FFmpegWrapper.getMediaProps(absolutePath);
|
|
|
if (mediaProps == null) {
|
|
if (mediaProps == null) {
|
|
|
log.error("{} 没有媒体信息", absolutePath);
|
|
log.error("{} 没有媒体信息", absolutePath);
|
|
@@ -102,15 +110,14 @@ public class FileTest {
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
public void test22() throws IOException {
|
|
public void test22() throws IOException {
|
|
|
- //String baseDir = "/home/reghao/mnt/porn/1.待发布/13996.反差婊系列/p/";
|
|
|
|
|
- //Path path = Path.of(baseDir);
|
|
|
|
|
- //walkDir(path);
|
|
|
|
|
|
|
+ String baseDir = "/home/reghao/Downloads/b/";
|
|
|
|
|
+ Path path = Path.of(baseDir);
|
|
|
|
|
+ walkDir(path);
|
|
|
|
|
|
|
|
- String filePath = "/home/reghao/Downloads/仁和区 2.m4a";
|
|
|
|
|
|
|
+ /*String filePath = "/home/reghao/Downloads/仁和区 2.m4a";
|
|
|
filePath = "/home/reghao/Downloads/三生三世.wav";
|
|
filePath = "/home/reghao/Downloads/三生三世.wav";
|
|
|
String mediaType = FileType.getMediaType(filePath);
|
|
String mediaType = FileType.getMediaType(filePath);
|
|
|
MediaProps mediaProps = FFmpegWrapper.getMediaProps(filePath);
|
|
MediaProps mediaProps = FFmpegWrapper.getMediaProps(filePath);
|
|
|
- //FFmpegWrapper.convertAudio(filePath, "/home/reghao/Downloads/三生三世.m4a");
|
|
|
|
|
- System.out.println();
|
|
|
|
|
|
|
+ FFmpegWrapper.convertAudio(filePath, "/home/reghao/Downloads/三生三世.m4a");*/
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|