--------------------------------------------------------------------------------
/doc/image/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zimujiang/TinyClip/3cc95f358457a0568e7bd225dacb600a20c2ef22/doc/image/1.png
--------------------------------------------------------------------------------
/doc/image/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zimujiang/TinyClip/3cc95f358457a0568e7bd225dacb600a20c2ef22/doc/image/2.png
--------------------------------------------------------------------------------
/doc/image/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zimujiang/TinyClip/3cc95f358457a0568e7bd225dacb600a20c2ef22/doc/image/icon.png
--------------------------------------------------------------------------------
/license:
--------------------------------------------------------------------------------
1 | Software License Agreement
2 | ==========================
3 |
4 | TinyClip - https://www.zimujiang.com/tinyclip
5 |
6 | Licensed under the terms at your choice:
7 |
8 | - Mozilla Public License Version 1.1 (the "MPL")
9 | http://www.mozilla.org/MPL/MPL-1.1.html
10 | (See Appendix A)
11 |
12 | You are not required to, but if you want to explicitly declare the
13 | license you have chosen to be bound to when using, reproducing,
14 | modifying and distributing this software, just include a text file
15 | titled "legal.txt" in your version of this software, indicating your
16 | license choice. In any case, your choice will not restrict any
17 | recipient of your version of this software to use, reproduce, modify
18 | and distribute this software under any of the above licenses.
19 |
20 | Where not otherwise indicated, all TinyClip content is authored by
21 | ZiMuJiang.Com and consists of ZiMuJiang-owned intellectual
22 | property.
23 |
24 | Trademarks
25 | ----------
26 |
27 | TinyClip, logo are trademarks of ZiMuJiang.Com. All other brand
28 | and product names are trademarks, registered trademarks or service
29 | marks of their respective holders.
30 |
31 |
32 | Appendix A: The MPL License
33 | ---------------------------
34 | Mozilla Public License Version 1.1
35 | 1. Definitions.
36 | 1.0.1. "Commercial Use"
37 | means distribution or otherwise making the Covered Code available to a third party.
38 | 1.1. "Contributor"
39 | means each entity that creates or contributes to the creation of Modifications.
40 | 1.2. "Contributor Version"
41 | means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor.
42 | 1.3. "Covered Code"
43 | means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof.
44 | 1.4. "Electronic Distribution Mechanism"
45 | means a mechanism generally accepted in the software development community for the electronic transfer of data.
46 | 1.5. "Executable"
47 | means Covered Code in any form other than Source Code.
48 | 1.6. "Initial Developer"
49 | means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A.
50 | 1.7. "Larger Work"
51 | means a work which combines Covered Code or portions thereof with code not governed by the terms of this License.
52 | 1.8. "License"
53 | means this document.
54 | 1.8.1. "Licensable"
55 | means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.
56 | 1.9. "Modifications"
57 |
58 | means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is:
59 | Any addition to or deletion from the contents of a file containing Original Code or previous Modifications.
60 | Any new file that contains any part of the Original Code or previous Modifications.
61 | 1.10. "Original Code"
62 | means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License.
63 | 1.10.1. "Patent Claims"
64 | means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.
65 | 1.11. "Source Code"
66 | means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge.
67 | 1.12. "You" (or "Your")
68 | means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
69 | 2. Source Code License.
70 | 2.1. The Initial Developer Grant.
71 |
72 | The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
73 | under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and
74 | under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof).
75 | the licenses granted in this Section 2.1 (a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License.
76 | Notwithstanding Section 2.1 (b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices.
77 | 2.2. Contributor Grant.
78 |
79 | Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license
80 | under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and
81 | under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).
82 | the licenses granted in Sections 2.2 (a) and 2.2 (b) are effective on the date Contributor first makes Commercial Use of the Covered Code.
83 | Notwithstanding Section 2.2 (b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor.
84 | 3. Distribution Obligations.
85 | 3.1. Application of License.
86 |
87 | The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5.
88 | 3.2. Availability of Source Code.
89 |
90 | Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party.
91 | 3.3. Description of Modifications.
92 |
93 | You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code.
94 | 3.4. Intellectual Property Matters
95 | (a) Third Party Claims
96 |
97 | If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained.
98 | (b) Contributor APIs
99 |
100 | If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the legal file.
101 | (c) Representations.
102 |
103 | Contributor represents that, except as disclosed pursuant to Section 3.4 (a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License.
104 | 3.5. Required Notices.
105 |
106 | You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.
107 | 3.6. Distribution of Executable Versions.
108 |
109 | You may distribute Covered Code in Executable form only if the requirements of Sections 3.1, 3.2, 3.3, 3.4 and 3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.
110 | 3.7. Larger Works.
111 |
112 | You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code.
113 | 4. Inability to Comply Due to Statute or Regulation.
114 |
115 | If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the legal file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.
116 | 5. Application of this License.
117 |
118 | This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code.
119 | 6. Versions of the License.
120 | 6.1. New Versions
121 |
122 | Netscape Communications Corporation ("Netscape") may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number.
123 | 6.2. Effect of New Versions
124 |
125 | Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Netscape. No one other than Netscape has the right to modify the terms applicable to Covered Code created under this License.
126 | 6.3. Derivative Works
127 |
128 | If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the Mozilla Public License and Netscape Public License. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.)
129 | 7. Disclaimer of warranty
130 |
131 | Covered code is provided under this license on an "as is" basis, without warranty of any kind, either expressed or implied, including, without limitation, warranties that the covered code is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the covered code is with you. Should any covered code prove defective in any respect, you (not the initial developer or any other contributor) assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty constitutes an essential part of this license. No use of any covered code is authorized hereunder except under this disclaimer.
132 | 8. Termination
133 |
134 | 8.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.
135 |
136 | 8.2. If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You file such action is referred to as "Participant") alleging that:
137 | such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant. If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above.
138 | any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant.
139 |
140 | 8.3. If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license.
141 |
142 | 8.4. In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination.
143 | 9. Limitation of liability
144 |
145 | Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall you, the initial developer, any other contributor, or any distributor of covered code, or any supplier of any of such parties, be liable to any person for any indirect, special, incidental, or consequential damages of any character including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such party shall have been informed of the possibility of such damages. This limitation of liability shall not apply to liability for death or personal injury resulting from such party's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to you.
146 | 10. U.S. government end users
147 |
148 | The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein.
149 | 11. Miscellaneous
150 |
151 | This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License.
152 | 12. Responsibility for claims
153 |
154 | As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.
155 | 13. Multiple-licensed code
156 |
157 | Initial Developer may designate portions of the Covered Code as "Multiple-Licensed". "Multiple-Licensed" means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of the MPL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A.
158 | Exhibit A - Mozilla Public License.
159 | "The contents of this file are subject to the Mozilla Public License
160 | Version 1.1 (the "License"); you may not use this file except in
161 | compliance with the License. You may obtain a copy of the License at
162 | http://www.mozilla.org/MPL/
163 |
164 | Software distributed under the License is distributed on an "AS IS"
165 | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
166 | License for the specific language governing rights and limitations
167 | under the License.
168 |
169 | The Original Code is ______________________________________.
170 |
171 | The Initial Developer of the Original Code is ________________________.
172 | Portions created by ______________________ are Copyright (C) ______
173 | _______________________. All Rights Reserved.
174 |
175 | Contributor(s): ______________________________________.
176 |
177 | Alternatively, the contents of this file may be used under the terms
178 | of the _____ license (the "[___] License"), in which case the
179 | provisions of [______] License are applicable instead of those
180 | above. If you wish to allow use of your version of this file only
181 | under the terms of the [____] License and not to allow others to use
182 | your version of this file under the MPL, indicate your decision by
183 | deleting the provisions above and replace them with the notice and
184 | other provisions required by the [___] License. If you do not delete
185 | the provisions above, a recipient may use your version of this file
186 | under either the MPL or the [___] License."
187 |
188 | NOTE: The text of this Exhibit A may differ slightly from the text of the notices in the Source Code files of the Original Code. You should use the text of this Exhibit A rather than the text found in the Original Code Source Code for Your Modifications.
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | net.tinyclip
8 | TinyClip
9 | 1.0-SNAPSHOT
10 |
11 |
12 | 11
13 | 11
14 | 11
15 | UTF-8
16 | UTF-8
17 |
18 |
19 |
20 |
21 | org.openjfx
22 | javafx-fxml
23 | 15.0.1
24 |
25 |
26 | org.openjfx
27 | javafx-controls
28 | 15.0.1
29 |
30 |
31 | org.apache.commons
32 | commons-lang3
33 | 3.5
34 |
35 |
36 | org.bytedeco
37 | ffmpeg-platform
38 | 4.3.1-1.5.4
39 |
40 |
41 | org.bytedeco
42 | ffmpeg
43 | 4.3.1-1.5.4
44 |
45 |
46 |
47 |
48 |
49 | io.github.fvarrui
50 | javapackager
51 | 1.5.1
52 |
53 |
54 | package
55 |
56 | package
57 |
58 |
59 |
60 | com.zimujiang.tinyclip.AppStart
61 |
62 | true
63 |
64 | true
65 | false
66 | auto
67 |
68 | ${basedir}/src/main/resources
69 |
70 |
71 |
72 | true
73 | true
74 | 128
75 | ${basedir}/src/main/resources/icon/TinyClip.icns
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/src/main/java/com/zimujiang/tinyclip/App.java:
--------------------------------------------------------------------------------
1 | package com.zimujiang.tinyclip;
2 |
3 | import com.zimujiang.tinyclip.config.AppConfig;
4 | import javafx.application.Application;
5 | import javafx.fxml.FXMLLoader;
6 | import javafx.scene.Parent;
7 | import javafx.scene.Scene;
8 | import javafx.scene.image.Image;
9 | import javafx.stage.Stage;
10 |
11 | public class App extends Application {
12 |
13 | public static void main(String[] args) throws InterruptedException {
14 | AppConfig.init();
15 | launch(args);
16 | }
17 |
18 | @Override
19 | public void init() throws Exception {
20 | super.init();
21 | }
22 |
23 | public void start(Stage stage) throws Exception {
24 | // 加载并创建主场景
25 | Parent root = FXMLLoader.load(getClass().getResource("/fxml/Main.fxml"));
26 | // root.getStylesheets().add(ResourceUtil.getResource("css/Main.css").toExternalForm());
27 | Scene scene = new Scene(root, AppConfig.stageWidth, AppConfig.stageHeight);
28 | // 设置窗口信息
29 | stage.setTitle(AppConfig.title);
30 | stage.setResizable(AppConfig.stageResizable);
31 | stage.getIcons().add(new Image(getClass().getResourceAsStream(AppConfig.icon)));
32 | stage.setScene(scene);
33 | stage.show();
34 | }
35 |
36 | @Override
37 | public void stop() throws Exception {
38 | super.stop();
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/zimujiang/tinyclip/AppStart.java:
--------------------------------------------------------------------------------
1 | package com.zimujiang.tinyclip;
2 |
3 | public class AppStart {
4 | public static void main(String[] args) throws InterruptedException {
5 | App.main(args);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/main/java/com/zimujiang/tinyclip/config/AppConfig.java:
--------------------------------------------------------------------------------
1 | package com.zimujiang.tinyclip.config;
2 |
3 | /**
4 | * 应用配置
5 | *
6 | * @author westinyang
7 | * @date 2020/3/18 18:13
8 | */
9 | public class AppConfig {
10 | // 应用标题
11 | public static String title = "TinyClip V0.0.2";
12 | // 应用图标
13 | public static String icon = "/icon/TinyClip.png";
14 | // 窗口宽度
15 | public static int stageWidth = 640;
16 | // 窗口高度
17 | public static int stageHeight = 480;
18 | // 允许调整窗口尺寸
19 | public static boolean stageResizable = false;
20 |
21 | public static void init() {
22 | //初始化窗口todo
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/zimujiang/tinyclip/ctrl/MainCtrl.java:
--------------------------------------------------------------------------------
1 | package com.zimujiang.tinyclip.ctrl;
2 |
3 | import javafx.application.Platform;
4 | import javafx.concurrent.Task;
5 | import javafx.event.ActionEvent;
6 | import javafx.fxml.Initializable;
7 | import javafx.scene.control.*;
8 | import javafx.scene.control.Button;
9 | import javafx.scene.control.TextField;
10 | import javafx.scene.image.ImageView;
11 | import javafx.scene.layout.Pane;
12 | import javafx.stage.DirectoryChooser;
13 | import javafx.stage.FileChooser;
14 | import javafx.stage.Window;
15 | import com.zimujiang.tinyclip.utils.FileUtils;
16 | import org.apache.commons.lang3.time.StopWatch;
17 | import org.bytedeco.javacpp.Loader;
18 |
19 | import java.awt.*;
20 | import java.io.File;
21 | import java.io.IOException;
22 | import java.net.URI;
23 | import java.net.URISyntaxException;
24 | import java.net.URL;
25 | import java.util.ArrayList;
26 | import java.util.ResourceBundle;
27 |
28 | /**
29 | * 主界面控制器
30 | *
31 | * @author westinyang
32 | * @date 2020/3/18 18:13
33 | */
34 | public class MainCtrl implements Initializable {
35 |
36 | // 主容器
37 | public Pane rootPane;
38 | public Hyperlink hyperlink;
39 |
40 | // 提取Tab
41 | public Button tqSelectVideoFileBtn;
42 | public Button tqSelectOutPutDirBtn;
43 | public Button tqStartBtn;
44 | public ComboBox tqRateCb;
45 | public ComboBox tqFormatCb;
46 | public TextField tqVideoTxt;
47 | public TextField tqOutPutTxt;
48 | public ImageView tqimageView;
49 |
50 |
51 | public void initialize(URL location, ResourceBundle resources) {
52 | //log.info("initialize: {}", location.getPath());
53 | tqRateCb.getItems().addAll("8000","12050","16000","22050","24000","32000","44100","48000");
54 | tqRateCb.getSelectionModel().select(2);
55 | tqFormatCb.getItems().addAll("mp3","wav");
56 | tqFormatCb.getSelectionModel().select(0);
57 | tqimageView.setVisible(false);
58 | }
59 |
60 | /**
61 | * 选择提取开始按钮点击事件
62 | * @param actionEvent
63 | */
64 | public void tqStartBtnClick(ActionEvent actionEvent) {
65 | String input = tqVideoTxt.getText();
66 | String outputDir = tqOutPutTxt.getText();
67 | String rate = tqRateCb.getValue().toString();
68 | String format = tqFormatCb.getValue().toString().toLowerCase();
69 | File f = new File(input);
70 | File d = new File(outputDir);
71 | String videoName = "TinyClip_"+FileUtils.getFileName(f)+"_"+ System.currentTimeMillis() / 1000L;
72 | if(input!=null && outputDir!=null && d.exists() && f.exists()) {
73 | String ffmpeg = Loader.load(org.bytedeco.ffmpeg.ffmpeg.class);
74 | ProcessBuilder pb = new ProcessBuilder(ffmpeg,"-i",input,"-ar",rate,outputDir + File.separator + videoName +"."+ format);
75 | Task task = new Task() {
76 | @Override public String call() {
77 | StopWatch sw = new StopWatch();
78 | String r = "";
79 | try {
80 | sw.start();
81 | pb.start().waitFor();
82 | sw.stop();
83 | r = "提取完成,耗时:"+sw.toString();
84 | } catch (InterruptedException e) {
85 | e.printStackTrace();
86 | r = "进程被中断";
87 | } catch (IOException e) {
88 | e.printStackTrace();
89 | r = "IO异常";
90 | } finally {
91 | if(!sw.isStopped()){
92 | sw.stop();
93 | }
94 | return r;
95 | }
96 | }
97 | };
98 | task.setOnRunning((e) -> {
99 | tqStartBtn.setText("正在处理");
100 | tqStartBtn.setDisable(true);
101 | tqimageView.setVisible(true);
102 | });
103 | task.setOnSucceeded((e) -> {
104 | tqStartBtn.setText("开始提取");
105 | tqStartBtn.setDisable(false);
106 | tqimageView.setVisible(false);
107 | try{
108 | Alert alert = new Alert(Alert.AlertType.INFORMATION);
109 | alert.setContentText(task.get());
110 | alert.show();
111 | }catch (Exception ex){
112 | ex.printStackTrace();
113 | }
114 | });
115 | task.setOnFailed((e) -> {
116 | Alert alert = new Alert(Alert.AlertType.ERROR);
117 | alert.setContentText("处理失败");
118 | alert.show();
119 | });
120 | new Thread(task).start();
121 | }else{
122 | Alert alert = new Alert(Alert.AlertType.ERROR);
123 | alert.setContentText("请确保输入视频和输出目录有效");
124 | alert.show();
125 | }
126 | }
127 |
128 | /**
129 | * 选择输出目录按钮单击事件
130 | * @param actionEvent
131 | */
132 | public void tqSelectOutPutDirBtnClick(ActionEvent actionEvent) {
133 | Window window = rootPane.getScene().getWindow();
134 | DirectoryChooser directoryChooser = new DirectoryChooser();
135 | directoryChooser.setTitle("选择输出目录");
136 | File directory = directoryChooser.showDialog(window);
137 | if (directory != null) {
138 | tqOutPutTxt.setText(directory.getAbsolutePath());
139 | }
140 | }
141 |
142 | /**
143 | * 选择提取视频路径按钮单击事件
144 | * @param actionEvent
145 | */
146 | public void tqSelectVideoFileBtnClick(ActionEvent actionEvent) {
147 | Window window = rootPane.getScene().getWindow();
148 | FileChooser fileChooser = new FileChooser();
149 | // 文件类型过滤器
150 | FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter("视频文件 (*.mp4)", "*.mp4", "*.MP4");
151 | fileChooser.getExtensionFilters().add(filter);
152 |
153 | File file = fileChooser.showOpenDialog(window);
154 | String fileAbsolutePath = file == null ? "" : file.getAbsolutePath();
155 |
156 | if (file != null) {
157 | tqVideoTxt.setText(fileAbsolutePath);
158 | tqOutPutTxt.setText(file.getParentFile().getAbsolutePath());
159 | }
160 | }
161 |
162 | /**
163 | * 超链接单击事件
164 | * @param actionEvent
165 | */
166 | public void hyperlinkClick(ActionEvent actionEvent) {
167 | try {
168 | Desktop.getDesktop().browse(new URI("https://www.zimujiang.com"));
169 | } catch (IOException e) {
170 | e.printStackTrace();
171 | } catch (URISyntaxException e) {
172 | e.printStackTrace();
173 | }
174 | }
175 | }
176 |
--------------------------------------------------------------------------------
/src/main/java/com/zimujiang/tinyclip/ctrl/SubtitleConvertCtrl.java:
--------------------------------------------------------------------------------
1 | package com.zimujiang.tinyclip.ctrl;
2 |
3 | import com.zimujiang.tinyclip.utils.FileUtils;
4 | import javafx.concurrent.Task;
5 | import javafx.event.ActionEvent;
6 | import javafx.fxml.Initializable;
7 | import javafx.scene.control.Alert;
8 | import javafx.scene.control.Button;
9 | import javafx.scene.control.ComboBox;
10 | import javafx.scene.control.TextField;
11 | import javafx.scene.image.ImageView;
12 | import javafx.scene.layout.Pane;
13 | import javafx.stage.DirectoryChooser;
14 | import javafx.stage.FileChooser;
15 | import javafx.stage.Window;
16 | import org.apache.commons.lang3.time.StopWatch;
17 | import org.bytedeco.javacpp.Loader;
18 |
19 | import java.io.File;
20 | import java.io.IOException;
21 | import java.net.URL;
22 | import java.util.ResourceBundle;
23 |
24 | /**
25 | * 字幕处理TabCtrl
26 | */
27 | public class SubtitleConvertCtrl implements Initializable {
28 |
29 | public TextField subTxt;
30 | public TextField subOutPutTxt;
31 | public Button subSelectFileBtn;
32 | public Button subSelectOutPutDirBtn;
33 | public Button subStartBtn;
34 | public ComboBox subFormatCb;
35 | public ImageView subimageView;
36 |
37 | public void initialize(URL location, ResourceBundle resources) {
38 | subFormatCb.getItems().addAll("srt","ass");
39 | subFormatCb.getSelectionModel().select(0);
40 | subimageView.setVisible(false);
41 | }
42 |
43 |
44 | /**
45 | * 字幕格式转换
46 | * @param actionEvent
47 | */
48 | public void subStartBtnClick(ActionEvent actionEvent) {
49 | String input = subTxt.getText();
50 | String outputDir = subOutPutTxt.getText();
51 | String format = subFormatCb.getValue().toString().toLowerCase();
52 | File f = new File(input);
53 | File d = new File(outputDir);
54 | String subName = "TinyClip_"+ FileUtils.getFileName(f)+"_"+ System.currentTimeMillis() / 1000L;
55 | if(input!=null && outputDir!=null && d.exists() && f.exists()) {
56 | String ffmpeg = Loader.load(org.bytedeco.ffmpeg.ffmpeg.class);
57 | ProcessBuilder pb = new ProcessBuilder(ffmpeg,"-i",input,outputDir + File.separator + subName +"."+ format);
58 | Task task = new Task() {
59 | @Override public String call() {
60 | StopWatch sw = new StopWatch();
61 | String r = "";
62 | try {
63 | sw.start();
64 | pb.start().waitFor();
65 | sw.stop();
66 | r = "转换完成,耗时:"+sw.toString();
67 | } catch (InterruptedException e) {
68 | e.printStackTrace();
69 | r = "进程被中断";
70 | } catch (IOException e) {
71 | e.printStackTrace();
72 | r = "IO异常";
73 | } finally {
74 | if(!sw.isStopped()){
75 | sw.stop();
76 | }
77 | return r;
78 | }
79 | }
80 | };
81 | task.setOnRunning((e) -> {
82 | subStartBtn.setText("正在处理");
83 | subStartBtn.setDisable(true);
84 | subimageView.setVisible(true);
85 | });
86 | task.setOnSucceeded((e) -> {
87 | subStartBtn.setText("开始转换");
88 | subStartBtn.setDisable(false);
89 | subimageView.setVisible(false);
90 | try{
91 | Alert alert = new Alert(Alert.AlertType.INFORMATION);
92 | alert.setContentText(task.get());
93 | alert.show();
94 | }catch (Exception ex){
95 | ex.printStackTrace();
96 | }
97 | });
98 | task.setOnFailed((e) -> {
99 | Alert alert = new Alert(Alert.AlertType.ERROR);
100 | alert.setContentText("转换失败");
101 | alert.show();
102 | });
103 | new Thread(task).start();
104 |
105 |
106 | }else {
107 | Alert alert = new Alert(Alert.AlertType.ERROR);
108 | alert.setContentText("请确保输入字幕和输出目录有效");
109 | alert.show();
110 | }
111 |
112 |
113 | }
114 |
115 | /**
116 | * 选择输出目录按钮单击事件
117 | * @param actionEvent
118 | */
119 | public void subSelectOutPutDirBtnClick(ActionEvent actionEvent) {
120 | DirectoryChooser directoryChooser = new DirectoryChooser();
121 | directoryChooser.setTitle("选择输出目录");
122 | File directory = directoryChooser.showDialog(subSelectOutPutDirBtn.getScene().getWindow());
123 | if (directory != null) {
124 | subOutPutTxt.setText(directory.getAbsolutePath());
125 | }
126 | }
127 |
128 | /**
129 | * 选择字幕路径按钮单击事件
130 | * @param actionEvent
131 | */
132 | public void subSelectFileBtnClick(ActionEvent actionEvent) {
133 |
134 | FileChooser fileChooser = new FileChooser();
135 | // 文件类型过滤器
136 | FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter("字幕文件 (*.srt、*.ass)", "*.srt", "*.ass");
137 | fileChooser.getExtensionFilters().add(filter);
138 |
139 | File file = fileChooser.showOpenDialog(subSelectFileBtn.getScene().getWindow());
140 | String fileAbsolutePath = file == null ? "" : file.getAbsolutePath();
141 | if (file != null) {
142 | subTxt.setText(fileAbsolutePath);
143 | subOutPutTxt.setText(file.getParentFile().getAbsolutePath());
144 | }
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/src/main/java/com/zimujiang/tinyclip/utils/FileUtils.java:
--------------------------------------------------------------------------------
1 | package com.zimujiang.tinyclip.utils;
2 |
3 | import org.apache.commons.lang3.StringUtils;
4 |
5 | import java.io.*;
6 | import java.util.Collections;
7 | import java.util.List;
8 |
9 | /**
10 | * Created by tonydeng on 15/4/17.
11 | */
12 | public class FileUtils {
13 |
14 | private static final String PATH_SRCEENTSHOT = "srceent";
15 | private static final String PATH_HLS = "hls";
16 | private static final String EXTEND_JPG = ".jpg";
17 | private static final String EXTEND_M3U8 = ".m3u8";
18 | private static final String EXTEND_TS = ".ts";
19 | private static final String EXTEND_MP4 = ".mp4";
20 | private static final String EXTEND_MP3 = ".mp3";
21 | private static final String EXTEND_WAV = ".wav";
22 | private static final String EXTEND_SRT = ".srt";
23 |
24 | /**
25 | * 创建目录
26 | *
27 | * @param path
28 | * @return
29 | */
30 | public static boolean createDirectory(String path) {
31 | if (StringUtils.isNotEmpty(path)) {
32 | return createDirectory(new File(path));
33 | }
34 | return false;
35 | }
36 |
37 | /**
38 | * 创建目录
39 | *
40 | * @param path
41 | * @return
42 | */
43 | public static boolean createDirectory(File path) {
44 | if (path.exists()) {
45 | return path.isDirectory();
46 | } else {
47 | return path.mkdirs();
48 | }
49 | }
50 |
51 | /**
52 | * 获得文件名
53 | *
54 | * @param file
55 | * @return
56 | */
57 | public static String getFileName(File file) {
58 | if (file != null && file.exists() && file.isFile()) {
59 | if (file.getName().lastIndexOf(".") > 0)
60 | return file.getName().substring(0, file.getName().lastIndexOf(".")).toLowerCase();
61 | else
62 | return file.getName();
63 | }
64 | return null;
65 | }
66 |
67 | /**
68 | * 获得文件扩展名
69 | *
70 | * @param file
71 | * @return
72 | */
73 | public static String getFileExtend(File file) {
74 | if (file != null && file.exists() && file.isFile() && file.getName().lastIndexOf(".") > 0) {
75 | return file.getName().substring(file.getName().lastIndexOf(".") + 1).toLowerCase();
76 | }
77 | return null;
78 | }
79 |
80 | public static String txt2String(File file){
81 | StringBuilder result = new StringBuilder();
82 | try{
83 | BufferedReader br = new BufferedReader(new FileReader(file));//构造一个BufferedReader类来读取文件
84 | String s = null;
85 | while((s = br.readLine())!=null){//使用readLine方法,一次读一行
86 | result.append(System.lineSeparator()+s);
87 | }
88 | br.close();
89 | }catch(Exception e){
90 | e.printStackTrace();
91 | }
92 | return result.toString();
93 | }
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/src/main/java/com/zimujiang/tinyclip/utils/Test.java:
--------------------------------------------------------------------------------
1 | package com.zimujiang.tinyclip.utils;
2 |
3 | import org.bytedeco.javacpp.Loader;
4 |
5 | import java.io.BufferedReader;
6 | import java.io.IOException;
7 | import java.io.InputStreamReader;
8 | import java.nio.charset.StandardCharsets;
9 |
10 | public class Test {
11 | public static void main(String[] args){
12 |
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/resources/css/Main.css:
--------------------------------------------------------------------------------
1 | .root {
2 | }
3 |
--------------------------------------------------------------------------------
/src/main/resources/fxml/Main.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/src/main/resources/fxml/subtitleConvert.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/main/resources/icon/TinyClip.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zimujiang/TinyClip/3cc95f358457a0568e7bd225dacb600a20c2ef22/src/main/resources/icon/TinyClip.icns
--------------------------------------------------------------------------------
/src/main/resources/icon/TinyClip.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zimujiang/TinyClip/3cc95f358457a0568e7bd225dacb600a20c2ef22/src/main/resources/icon/TinyClip.ico
--------------------------------------------------------------------------------
/src/main/resources/icon/TinyClip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zimujiang/TinyClip/3cc95f358457a0568e7bd225dacb600a20c2ef22/src/main/resources/icon/TinyClip.png
--------------------------------------------------------------------------------
/src/main/resources/icon/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zimujiang/TinyClip/3cc95f358457a0568e7bd225dacb600a20c2ef22/src/main/resources/icon/loading.gif
--------------------------------------------------------------------------------