4141
4242# Variable
4343console = Console ()
44+ extension_output = config_manager .get ("M3U8_CONVERSION" , "extension" )
4445
4546
4647class DASH_Downloader :
@@ -303,7 +304,7 @@ def download_and_decrypt(self, custom_headers=None, custom_payload=None):
303304 self .current_download_type = None
304305
305306 # Decrypt video
306- decrypted_path = os .path .join (self .decrypted_dir , "video.mp4 " )
307+ decrypted_path = os .path .join (self .decrypted_dir , f "video.{ extension_output } " )
307308 result_path = decrypt_with_mp4decrypt (
308309 "Video" , encrypted_path , KID , KEY , output_path = decrypted_path
309310 )
@@ -360,7 +361,7 @@ def download_and_decrypt(self, custom_headers=None, custom_payload=None):
360361 self .current_download_type = None
361362
362363 # Decrypt audio
363- decrypted_path = os .path .join (self .decrypted_dir , "audio.mp4 " )
364+ decrypted_path = os .path .join (self .decrypted_dir , f "audio.{ extension_output } " )
364365 result_path = decrypt_with_mp4decrypt (
365366 f"Audio { audio_language } " , encrypted_path , KID , KEY , output_path = decrypted_path
366367 )
@@ -436,7 +437,7 @@ def download_segments(self, clear=False):
436437 self .current_download_type = None
437438
438439 # NO DECRYPTION: just copy/move to decrypted folder
439- decrypted_path = os .path .join (self .decrypted_dir , "video.mp4 " )
440+ decrypted_path = os .path .join (self .decrypted_dir , f "video.{ extension_output } " )
440441 if os .path .exists (encrypted_path ) and not os .path .exists (decrypted_path ):
441442 shutil .copy2 (encrypted_path , decrypted_path )
442443
@@ -488,7 +489,7 @@ def download_segments(self, clear=False):
488489 self .current_download_type = None
489490
490491 # NO DECRYPTION: just copy/move to decrypted folder
491- decrypted_path = os .path .join (self .decrypted_dir , "audio.mp4 " )
492+ decrypted_path = os .path .join (self .decrypted_dir , f "audio.{ extension_output } " )
492493 if os .path .exists (encrypted_path ) and not os .path .exists (decrypted_path ):
493494 shutil .copy2 (encrypted_path , decrypted_path )
494495
@@ -509,8 +510,8 @@ def finalize_output(self):
509510 return output_file
510511
511512 # Definition of decrypted files
512- video_file = os .path .join (self .decrypted_dir , "video.mp4 " )
513- audio_file = os .path .join (self .decrypted_dir , "audio.mp4 " )
513+ video_file = os .path .join (self .decrypted_dir , f "video.{ extension_output } " )
514+ audio_file = os .path .join (self .decrypted_dir , f "audio.{ extension_output } " )
514515 output_file = self .original_output_path
515516
516517 # Set the output file path for status tracking
@@ -548,7 +549,7 @@ def finalize_output(self):
548549 if existing_sub_tracks :
549550
550551 # Create temporary file for subtitle merge
551- temp_output = output_file .replace ('.mp4 ' , '_temp.mp4 ' )
552+ temp_output = output_file .replace (f'. { extension_output } ' , f '_temp.{ extension_output } ' )
552553
553554 try :
554555 final_file = join_subtitle (
0 commit comments