mirror of
				https://github.com/devine-dl/devine.git
				synced 2025-11-04 03:44:49 +00:00 
			
		
		
		
	Use same output subtitle format as input codec to SubtitleEdit calls
This commit is contained in:
		
							parent
							
								
									7cc7227f8c
								
							
						
					
					
						commit
						e7e18a4204
					
				@ -358,10 +358,16 @@ class Subtitle(Track):
 | 
			
		||||
 | 
			
		||||
        executable = get_binary_path("SubtitleEdit")
 | 
			
		||||
        if executable:
 | 
			
		||||
            if self.codec == Subtitle.Codec.SubStationAlphav4:
 | 
			
		||||
                output_format = "AdvancedSubStationAlpha"
 | 
			
		||||
            elif self.codec == Subtitle.Codec.TimedTextMarkupLang:
 | 
			
		||||
                output_format = "TimedText1.0"
 | 
			
		||||
            else:
 | 
			
		||||
                output_format = self.codec.name
 | 
			
		||||
            subprocess.run(
 | 
			
		||||
                [
 | 
			
		||||
                    executable,
 | 
			
		||||
                    "/Convert", self.path, "srt",
 | 
			
		||||
                    "/Convert", self.path, output_format,
 | 
			
		||||
                    "/encoding:utf8",
 | 
			
		||||
                    "/overwrite",
 | 
			
		||||
                    "/RemoveTextForHI"
 | 
			
		||||
@ -393,10 +399,17 @@ class Subtitle(Track):
 | 
			
		||||
        if not executable:
 | 
			
		||||
            raise EnvironmentError("SubtitleEdit executable not found...")
 | 
			
		||||
 | 
			
		||||
        if self.codec == Subtitle.Codec.SubStationAlphav4:
 | 
			
		||||
            output_format = "AdvancedSubStationAlpha"
 | 
			
		||||
        elif self.codec == Subtitle.Codec.TimedTextMarkupLang:
 | 
			
		||||
            output_format = "TimedText1.0"
 | 
			
		||||
        else:
 | 
			
		||||
            output_format = self.codec.name
 | 
			
		||||
 | 
			
		||||
        subprocess.run(
 | 
			
		||||
            [
 | 
			
		||||
                executable,
 | 
			
		||||
                "/Convert", self.path, "srt",
 | 
			
		||||
                "/Convert", self.path, output_format,
 | 
			
		||||
                "/ReverseRtlStartEnd",
 | 
			
		||||
                "/encoding:utf8",
 | 
			
		||||
                "/overwrite"
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user