Added flags for strings to capture specific languages.
This commit is contained in:
		
							parent
							
								
									be2c3c111e
								
							
						
					
					
						commit
						85aa98c620
					
				
					 1 changed files with 29 additions and 6 deletions
				
			
		
							
								
								
									
										35
									
								
								burnSubs
									
										
									
									
									
								
							
							
						
						
									
										35
									
								
								burnSubs
									
										
									
									
									
								
							| 
						 | 
					@ -5,7 +5,7 @@ set -o errexit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
# burnSubs
 | 
					# burnSubs
 | 
				
			||||||
# version 0.10.4
 | 
					# version 0.11.0
 | 
				
			||||||
#################3
 | 
					#################3
 | 
				
			||||||
# Wishlist:
 | 
					# Wishlist:
 | 
				
			||||||
#   queue encodes
 | 
					#   queue encodes
 | 
				
			||||||
| 
						 | 
					@ -23,6 +23,7 @@ function machineSetup() {
 | 
				
			||||||
	export FF_HW=""
 | 
						export FF_HW=""
 | 
				
			||||||
	export FILT_PFX=""
 | 
						export FILT_PFX=""
 | 
				
			||||||
	export FILT_SFX=""
 | 
						export FILT_SFX=""
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	CRF=${OPTS_CRF:-23}
 | 
						CRF=${OPTS_CRF:-23}
 | 
				
			||||||
	export FF_STD="-preset myTranscoderPreset -crf $CRF -tune animation \
 | 
						export FF_STD="-preset myTranscoderPreset -crf $CRF -tune animation \
 | 
				
			||||||
		-preset medium -movflags +faststart"
 | 
							-preset medium -movflags +faststart"
 | 
				
			||||||
| 
						 | 
					@ -341,7 +342,8 @@ function selectSubs() {
 | 
				
			||||||
		export SUBTITLE_INDEX=-1
 | 
							export SUBTITLE_INDEX=-1
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		if [[ $OPTS_SELSUB -lt 0 && $SUB_COUNT -gt 1 ]]; then
 | 
							if [[ $OPTS_SELSUB -lt 0 && $SUB_COUNT -gt 1 ]]; then
 | 
				
			||||||
			LANG_TEST=$($JQ '[.[].lang] | index("eng")' "$STREAMS_SUB")
 | 
								OPTS_SELSUB_LANG="${OPTS_SELSUB_LANG:-eng}"
 | 
				
			||||||
 | 
								LANG_TEST=$($JQ '[.[].lang] | index("'${OPTS_SELSUB_LANG}'")' "$STREAMS_SUB")
 | 
				
			||||||
			echo "   > WARNING: Multiple subtitles!"
 | 
								echo "   > WARNING: Multiple subtitles!"
 | 
				
			||||||
			printf "       Using default selection rules... "
 | 
								printf "       Using default selection rules... "
 | 
				
			||||||
			if [[ "$LANG_TEST" == "null" ]]; then
 | 
								if [[ "$LANG_TEST" == "null" ]]; then
 | 
				
			||||||
| 
						 | 
					@ -367,7 +369,8 @@ function selectSubs() {
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if [[ $AUDIO_COUNT -gt 1 ]]; then
 | 
						if [[ $AUDIO_COUNT -gt 1 ]]; then
 | 
				
			||||||
		if [[ $OPTS_SELAUDIO -lt 0 ]]; then
 | 
							if [[ $OPTS_SELAUDIO -lt 0 ]]; then
 | 
				
			||||||
			LANG_TEST=$($JQ '[.[].lang] | index("jpn")' "$STREAMS_AUDIO")
 | 
								OPTS_SELAUDIO_LANG="${OPTS_SELAUDIO_LANG:-jpn}"
 | 
				
			||||||
 | 
								LANG_TEST=$($JQ '[.[].lang] | index("'${OPTS_SELAUDIO_LANG}'")' "$STREAMS_AUDIO")
 | 
				
			||||||
			echo "   > WARNING: Multiple audio streams!"
 | 
								echo "   > WARNING: Multiple audio streams!"
 | 
				
			||||||
			printf "       Using default selection rules... "
 | 
								printf "       Using default selection rules... "
 | 
				
			||||||
			if [[ "$LANG_TEST" == "null" ]]; then
 | 
								if [[ "$LANG_TEST" == "null" ]]; then
 | 
				
			||||||
| 
						 | 
					@ -493,7 +496,7 @@ FINAL_STATUS=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
######
 | 
					######
 | 
				
			||||||
# Reformat and organize the input strings
 | 
					# Reformat and organize the input strings
 | 
				
			||||||
OPT_STRING=$(getopt -o 'hkls:dt:' --long 'help,psoft,soft,dry,crf:,audio,audiofix' -- "$@")
 | 
					OPT_STRING=$(getopt -o 'hkls:dt:' --long 'help,psoft,soft,dry,crf:,audio,audiofix,alocale:,slocale:' -- "$@")
 | 
				
			||||||
# reassign them as positional arguments
 | 
					# reassign them as positional arguments
 | 
				
			||||||
eval set -- "$OPT_STRING"
 | 
					eval set -- "$OPT_STRING"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -526,6 +529,14 @@ while true; do
 | 
				
			||||||
			shift 2
 | 
								shift 2
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
 | 
							"--slocale")
 | 
				
			||||||
 | 
								OPTS_SELSUB_LANG="$2"
 | 
				
			||||||
 | 
								#TODO: verify legal subtitle track number convention"
 | 
				
			||||||
 | 
								echo "TODO: verify legal subtitle track number convention" 
 | 
				
			||||||
 | 
								echo ">> !! Selecting subtitle track #${OPTS_SELSUB_LANG}"
 | 
				
			||||||
 | 
								shift 2
 | 
				
			||||||
 | 
								continue
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
		"-a")
 | 
							"-a")
 | 
				
			||||||
			OPTS_SELAUDIO="$2"
 | 
								OPTS_SELAUDIO="$2"
 | 
				
			||||||
			#TODO: verify legal subtitle track number convention"
 | 
								#TODO: verify legal subtitle track number convention"
 | 
				
			||||||
| 
						 | 
					@ -534,6 +545,14 @@ while true; do
 | 
				
			||||||
			shift 2
 | 
								shift 2
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
 | 
							"--alocale")
 | 
				
			||||||
 | 
								OPTS_SELAUDIO_LANG="$2"
 | 
				
			||||||
 | 
								#TODO: verify legal subtitle track number convention"
 | 
				
			||||||
 | 
								echo "TODO: verify legal audio track number convention" 
 | 
				
			||||||
 | 
								echo ">> !! Selecting audio track with locale #${OPTS_SELAUDIO_LANG}"
 | 
				
			||||||
 | 
								shift 2
 | 
				
			||||||
 | 
								continue
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
		"--psoft")
 | 
							"--psoft")
 | 
				
			||||||
			OPTS_FORCEPARTSOFT=true
 | 
								OPTS_FORCEPARTSOFT=true
 | 
				
			||||||
			echo ">> !! forcing software encoding."
 | 
								echo ">> !! forcing software encoding."
 | 
				
			||||||
| 
						 | 
					@ -601,8 +620,12 @@ while true; do
 | 
				
			||||||
    -l          list subtitles and audio tracks (no encoding)
 | 
					    -l          list subtitles and audio tracks (no encoding)
 | 
				
			||||||
    -s <#>      select specific subtitle track number
 | 
					    -s <#>      select specific subtitle track number
 | 
				
			||||||
                #TODO: verify legal subtitle track number convention
 | 
					                #TODO: verify legal subtitle track number convention
 | 
				
			||||||
    -a <#>      select specific subtitle track number
 | 
					    -a <#>      select specific audio track number
 | 
				
			||||||
                #TODO: verify legal subtitle track number convention
 | 
					                #TODO: verify legal audio track number convention
 | 
				
			||||||
 | 
					    --slocale 'eng'     select specific subtitle track number
 | 
				
			||||||
 | 
					                        #TODO: verify legal subtitle track number convention
 | 
				
			||||||
 | 
					    --alocale 'jpn'     select specific audio track number
 | 
				
			||||||
 | 
					                        #TODO: verify legal audio track number convention
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    -d          debug (no cleanup)
 | 
					    -d          debug (no cleanup)
 | 
				
			||||||
    --dry       dry run (no encoding)
 | 
					    --dry       dry run (no encoding)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue