@@ -500,25 +500,26 @@ void RunMediaInfoAsync()
500500 string mediaInfoPath = "MediaInfo.exe" ;
501501 for ( int i = 0 ; i < dataGridView1 . Rows . Count ; i ++ )
502502 {
503- status ( $ "Отримання інформації про формат ({ i } /{ dataGridView1 . Rows . Count } ) ...") ;
504- buttonsActive ( false ) ;
505- if ( dataGridView1 . Rows [ i ] . IsNewRow )
506- continue ;
507- string fileCurrentFormat = dataGridView1 . Rows [ i ] . Cells [ "ColumnFileFormat" ] . Value . ToString ( ) ; // Читання значення
508- if ( ! fileCurrentFormat . Equals ( FORMAT_PENDING ) )
509- continue ;
510- string fileName = dataGridView1 . Rows [ i ] . Cells [ "ColumnFileName" ] . Value . ToString ( ) ;
511- string filePath = dataGridView1 . Rows [ i ] . Cells [ "ColumnFilePath" ] . Value . ToString ( ) ;
512- string fileFormat = FORMAT_UNKNOWN ;
513- string fileBitrate = "0" ;
514- string fileResolution = "0x0x0" ;
503+ string fileName = "" ;
515504 try
516505 {
506+ status ( $ "Отримання інформації про формат ({ i } /{ dataGridView1 . Rows . Count } ) ...") ;
507+ buttonsActive ( false ) ;
508+ if ( dataGridView1 . Rows [ i ] . IsNewRow )
509+ continue ;
510+ string fileCurrentFormat = dataGridView1 . Rows [ i ] . Cells [ "ColumnFileFormat" ] . Value . ToString ( ) ; // Читання значення
511+ if ( ! fileCurrentFormat . Equals ( FORMAT_PENDING ) )
512+ continue ;
513+ fileName = dataGridView1 . Rows [ i ] . Cells [ "ColumnFileName" ] . Value . ToString ( ) ;
514+ string filePath = dataGridView1 . Rows [ i ] . Cells [ "ColumnFilePath" ] . Value . ToString ( ) ;
515+ string fileFormat = FORMAT_UNKNOWN ;
516+ string fileBitrate = "0" ;
517+ string fileResolution = "0x0x0" ;
517518 //get format, bitrate, resolution
518519 ProcessStartInfo processStartInfo = new ProcessStartInfo
519520 {
520521 FileName = mediaInfoPath , // Вказуємо шлях до MediaInfo.exe
521- Arguments = $ "--Inform=\" Video;%Format%|%BitRate%|%Width%x%Height%x%Rotation%\" \" { filePath } \" ", // Отримуємо формат
522+ Arguments = $ "--Inform=\" Video;%Format%|%BitRate%|%Width%x%Height%x%Rotation%| \" \" { filePath } \" ", // Отримуємо формат
522523 RedirectStandardOutput = true , // Перехоплюємо вивід
523524 UseShellExecute = false , // Не використовуємо оболонку
524525 CreateNoWindow = true // Не показуємо вікно
@@ -916,26 +917,27 @@ private void runConvertAsync(int crf, string preset, bool reduceFramerate, int r
916917 buttonsActive ( false ) ;
917918 for ( int i = 0 ; ! stop && i < dataGridView1 . Rows . Count ; i ++ )
918919 {
919- if ( dataGridView1 . Rows [ i ] . IsNewRow )
920- continue ;
921- string fileCurrentStatus = dataGridView1 . Rows [ i ] . Cells [ "ColumnFileStatus" ] . Value . ToString ( ) ;
922- if ( ! fileCurrentStatus . Equals ( STATUS_WAITING ) && ! fileCurrentStatus . Equals ( STATUS_ERROR ) )
923- continue ;
924- updateStatusInDataGrid ( i , STATUS_PROCESSING , STATUS_PROCESSING_COLOR , "" ) ;
925-
926-
927-
928- string fileName = dataGridView1 . Rows [ i ] . Cells [ "ColumnFileName" ] . Value . ToString ( ) ;
929- string filePath = dataGridView1 . Rows [ i ] . Cells [ "ColumnFilePath" ] . Value . ToString ( ) ;
930- string fileResolution = dataGridView1 . Rows [ i ] . Cells [ "ColumnFileResolution" ] . Value . ToString ( ) ;
931- string [ ] resolutionParts = fileResolution . Split ( 'x' ) ; //1920x1080x90
932- int width = int . Parse ( resolutionParts [ 0 ] ) ; // 1920
933- int height = int . Parse ( resolutionParts [ 1 ] ) ; // 1080
934- int rotation = int . Parse ( resolutionParts [ 2 ] ) ; // 0 90 180 270
935- float smallerSide = Math . Min ( width , height ) ;
936- log ( $ "Стиснення файлу: { fileName } ") ;
920+ string fileName = "" ;
937921 try
938922 {
923+ if ( dataGridView1 . Rows [ i ] . IsNewRow )
924+ continue ;
925+ string fileCurrentStatus = dataGridView1 . Rows [ i ] . Cells [ "ColumnFileStatus" ] . Value . ToString ( ) ;
926+ if ( ! fileCurrentStatus . Equals ( STATUS_WAITING ) && ! fileCurrentStatus . Equals ( STATUS_ERROR ) )
927+ continue ;
928+ updateStatusInDataGrid ( i , STATUS_PROCESSING , STATUS_PROCESSING_COLOR , "" ) ;
929+
930+
931+
932+ fileName = dataGridView1 . Rows [ i ] . Cells [ "ColumnFileName" ] . Value . ToString ( ) ;
933+ string filePath = dataGridView1 . Rows [ i ] . Cells [ "ColumnFilePath" ] . Value . ToString ( ) ;
934+ string fileResolution = dataGridView1 . Rows [ i ] . Cells [ "ColumnFileResolution" ] . Value . ToString ( ) ;
935+ string [ ] resolutionParts = fileResolution . Split ( 'x' ) ; //1920x1080x90
936+ int width = int . Parse ( resolutionParts [ 0 ] ) ; // 1920
937+ int height = int . Parse ( resolutionParts [ 1 ] ) ; // 1080
938+ int rotation = int . Parse ( resolutionParts [ 2 ] ) ; // 0 90 180 270
939+ float smallerSide = Math . Min ( width , height ) ;
940+ log ( $ "Стиснення файлу: { fileName } ") ;
939941 //Підготувати файл до стиснення
940942 File . Delete ( tmpfile ) ;
941943
@@ -1412,7 +1414,7 @@ private void buttonExit_Click(object sender, EventArgs e)
14121414
14131415 private void buttonAbout_Click ( object sender , EventArgs e )
14141416 {
1415- string description = "FP AutoVideoConverter 2.4 " +
1417+ string description = "FP AutoVideoConverter 2.5 " +
14161418 "\n " +
14171419 "\n Ця програма дозволяє автоматизувати процес стиснення відеофайлів у кодек H.265 (HEVC), " +
14181420 "надаючи зручний інтерфейс для пакетного стиснення великої кількості відео." +
@@ -1550,4 +1552,9 @@ private void buttonHelpTerminal_Click(object sender, EventArgs e)
15501552- Додано відповідні аргументи для налаштування частоти стиснення
15511553- Додано виведення в заголовок вікна часу роботи програми
15521554- Оновлено документацію
1555+
1556+ 2.5
1557+ - Заповнено інформацію про файл
1558+ - Допрацьована обробка помилок - програма не вилітає якщо помилка обробки файлу
1559+ - Допрацьовано отримання формату файлу - не виникає помилки якщо в відео файлі присутні кілька потоків відео
15531560 */
0 commit comments