1616import javax .swing .JTabbedPane ;
1717import javax .swing .UIManager ;
1818
19- import nicelee .bilibili .INeedAV ;
2019import nicelee .bilibili .INeedLogin ;
2120import nicelee .bilibili .PackageScanLoader ;
22- import nicelee .bilibili .model .VideoInfo ;
2321import nicelee .bilibili .util .CmdUtil ;
2422import nicelee .bilibili .util .ConfigUtil ;
2523import nicelee .bilibili .util .HttpCookies ;
26- import nicelee .bilibili .util .Logger ;
2724import nicelee .bilibili .util .RepoUtil ;
2825import nicelee .bilibili .util .ResourcesUtil ;
2926import nicelee .bilibili .util .SysUtil ;
3027import nicelee .ui .item .MJTitleBar ;
3128import nicelee .ui .thread .BatchDownloadRbyRThread ;
3229import nicelee .ui .thread .CookieRefreshThread ;
33- import nicelee .ui .thread .DownloadRunnable ;
3430import nicelee .ui .thread .LoginThread ;
3531import nicelee .ui .thread .MonitoringThread ;
3632
@@ -46,7 +42,7 @@ public class FrameMain extends JFrame {
4642 public static void main (String [] args ) {
4743 System .out .println ();
4844 // System.getProperties().setProperty("file.encoding", "utf-8");
49- boolean isFFmpegSurported = SysUtil .surportFFmpegOfficially ();
45+ boolean isFFmpegSupported = SysUtil .surportFFmpegOfficially ();
5046 System .out .println ("Java version:" + System .getProperty ("java.specification.version" ));
5147 System .out .println (ResourcesUtil .baseDirectory ());
5248 // 读取配置文件
@@ -56,6 +52,8 @@ public static void main(String[] args) {
5652 System .out .println (Global .version );
5753 System .exit (0 );
5854 }
55+ // 初始化 - 检查对数据文件夹是否有“写”的权限
56+ InitCheck .checkFileAccess ();
5957 // 显示过渡动画
6058 Global .frWaiting = new FrameWaiting ();
6159 Global .frWaiting .start ();
@@ -79,7 +77,6 @@ public static void main(String[] args) {
7977// }
8078 // 初始化主题
8179 initUITheme ();
82-
8380 // 初始化UI
8481 FrameMain main = new FrameMain ();
8582 main .InitUI ();
@@ -110,28 +107,7 @@ public static void main(String[] args) {
110107 loginTh .start ();
111108
112109 // 初始化 - ffmpeg环境判断
113- CmdUtil .DEFAULT_WORKING_DIR = ResourcesUtil .baseDirFile ();
114- String ffmpeg = ResourcesUtil .resolve (Global .ffmpegPath );
115- String [] cmd = new String [] { ffmpeg , "-version" };
116- if (!CmdUtil .run (cmd )) {
117- if (isFFmpegSurported ) {
118- Object [] options = { "是" , "否" };
119- int m = JOptionPane .showOptionDialog (null ,
120- "检测到当前没有ffmpeg环境, mp4及小部分flv文件将无法转码或合并.\r \n 是否下载ffmpeg(自编译, 3M左右)?" , "请选择:" ,
121- JOptionPane .YES_NO_OPTION , JOptionPane .PLAIN_MESSAGE , null , options , options [0 ]);
122- Logger .println (m );
123- if (m == 0 ) {
124- VideoInfo avInfo = new INeedAV ().getVideoDetail ("ffmpeg" , 0 , false );
125- DownloadRunnable downThread = new DownloadRunnable (avInfo , avInfo .getClips ().get (1234L ), 0 );
126- Global .queryThreadPool .execute (downThread );
127- }
128- } else {
129- JOptionPane .showMessageDialog (null , "当前没有ffmpeg环境,大部分mp4及小部分flv文件将无法转码或合并" , "请注意!!" ,
130- JOptionPane .WARNING_MESSAGE );
131- }
132- } else {
133- CmdUtil .FFMPEG_PATH = ffmpeg ;
134- }
110+ InitCheck .checkFFmpeg (isFFmpegSupported );
135111
136112 //
137113 if (Global .saveToRepo ) {
0 commit comments