See changelog :
- Done Internal Subtitles part - Ajout d'une variable pour préciser le type de média (avec séparation du renommage année, et dots) - Ajout de texte récapitulatif des langues inscrites (et des noms de piste) dans le fichier final - Fix sur la détection des sous-titres internes - Ajout de la gestion d'une recherche dans le titre des sous-titres pour identifier une piste SDH quand il y a plusieurs pistes de la même langue. - Amélioration de l'affichage du récapitulatif des langues détectées et récupérées. - Petites modifications/corrections
This commit is contained in:
		| @@ -23,7 +23,7 @@ | ||||
| ##                        externe, et seulement la vidéo du second MKV                        ## | ||||
| ##                                                                                            ## | ||||
| ##============================================================================================== | ||||
| #         Pour ONE PIECE !!!! | ||||
|  | ||||
| # ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||||
| # │ - MKV1 : file to keep with 2 audio, 1 internal SRT, DROP the video (720p)                                            │ | ||||
| # │ - MKV2 : file to keep with only the video 1080p !                                                                    │ | ||||
| @@ -123,27 +123,34 @@ Invoke-Command -ScriptBlock { | ||||
|     $Internal_SUB_Lang_3 = "fr"         # Set here the third internal subtitle lang to keep | ||||
|  | ||||
|     # If there is 2 sub in the same language, like "FR Full" and "FR Forced", set those variables : | ||||
|     $Internal_SUB_to_separate = $false      # Set this to $true if there is at least 2 internal sub in the same lang | ||||
|     $Internal_SUB_1_title_to_search = "FR"    # Set this to a string to search in sub title to set it into the first internal sub | ||||
|     $Internal_SUB_to_search_with_title = $false      # Set this to $true if there is at least 2 internal sub in the same lang | ||||
|     $Internal_SUB_1_title_to_search = "SDH"    # Set this to a string to search in sub title to set it into the first internal sub | ||||
|     $Internal_SUB_2_title_to_search = ""    # Set this to a string to search in subtitle TITLE to set it into the second internal sub | ||||
|     $Internal_SUB_2_title_to_search = ""    # Set this to a string to search in subtitle TITLE to set it into the third internal sub | ||||
|     $Internal_SUB_to_be_forced = ""         # Set this to 1 or 2 in order to set it to forced subtitle | ||||
|  | ||||
|     # Max 3 Internal SRT is configured in the script. | ||||
|     # If set to 3, must be 2 SRT configured  | ||||
|     $SubTrackName_1_sansID = "Français - SRT" | ||||
|     $SubTrackLang_1_sansID = "fr"              # en for english / fr for french / jp for japanese | ||||
|     $SubTrackName_1_sansID = "English SDH - SRT" | ||||
|     $SubTrackLang_1_sansID = "en"              # en for english / fr for french / jp for japanese | ||||
|     $SubTrack_1_default_sansID = "yes" | ||||
|     $SubTrack_1_forced_track_sansID = "no" | ||||
|     $SubTrack_1_SDH_sansID = "yes" | ||||
|     $sub_charset_1_sansID = "UTF-8" | ||||
|      | ||||
|  | ||||
|     $SubTrackName_2_sansID = "Français - SRT" | ||||
|     $SubTrackLang_2_sansID = "fr"              # en for english / fr for french / jp for japanese | ||||
|     $SubTrack_2_default_sansID = "no" | ||||
|     $SubTrack_2_forced_track_sansID = "no" | ||||
|     $SubTrack_2_SDH_sansID = "no" | ||||
|     $sub_charset_2_sansID = "UTF-8" | ||||
|  | ||||
|     $SubTrackName_3_sansID = "Français - SRT" | ||||
|     $SubTrackLang_3_sansID = "fr"              # en for english / fr for french / jp for japanese | ||||
|     $SubTrack_3_default_sansID = "no" | ||||
|     $SubTrack_3_forced_track_sansID = "no" | ||||
|     $SubTrack_3_SDH_sansID = "no" | ||||
|     $sub_charset_3_sansID = "UTF-8" | ||||
|     # =========================================== | ||||
|  | ||||
| @@ -199,6 +206,10 @@ Invoke-Command -ScriptBlock { | ||||
|             [Parameter(Mandatory)]$Internal_SUB_Lang_1, | ||||
|             [Parameter(Mandatory)]$Internal_SUB_Lang_2, | ||||
|             [Parameter(Mandatory)]$Internal_SUB_Lang_3, | ||||
|             [Parameter(Mandatory)][ValidateSet($true, $false)]$Internal_SUB_to_search_with_title, | ||||
|             [Parameter(Mandatory)]$Internal_SUB_1_title_to_search = "", | ||||
|             [Parameter(Mandatory)]$Internal_SUB_2_title_to_search = "", | ||||
|             [Parameter(Mandatory)]$Internal_SUB_3_title_to_search = "", | ||||
|             [Parameter(Mandatory = $false)][ValidateSet($true, $false)]$JSON_Export = $false, | ||||
|             [Parameter(Mandatory = $false)]$JSON_file = "" | ||||
|         ) | ||||
| @@ -261,7 +272,7 @@ Invoke-Command -ScriptBlock { | ||||
|                 Write-Host "`tThere is a problem in Video Track detection from JSON !! Need to debug this !!" -ForegroundColor "White" -BackgroundColor "DarkRed" | ||||
|                 Exit | ||||
|             } | ||||
|             elseif ( $m -gt $JSON_SubCount ) { | ||||
|             elseif ( ( $m -gt $JSON_SubCount ) -And ( $JSON_SubCount -ne $null ) ) { | ||||
|                 Write-Host "`tThere is a problem in Subtitles Track detection from JSON !! Need to debug this !!" -ForegroundColor "White" -BackgroundColor "DarkRed" | ||||
|                 Exit | ||||
|             } | ||||
| @@ -296,17 +307,17 @@ Invoke-Command -ScriptBlock { | ||||
|             elseif ( $track."@type" -match "Text" ) { | ||||
|                 $m++ | ||||
|                 if ($Internal_SUB_Number -ne 0 ) { | ||||
|                     if (( $Internal_SUB_Lang_1 -ne "" ) -And ( $track."Language" -match "$Internal_SUB_Lang_1" ) -And ( $Internal_Sub_1_ID -eq "" ) -And ( $n -ne $Internal_SUB_Number)) { | ||||
|                     if ( ( $Internal_SUB_Lang_1 -ne "" ) -And ( $track."Language" -match "$Internal_SUB_Lang_1" ) -And ( $Internal_Sub_1_ID -eq "" ) -And ( $n -ne $Internal_SUB_Number ) -And (( $Internal_SUB_to_search_with_title -eq $false ) -OR (( $Internal_SUB_to_search_with_title -eq $true ) -And ( $track.Title -match "$Internal_SUB_1_title_to_search" )) ) ) { | ||||
|                         $Internal_Sub_1_ID = $track.id - 1 | ||||
|                         $n++ | ||||
|                         $JSON_sub_1_position = $l | ||||
|                     } | ||||
|                     elseif (( $Internal_SUB_Lang_2 -ne "" ) -And ( $track."Language" -match "$Internal_SUB_Lang_2" ) -And ( $Internal_Sub_2_ID -eq "" ) -And ( $n -ne $Internal_SUB_Number)) { | ||||
|                     elseif ( ( $Internal_SUB_Lang_2 -ne "" ) -And ( $track."Language" -match "$Internal_SUB_Lang_2" ) -And ( $Internal_Sub_2_ID -eq "" ) -And ( $n -ne $Internal_SUB_Number) -And (( $Internal_SUB_to_search_with_title -eq $false ) -OR (( $Internal_SUB_to_search_with_title -eq $true ) -And ( $track.Title -match "$Internal_SUB_2_title_to_search" )) ) ) { | ||||
|                         $Internal_Sub_2_ID = $track.id - 1 | ||||
|                         $n++ | ||||
|                         $JSON_sub_2_position = $l | ||||
|                     } | ||||
|                     elseif (( $Internal_SUB_Lang_3 -ne "" ) -And ( $track."Language" -match "$Internal_SUB_Lang_3" ) -And ( $Internal_Sub_3_ID -eq "" ) -And ( $n -ne $Internal_SUB_Number)) { | ||||
|                     elseif ( ( $Internal_SUB_Lang_3 -ne "" ) -And ( $track."Language" -match "$Internal_SUB_Lang_3" ) -And ( $Internal_Sub_3_ID -eq "" ) -And ( $n -ne $Internal_SUB_Number) -And (( $Internal_SUB_to_search_with_title -eq $false ) -OR (( $Internal_SUB_to_search_with_title -eq $true ) -And ( $track.Title -match "$Internal_SUB_3_title_to_search" )) ) ) { | ||||
|                         $Internal_Sub_3_ID = $track.id - 1 | ||||
|                         $n++ | ||||
|                         $JSON_sub_3_position = $l | ||||
| @@ -383,12 +394,21 @@ Invoke-Command -ScriptBlock { | ||||
|         # } | ||||
|          | ||||
|         Write-Host "`t`$VideoTrack_ID = $VideoTrack_ID" -ForegroundColor "Yellow" | ||||
|         Write-Host "`t`$AudioTrack_1_ID = $AudioTrack_1_ID`tLang set in the script = $AudioTrack_1_Lang" -ForegroundColor "Yellow" | ||||
|         Write-Host "`t`$AudioTrack_2_ID = $AudioTrack_2_ID`tLang set in the script = $AudioTrack_2_Lang" -ForegroundColor "Yellow" | ||||
|         if ($NB_Audio_MKV1 -ge 1) { | ||||
|             Write-Host "`t`$AudioTrack_1_ID = $AudioTrack_1_ID`tLang set in the script = $AudioTrack_1_Lang" -ForegroundColor "Yellow" | ||||
|             if ($NB_Audio_MKV1 -eq 2) { | ||||
|                 Write-Host "`t`$AudioTrack_2_ID = $AudioTrack_2_ID`tLang set in the script = $AudioTrack_2_Lang" -ForegroundColor "Yellow" | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         if ( $Internal_SUB_Number -ne 0 ) { | ||||
|             Write-Host "`t`$Internal_Sub_1_ID = $Internal_Sub_1_ID`tLang set in the script = $Internal_SUB_Lang_1" -ForegroundColor "Yellow" | ||||
|             Write-Host "`t`$Internal_Sub_2_ID = $Internal_Sub_2_ID`tLang set in the script = $Internal_SUB_Lang_2" -ForegroundColor "Yellow" | ||||
|             Write-Host "`t`$Internal_Sub_3_ID = $Internal_Sub_3_ID`tLang set in the script = $Internal_SUB_Lang_3" -ForegroundColor "Yellow"         | ||||
|             Write-Host "`t`$Internal_Sub_1_ID = $Internal_Sub_1_ID`tLang set in the script = $Internal_SUB_Lang_1" ( &{ If ($Internal_SUB_to_search_with_title -eq $true) { "`tSearched Title was : $Internal_SUB_1_title_to_search" } Else { "" } }) -ForegroundColor "Yellow" | ||||
|             if ($Internal_SUB_Number -ge 2) { | ||||
|                 Write-Host "`t`$Internal_Sub_2_ID = $Internal_Sub_2_ID`tLang set in the script = $Internal_SUB_Lang_2" ( &{ If ($Internal_SUB_to_search_with_title -eq $true) { "`tSearched Title was : $Internal_SUB_2_title_to_search" } Else { "" } }) -ForegroundColor "Yellow" | ||||
|                 if ($Internal_SUB_Number -eq 3) { | ||||
|                     Write-Host "`t`$Internal_Sub_3_ID = $Internal_Sub_3_ID`tLang set in the script = $Internal_SUB_Lang_3" ( &{ If ($Internal_SUB_to_search_with_title -eq $true) { "`tSearched Title was : $Internal_SUB_3_title_to_search" } Else { "" } }) -ForegroundColor "Yellow"         | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return $VideoTrack_ID, $AudioTrack_1_ID, $AudioTrack_2_ID, $Internal_Sub_1_ID, $Internal_Sub_2_ID, $Internal_Sub_3_ID | ||||
| @@ -563,10 +583,20 @@ Invoke-Command -ScriptBlock { | ||||
|         # Title for the video track and for the destination file $Output | ||||
|         $VideoTrackName = $MKV_1_name | ||||
|         if ( $set_year_with_brackets -eq $true ) { | ||||
|             $VideoTrackName = $VideoTrackName -replace '(\d{4}(?=.*S\d{2}E\d{2}))', '($1)' | ||||
|             if ( $type_media -eq "movie" ) { | ||||
|                 $VideoTrackName = $VideoTrackName -replace '(\d{4}(?=\..*))', '($1)' | ||||
|             } | ||||
|             elseif ( $type_media -eq "serie" ) { | ||||
|                 $VideoTrackName = $VideoTrackName -replace '(\d{4}(?=.*S\d{2}E\d{2}))', '($1)' | ||||
|             } | ||||
|         } | ||||
|         if ( $remove_dots -eq $true ) { | ||||
|             $VideoTrackName = $VideoTrackName -replace '\.(?=.*S\d{2}E\d{2})', ' ' | ||||
|             if ( $type_media -eq "movie" ) { | ||||
|                 $VideoTrackName = $VideoTrackName -replace '\.(?=.*\d{4})', ' ' | ||||
|             } | ||||
|             elseif ( $type_media -eq "serie" ) { | ||||
|                 $VideoTrackName = $VideoTrackName -replace '\.(?=.*S\d{2}E\d{2})', ' ' | ||||
|             } | ||||
|         } | ||||
|         $VideoTrackName = $VideoTrackName -replace $chain_to_search, $chain__to_replace | ||||
|         $VideoTrackName = "$VideoTrackName" | ||||
| @@ -581,20 +611,31 @@ Invoke-Command -ScriptBlock { | ||||
|         # ################################################################# | ||||
|  | ||||
|         # Now we'll get the track ID for the MKV in action ! | ||||
|         $VideoTrack_ID, $AudioTrack_1_ID, $AudioTrack_2_ID, $Internal_Sub_1_ID, $Internal_Sub_2_ID, $Internal_Sub_3_ID = Get-Track_ID $MediaInfo $MKV_1 $NB_Audio_MKV1 $AudioTrack_1_Lang $AudioTrack_2_Lang $Internal_SUB_Number $Internal_SUB_Lang_1 $Internal_SUB_Lang_2 $Internal_SUB_Lang_3 $JSON_Export $JSON_file | ||||
|         $VideoTrack_ID, $AudioTrack_1_ID, $AudioTrack_2_ID, $Internal_Sub_1_ID, $Internal_Sub_2_ID, $Internal_Sub_3_ID = Get-Track_ID $MediaInfo $MKV_1 $NB_Audio_MKV1 $AudioTrack_1_Lang $AudioTrack_2_Lang $Internal_SUB_Number $Internal_SUB_Lang_1 $Internal_SUB_Lang_2 $Internal_SUB_Lang_3 $Internal_SUB_to_search_with_title $Internal_SUB_1_title_to_search $Internal_SUB_2_title_to_search $Internal_SUB_3_title_to_search $JSON_Export $JSON_file | ||||
|  | ||||
|         # Exception for some files !!! ----------------------------------------------------------------- | ||||
|         if ( $MKV_1_name.Substring(0, 26) -eq "MY_FILE_1" ) { | ||||
|         if ( $MKV_1_name.Substring(0, 26) -eq "One Piece (1999) - S20E001" ) { | ||||
|             $AudioTrack_1_ID = 2        # Manual set for 1st audio track in final MKV | ||||
|             $AudioTrack_2_ID = 1        # Manual set for 2nd audio track in final MKV | ||||
|             Write-Host "`tThis file doesn't have correct track language. We set it to :`n`t`t`$AudioTrack_1_ID = $AudioTrack_1_ID`t for audio lang 1 = $AudioTrack_1_Lang`n`t`t`$AudioTrack_2_ID = $AudioTrack_2_ID." -ForegroundColor "White" -BackgroundColor "DarkRed" | ||||
|         } | ||||
|         # if ( $MKV_1_name.Substring(0, 26) -eq "MY_FILE_3" ) { | ||||
|         # if ( $MKV_1_name.Substring(0, 26) -eq "One Piece (1999) - S18E001" ) { | ||||
|         #     $AudioTrackName_1_sansID = "Japonais - AAC 2.0" | ||||
|         #     $AudioTrackName_2_sansID = "Français - AAC 2.0" | ||||
|         #     Write-Host "`tThis file doesn't have correct track language. We set it to : `$AudioTrack_1_ID = $AudioTrack_1_ID`tand`t`$AudioTrack_2_ID = $AudioTrack_2_ID." | ||||
|         # } | ||||
|          | ||||
|         # if ( $MKV_1_name.Substring(0, 26) -eq "One Piece (1999) - S18E008" ) { | ||||
|         #     $AudioTrack_1_ID = 2 | ||||
|         #     $AudioTrack_2_ID = 1 | ||||
|         #     Write-Host "`tThis file doesn't have correct track language. We set it to : `$AudioTrack_1_ID = $AudioTrack_1_ID`tand`t`$AudioTrack_2_ID = $AudioTrack_2_ID." | ||||
|         # } | ||||
|         # if ( $MKV_1_name.Substring(0, 26) -eq "One Piece (1999) - S18E020" ) { | ||||
|         #     $AudioTrack_1_ID = 2 | ||||
|         #     $AudioTrack_2_ID = 1 | ||||
|         #     Write-Host "`tThis file doesn't have correct track language. We set it to : `$AudioTrack_1_ID = $AudioTrack_1_ID`tand`t`$AudioTrack_2_ID = $AudioTrack_2_ID." | ||||
|         # } | ||||
|  | ||||
|  | ||||
|         # End of Exceptions ---------------------------------------------------------------------------- | ||||
|  | ||||
|         if ( $merge_another_video_MKV2 -eq $false ) { | ||||
| @@ -661,34 +702,48 @@ Invoke-Command -ScriptBlock { | ||||
|  | ||||
|         if ( $Internal_SUB_Number -ne 0 ) {   | ||||
|  | ||||
|             # TO-DO : RE_CHECK THIS PART (for internal SUB) | ||||
|             # Sub n°1 to keep | ||||
|             # Name and language of Subtitle Track n°1 + Sync Value | ||||
|             $SubTrackName_1 = "$Internal_Sub_1_ID" + ":$SubTrackName_1_sansID" | ||||
|             $SubTrackLang_1 = "$Internal_Sub_1_ID" + ":$SubTrackLang_1_sansID" | ||||
|             $SubTrack_1_default = "$Internal_Sub_1_ID" + ":$SubTrack_1_default_sansID" | ||||
|             $SubTrack_1_forced_track = "$Internal_Sub_1_ID" + ":$SubTrack_1_forced_track_sansID" | ||||
|             $SubTrack_1_SDH = "$Internal_Sub_1_ID" + ":$SubTrack_1_SDH_sansID" | ||||
|             $sub_charset_1 = "$Internal_Sub_1_ID" + ":$sub_charset_1_sansID" | ||||
|             # Define track order | ||||
|             $track_order += ",0:$Internal_Sub_1_ID" | ||||
|             $subtitle_tracks = "$Internal_Sub_1_ID" | ||||
|             $MKVMerge_sub_param = "--sub-charset $sub_charset_1 --language $SubTrackLang_1 --track-name `"$SubTrackName_1`" --default-track $SubTrack_1_default --forced-track $SubTrack_1_forced_track --hearing-impaired-flag $SubTrack_1_SDH" | ||||
|  | ||||
|             # if ($sub_id_persistent -eq $false) { | ||||
|             #     $sub_1_id, $sub_2_id = Get-SubID $MKV_1_name | ||||
|             # } | ||||
|             # # Track 2 = Sub n°1 to keep | ||||
|             # # Name and language of Subtitle Track n°1 + Sync Value | ||||
|             # $SubTrackName_1 = $sub_1_id + ":$SubTrackName_1_sansID" | ||||
|             # $SubTrackLang_1 = $sub_1_id + ":$SubTrackLang_1_sansID" | ||||
|             # $SubTrack_1_default = $sub_1_id + ":$SubTrack_1_default_sansID" | ||||
|             # $sub_charset_1 = $sub_1_id + ":$sub_charset_1_sansID" | ||||
|             # # Define track order | ||||
|             # $track_order += ",0:$sub_1_id" | ||||
|             # $subtitle_tracks = "$sub_1_id" | ||||
|             # $MKVMerge_sub_param = "--sub-charset $sub_charset_1 --language $SubTrackLang_1 --track-name `"$SubTrackName_1`" --default-track $SubTrack_1_default" | ||||
|  | ||||
|             # if ( $Internal_SUB_Number -eq 2 ) { | ||||
|             #     # Track 3 = Sub n°2 to keep | ||||
|             #     # Name and language of Subtitle Track n°1 + Sync Value | ||||
|             #     $SubTrackName_2 = $sub_2_id + ":$SubTrackName_2_sansID" | ||||
|             #     $SubTrackLang_2 = $sub_2_id + ":$SubTrackLang_2_sansID" | ||||
|             #     $SubTrack_2_default = $sub_2_id + ":$SubTrack_2_default_sansID" | ||||
|             #     $sub_charset_2 = $sub_2_id + ":$sub_charset_2_sansID" | ||||
|             #     # Define track order | ||||
|             #     $track_order += ",0:$sub_2_id" | ||||
|             #     $subtitle_tracks += ",$sub_2_id" | ||||
|             #     $MKVMerge_sub_param += " --sub-charset $sub_charset_2 --language $SubTrackLang_2 --track-name `"$SubTrackName_2`" --default-track $SubTrack_2_default" | ||||
|             # } | ||||
|             if ( $Internal_SUB_Number -ge 2 ) { | ||||
|                 # Sub n°2 to keep | ||||
|                 # Name and language of Subtitle Track n°1 + Sync Value | ||||
|                 $SubTrackName_2 = "$Internal_Sub_2_ID" + ":$SubTrackName_2_sansID" | ||||
|                 $SubTrackLang_2 = "$Internal_Sub_2_ID" + ":$SubTrackLang_2_sansID" | ||||
|                 $SubTrack_2_default = "$Internal_Sub_2_ID" + ":$SubTrack_2_default_sansID" | ||||
|                 $SubTrack_2_forced_track = "$Internal_Sub_2_ID" + ":$SubTrack_2_forced_track_sansID" | ||||
|                 $SubTrack_2_SDH = "$Internal_Sub_2_ID" + ":$SubTrack_2_SDH_sansID" | ||||
|                 $sub_charset_2 = "$Internal_Sub_2_ID" + ":$sub_charset_2_sansID" | ||||
|                 # Define track order | ||||
|                 $track_order += ",0:$Internal_Sub_2_ID" | ||||
|                 $subtitle_tracks += ",$Internal_Sub_2_ID" | ||||
|                 $MKVMerge_sub_param += " --sub-charset $sub_charset_2 --language $SubTrackLang_2 --track-name `"$SubTrackName_2`" --default-track $SubTrack_2_default --forced-track $SubTrack_2_forced_track --hearing-impaired-flag $SubTrack_2_SDH" | ||||
|             } | ||||
|             if ( $Internal_SUB_Number -eq 3 ) { | ||||
|                 # Sub n°3 to keep | ||||
|                 # Name and language of Subtitle Track n°1 + Sync Value | ||||
|                 $SubTrackName_3 = "$Internal_Sub_3_ID" + ":$SubTrackName_3_sansID" | ||||
|                 $SubTrackLang_3 = "$Internal_Sub_3_ID" + ":$SubTrackLang_3_sansID" | ||||
|                 $SubTrack_3_default = "$Internal_Sub_3_ID" + ":$SubTrack_3_default_sansID" | ||||
|                 $SubTrack_3_forced_track = "$Internal_Sub_3_ID" + ":$SubTrack_3_forced_track_sansID" | ||||
|                 $SubTrack_3_SDH = "$Internal_Sub_3_ID" + ":$SubTrack_3_SDH_sansID" | ||||
|                 $sub_charset_3 = "$Internal_Sub_3_ID" + ":$sub_charset_3_sansID" | ||||
|                 # Define track order | ||||
|                 $track_order += ",0:$Internal_Sub_3_ID" | ||||
|                 $subtitle_tracks += ",$Internal_Sub_3_ID" | ||||
|                 $MKVMerge_sub_param += " --sub-charset $sub_charset_3 --language $SubTrackLang_3 --track-name `"$SubTrackName_3`" --default-track $SubTrack_3_default --forced-track $SubTrack_3_forced_track --hearing-impaired-flag $SubTrack_3_SDH" | ||||
|             } | ||||
|             $subtitle_tracks = "`"$subtitle_tracks`"" | ||||
|         } | ||||
|  | ||||
|         if ( ( $External_SUB_Number -ne 0 ) -and ( $External_SUB -eq $true ) ) { | ||||
| @@ -731,8 +786,8 @@ Invoke-Command -ScriptBlock { | ||||
|             $MKVMerge_param_start += " --no-subtitles" | ||||
|         } | ||||
|         else {             | ||||
|             # TO-DO REWRITE THIS CODE (for internal SUB) | ||||
|             # $MKVMerge_param_start += " --subtitle-tracks $subtitle_tracks" | ||||
|             # Part for internal subtitles | ||||
|             $MKVMerge_param_start += " --subtitle-tracks $subtitle_tracks" | ||||
|         } | ||||
|  | ||||
|  | ||||
| @@ -751,7 +806,8 @@ Invoke-Command -ScriptBlock { | ||||
|         } | ||||
|  | ||||
|         if ( $Internal_SUB_Number -ne 0 ) { | ||||
|             # CODE TO BE written | ||||
|             # Part for internal subtitles | ||||
|             $MKVMerge_param_mkv1 = "$MKVMerge_audio_param $MKVMerge_sub_param `"$MKV_1`"" | ||||
|         } | ||||
|         else { | ||||
|             $MKVMerge_param_mkv1 = "$MKVMerge_audio_param `"$MKV_1`"" | ||||
| @@ -773,6 +829,27 @@ Invoke-Command -ScriptBlock { | ||||
|         # Write-Host "`$MKVMerge_param_start = $MKVMerge_param_start" -ForegroundColor "White" | ||||
|         # Write-Host "`$MKVMerge_param_mkv1 = $MKVMerge_param_mkv1" -ForegroundColor "White" | ||||
|         # Write-Host "`$MKVMerge_param_all = $MKVMerge_param_all" -ForegroundColor "White" | ||||
|         Write-Host "`tRecap. of all language tracks :" -ForegroundColor "Cyan" | ||||
|         Write-Host "`t`t- Video lang will be : $Video_Lang" -ForegroundColor "Cyan" | ||||
|         Write-Host "`t`t- Audio 1 lang will be : $AudioLang_1_sansID`t`tand name = $AudioTrackName_1_sansID" -ForegroundColor "Cyan" | ||||
|         if ($NB_Audio_MKV1 -eq 2) { | ||||
|             Write-Host "`t`t- Audio 2 lang will be : $AudioLang_2_sansID`t`tand name = $AudioTrackName_2_sansID" -ForegroundColor "Cyan" | ||||
|         } | ||||
|         if ($Internal_SUB_Number -ge 1) { | ||||
|             Write-Host "`t`t- Internal Sub 1 lang will be : $SubTrackLang_1_sansID`tand name = $SubTrackName_1_sansID" ( &{ If ( ($SubTrack_1_SDH_sansID -eq "yes") -eq $true) { "`tFlagged with SDH (--hearing-impaired-flag)" } }) -ForegroundColor "Cyan" | ||||
|             if ($Internal_SUB_Number -ge 2) { | ||||
|                 Write-Host "`t`t- Internal Sub 2 lang  will be : $SubTrackLang_2_sansID`tand name = $SubTrackName_2_sansID" ( &{ If ( ($SubTrack_2_SDH_sansID -eq "yes") -eq $true) { "`tFlagged with SDH (--hearing-impaired-flag)" } }) -ForegroundColor "Cyan" | ||||
|                 if ($Internal_SUB_Number -eq 3) { | ||||
|                     Write-Host "`t`t- Internal Sub 3 lang  will be : $SubTrackLang_3_sansID`tand name = $SubTrackName_3_sansID" ( &{ If ( ($SubTrack_3_SDH_sansID -eq "yes") -eq $true) { "`tFlagged with SDH (--hearing-impaired-flag)" } }) -ForegroundColor "Cyan" | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         if ($External_SUB -eq $true) { | ||||
|             Write-Host "`t`t- External Sub 1 lang will be : $($ExtSubTrackLang_1 -replace '0:', '')`tand name = $($ExtSubTrackName_1 -replace '0:', '')" ( &{ If ( ($ExtSub_SDH_1 -match "yes") -eq $true) { "`tFlagged with SDH (--hearing-impaired-flag)" } }) -ForegroundColor "Cyan"  | ||||
|             if ($External_SUB_Number -eq 2) { | ||||
|                 Write-Host "`t`t- External Sub 2 lang will be : $($ExtSubTrackLang_2 -replace '0:', '')`tand name = $($ExtSubTrackName_1 -replace '0:', '')" ( &{ If ( ($ExtSub_SDH_2 -match "yes") -eq $true) { "`tFlagged with SDH (--hearing-impaired-flag)" } }) -ForegroundColor "Cyan"  | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         # Last step to command construction | ||||
|         $command = "& $MKVMerge $MKVMerge_param_all" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user