diff --git a/InnoSetupConfig.iss b/InnoSetupConfig.iss index 30aa856..8640acc 100644 --- a/InnoSetupConfig.iss +++ b/InnoSetupConfig.iss @@ -2,7 +2,7 @@ ; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档! #define MyAppName "FirstKeyFrameFilter" -#define MyAppVersion "1.0.1-20.10.4" +#define MyAppVersion "1.1.0-20.10.8" #define MyAppPublisher "zsunqian69@gmail.com" #define MyAppURL "https://github.com/Aric-Sun/FirstKeyFrameFilter" #define MyAppExeName "FirstKeyFrameFilter.exe" @@ -25,8 +25,8 @@ AllowNoIcons=yes ; 移除以下行,以在管理安装模式下运行(为所有用户安装)。 PrivilegesRequired=lowest PrivilegesRequiredOverridesAllowed=commandline -OutputDir=D:\Downloads\FirstKeyFrameFilter\out\artifacts\FirstKeyFrameFilter_jar -OutputBaseFilename=FirstKeyFrameFilter1.0.1-20.10.4_Setup +OutputDir=E:\Aric Sun\自学技术\FirstKeyFrameFilter\out\artifacts\FirstKeyFrameFilter_jar +OutputBaseFilename=FirstKeyFrameFilter1.1.0-20.10.8_Setup Compression=lzma SolidCompression=yes WizardStyle=modern @@ -35,8 +35,8 @@ WizardStyle=modern Name: "chinesesimp"; MessagesFile: "compiler:Default.isl" [Files] -Source: "D:\Downloads\FirstKeyFrameFilter\out\artifacts\FirstKeyFrameFilter_jar\FirstKeyFrameFilter\FirstKeyFrameFilter.exe"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\Downloads\FirstKeyFrameFilter\out\artifacts\FirstKeyFrameFilter_jar\FirstKeyFrameFilter\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "E:\Aric Sun\自学技术\FirstKeyFrameFilter\out\artifacts\FirstKeyFrameFilter_jar\FirstKeyFrameFilter\FirstKeyFrameFilter.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "E:\Aric Sun\自学技术\FirstKeyFrameFilter\out\artifacts\FirstKeyFrameFilter_jar\FirstKeyFrameFilter\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs ; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion” [Icons] diff --git a/exe4jConfigFile.exe4j b/exe4jConfigFile.exe4j index 340ebac..f70f36f 100644 --- a/exe4jConfigFile.exe4j +++ b/exe4jConfigFile.exe4j @@ -1,11 +1,11 @@ - - + + - + - + diff --git a/src/FLVCutter/FastForwardMpeg.java b/src/FLVCutter/FastForwardMpeg.java index 05fdb66..5902574 100644 --- a/src/FLVCutter/FastForwardMpeg.java +++ b/src/FLVCutter/FastForwardMpeg.java @@ -1,5 +1,6 @@ package FLVCutter; +import Utils.FileUtils.FilenameUtils; import Utils.RuntimeUtils.LocalCmdExecutor; import java.io.*; @@ -32,9 +33,8 @@ public String cutFlvWithSSTime(String flvPath, double ssTime){ return "-23"; } // 最终生成的文件 - String flvPathCut = flvPath.substring( - 0, flvPath.indexOf(".") - ) + "-cut_" + ssTime + "-end.flv"; + String flvPathCut = FilenameUtils.getFilenameWithoutExtension(flvPath) + + "-cut_" + ssTime + "-end.flv"; //判断目标生成文件是否存在,询问是否覆盖 Path FLVPathCut = Paths.get(flvPathCut); @@ -57,6 +57,7 @@ public String cutFlvWithSSTime(String flvPath, double ssTime){ "-i", flvPath, "-ss", String.valueOf(ssTime), "-c", "copy", + "-copyts", // keep the original timestamps flvPathCut}; // 执行命令 diff --git a/src/Utils/DataTypeConverter.java b/src/Utils/DataTypeConverter.java new file mode 100644 index 0000000..16f1b26 --- /dev/null +++ b/src/Utils/DataTypeConverter.java @@ -0,0 +1,18 @@ +package Utils; + +/** + * 数据类型转换工具类 + * @author AricSun + * @date 2020.10.07 23:02 + */ +public class DataTypeConverter{ + /* + * function: 将timestamp的PTxx.xxS通过正则匹配出浮点型数据 + * @Param: [timeStamp时间戳] + * @Return: java.lang.Double + */ + public static Double TimeStamp2Double(String timeStamp){ + return Double.parseDouble(timeStamp.replaceAll("[^\\d.]", "")); + } + +} diff --git a/src/Utils/FileUtils/FilenameUtils.java b/src/Utils/FileUtils/FilenameUtils.java new file mode 100644 index 0000000..5c95604 --- /dev/null +++ b/src/Utils/FileUtils/FilenameUtils.java @@ -0,0 +1,24 @@ +package Utils.FileUtils; + +/** + * 文件名工具类 + * @author AricSun + * @date 2020.10.07 22:36 + */ +public class FilenameUtils { + /* + * function: 获取不带扩展名的文件名 + * @Param [filename文件名] + * @Return java.lang.String + * from: https://my.oschina.net/liting/blog/535479 + */ + public static String getFilenameWithoutExtension(String filename){ + if ((filename != null) && (filename.length() > 0)){ + int dot = filename.lastIndexOf('.'); + if ((dot > -1) && (dot < filename.length())){ + return filename.substring(0,dot); + } + } + return filename; + } +} diff --git a/src/XMLGenerator/FlvInteractiveRebase.java b/src/XMLGenerator/FlvInteractiveRebase.java index 7baac19..fa30829 100644 --- a/src/XMLGenerator/FlvInteractiveRebase.java +++ b/src/XMLGenerator/FlvInteractiveRebase.java @@ -1,7 +1,6 @@ package XMLGenerator; import Utils.RuntimeUtils.LocalCmdExecutor; -import Utils.RuntimeUtils.ResourcesRelease; import java.io.*; import java.nio.file.Files; @@ -12,6 +11,8 @@ import java.util.Scanner; import java.util.stream.Stream; +import Utils.FileUtils.FilenameUtils; + /** * 调用fib读取flv * errorCodePrefix 1 @@ -37,9 +38,8 @@ public String parseFlvWithFib(String flvPath) { // Path flvFileName = flvPath.getFileName(); // flv文件名,带后缀,不带路径 // Path flvFolderPath = flvPath.getParent(); // flv所在目录路径 // String flvPathStr = String.valueOf(flvPath); - String xmlPath = flvPath.substring(0, - flvPath.lastIndexOf(".") - ).concat(".xml"); // 生成xml的绝对路径 + String xmlPath = FilenameUtils.getFilenameWithoutExtension(flvPath) + .concat(".xml"); // 生成xml的绝对路径 //判断目标生成文件是否存在,询问是否覆盖 Path XMLPath = Paths.get(xmlPath); diff --git a/src/XMLParsing/DOM/XMLReader.java b/src/XMLParsing/DOM/XMLReader.java index 577d831..acc13ea 100644 --- a/src/XMLParsing/DOM/XMLReader.java +++ b/src/XMLParsing/DOM/XMLReader.java @@ -1,5 +1,6 @@ package XMLParsing.DOM; +import Utils.DataTypeConverter; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -86,7 +87,7 @@ public static void main(String[] args) { 此处因废用而不再修复 */ if (CntKeyFrame == 3){ - System.out.println(TimeStamp2Double(timeStamp)); + System.out.println(DataTypeConverter.TimeStamp2Double(timeStamp)); break; } } @@ -94,13 +95,4 @@ public static void main(String[] args) { e.printStackTrace(); } } - - /* - * function: 将timestamp的PTxx.xxS通过正则匹配出浮点型数据 - * @Param: [timeStamp时间戳] - * @Return: java.lang.Double - */ - public static Double TimeStamp2Double(String timeStamp){ - return Double.parseDouble(timeStamp.replaceAll("[^\\d.]", "")); - } } diff --git a/src/XMLParsing/SAX/XMLReader.java b/src/XMLParsing/SAX/XMLReader.java index 7b24060..01a1d0a 100644 --- a/src/XMLParsing/SAX/XMLReader.java +++ b/src/XMLParsing/SAX/XMLReader.java @@ -24,7 +24,7 @@ public static void main(String[] args) { SAXParser saxParser = saxParserFactory.newSAXParser(); saxParser.parse(new File("xml/352-TypicalCase.xml"),frameHandler); List frameList = frameHandler.getFrameList(); -// System.out.println(frameList); + System.out.println(frameList); } catch (ParserConfigurationException | SAXException | IOException e) { e.printStackTrace(); } diff --git a/src/XMLParsing/StAX/ParserXML.java b/src/XMLParsing/StAX/ParserXML.java index 9dbb830..60e97d9 100644 --- a/src/XMLParsing/StAX/ParserXML.java +++ b/src/XMLParsing/StAX/ParserXML.java @@ -1,5 +1,6 @@ package XMLParsing.StAX; +import Utils.DataTypeConverter; import dto.Frame; import javax.xml.stream.XMLInputFactory; @@ -12,8 +13,6 @@ import java.util.ArrayList; import java.util.List; -import static XMLParsing.DOM.XMLReader.TimeStamp2Double; - /** * StAX解析XML * StAX与SAX一样是基于XML事件的解析方式, @@ -42,9 +41,9 @@ public class ParserXML { private Frame frame; - public List getFrameList() { + /*public List getFrameList() { return frameList; - } + }*/ private List frameList; @@ -180,7 +179,7 @@ public double readXMLByCursor(String XMLFilePath){ * */ int cntKeyFrame = frameList.size(); if (cntKeyFrame >= 2){ - double secondKeyFrameTime = TimeStamp2Double( + double secondKeyFrameTime = DataTypeConverter.TimeStamp2Double( frameList.get(cntKeyFrame-1).getTimeStamp() ); /* 2020年10月4日