Skip to content

Commit

Permalink
Update for windows version release
Browse files Browse the repository at this point in the history
  • Loading branch information
jackychu0830 committed Oct 10, 2021
1 parent 7faac59 commit 18b7506
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 23 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

## 主要功能:

1. 草稿字幕簡體轉繁體 或 台灣正體
1. 草稿字幕簡體轉繁體
2. 字幕匯出成 SRT 檔 及 TXT 文字檔
3. 刪除影片字幕
3. 載入既有的 SRT 檔
4. 字幕編輯修改
5. 刪除影片字幕

## [Mac 版下載](https://github.com/jackychu0830/jy-srt-tools/tree/mac)
## 安裝說明
## 安裝說明
1. 安裝 Java 11 執行環境 (下載: https://www.microsoft.com/openjdk)
2. 下載剪映字幕工具箱式 [2.0.210 版](https://github.com/jackychu0830/jy-srt-tools/releases/download/2.0.210-Win/jy-srt-tools-2.0.210-Win.jar)
3. 滑鼠雙擊 jy-srt-tools-2.0.210-Win.jar 執行程式

## [Windows 版下載](https://github.com/jackychu0830/jy-srt-tools/tree/win)
## 使用說明

## 執行畫面

### Mac

![Mac 版畫面](https://github.com/jackychu0830/jy-srt-tools/raw/mac/screenshot-1.png)

### Windows

![Windows 版畫面](https://github.com/jackychu0830/jy-srt-tools/raw/win/screenshot-1.png)

## 使用說明

https://youtu.be/ysV39jfLmfE
![Mac 版畫面](https://github.com/jackychu0830/jy-srt-tools/raw/win/screenshot-1.png)
![字幕編輯](https://github.com/jackychu0830/jy-srt-tools/raw/win/screenshot-2.png)
![字幕尋找](https://github.com/jackychu0830/jy-srt-tools/raw/win/screenshot-3.png)
![字幕替換](https://github.com/jackychu0830/jy-srt-tools/raw/win/screenshot-4.png)
![載入字幕](https://github.com/jackychu0830/jy-srt-tools/raw/win/screenshot-5.png)
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>app.jackychu</groupId>
<artifactId>jy-srt-tools</artifactId>
<packaging>jar</packaging>
<version>2.0.200</version>
<version>2.0.210</version>

<name>jy-srt-tools</name>
<description>The SRT tools for JianyingPro video editor</description>
Expand Down
Binary file added screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 22 additions & 2 deletions src/main/java/app/jackychu/jysrttools/DraftTemplates.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@

import javax.swing.*;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Locale;
import java.util.Objects;

public class DraftTemplates {
Expand All @@ -17,13 +20,30 @@ public class DraftTemplates {
public static String getTemplate(String templateName) {
String temp = null;
try {
temp = Files.readString(Paths.get(Objects.requireNonNull(DraftTemplates.class.getClassLoader().getResource("draft_templates/" + templateName + ".json").toURI())),
StandardCharsets.UTF_8);
String os = System.getProperty("os.name");
if (os.toLowerCase(Locale.ROOT).contains("windows")) {
InputStream in = DraftTemplates.class.getClassLoader().getResourceAsStream("draft_templates/" + templateName + ".json");
byte[] data = in.readAllBytes();
temp = new String(data);
} else {
temp = Files.readString(Paths.get(Objects.requireNonNull(DraftTemplates.class.getClassLoader().getResource("draft_templates/" + templateName + ".json").toURI())),
StandardCharsets.UTF_8);
}
} catch (IOException | URISyntaxException | RuntimeException e) {
JOptionPane.showMessageDialog(null,
new ErrorMessagePanel(e), "讀取字幕模版失敗", JOptionPane.ERROR_MESSAGE);
}

return temp;
}

public static String getDefaultFontPath() {
String os = System.getProperty("os.name");
if (os.toLowerCase(Locale.ROOT).contains("windows")) {
return WIN_DEFAULT_FONT_PATH;
} else {
return MAC_DEFAULT_FONT_PATH;
}

}
}
2 changes: 1 addition & 1 deletion src/main/java/app/jackychu/jysrttools/JyDraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public void replaceDraftSubtitles(List<Subtitle> newSubtitles) throws JySrtTools
String textTemp = DraftTemplates.getTemplate("draft_text");
values = new HashMap<>();
values.put("content", sub.getText());
values.put("font_path", DraftTemplates.MAC_DEFAULT_FONT_PATH);
values.put("font_path", DraftTemplates.getDefaultFontPath());
String textId = UUID.randomUUID().toString().toUpperCase();
values.put("id", textId);
String textStr = StringSubstitutor.replace(textTemp, values, "${", "}");
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/app/jackychu/jysrttools/JyUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ public static String getJyVersion() {
try {
String[] cmd;
if (os.toLowerCase(Locale.ROOT).contains("windows")) {
cmd = new String[]{"cmd.exe", "dir"};
InputStream input = JyUtils.class.getClassLoader().getResourceAsStream("config.properties");
Properties prop = new Properties();
prop.load(input);
return prop.getProperty("jy_version");
} else {
cmd = new String[]{"/usr/bin/bash", "mdls -name kMDItemVersion /Applications/VideoFusion-macOS.app | awk -F'\"' '{print $2}'"};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void setSubtitles(JyDraft draft) throws JySrtToolsException {

private void setTableColumnSize() {
// subtitleTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
subtitleTable.getColumnModel().getColumn(0).setMaxWidth(40);
subtitleTable.getColumnModel().getColumn(0).setMaxWidth(50);
subtitleTable.getColumnModel().getColumn(0).setResizable(false);
subtitleTable.getColumnModel().getColumn(1).setMaxWidth(115);
subtitleTable.getColumnModel().getColumn(1).setMinWidth(115);
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/config.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=2.0.200
jy_version=2.0.0
version=2.0.210
jy_version=2.1.0

0 comments on commit 18b7506

Please sign in to comment.