@@ -441,6 +441,7 @@ async fn start_download(
441441 ffmpeg_path,
442442 "--merge-output-format" . to_string( ) ,
443443 "mp4" . to_string( ) ,
444+ "--embed-thumbnail" . to_string( ) ,
444445 "--no-keep-fragments" . to_string( ) ,
445446 "-P" . to_string( ) ,
446447 home_path,
@@ -489,6 +490,9 @@ async fn start_download(
489490 args. push ( "--write-subs" . to_string ( ) ) ;
490491 args. push ( "--write-auto-sub" . to_string ( ) ) ;
491492 args. push ( "--embed-subs" . to_string ( ) ) ;
493+ // Remove subtitle sidecars after embedding to avoid .vtt file clutter.
494+ args. push ( "--compat-options" . to_string ( ) ) ;
495+ args. push ( "no-keep-subs" . to_string ( ) ) ;
492496 args. push ( "--sub-langs" . to_string ( ) ) ;
493497 // Limit subtitle downloads to English variants to avoid fetching dozens of auto-translated tracks.
494498 args. push ( "en.*,en,-live_chat" . to_string ( ) ) ;
@@ -984,14 +988,45 @@ async fn update_ytdlp(app: AppHandle) -> Result<String, String> {
984988 Ok ( new_version)
985989}
986990
991+ #[ tauri:: command]
992+ async fn open_folder ( path : String ) -> Result < ( ) , String > {
993+ #[ cfg( target_os = "windows" ) ]
994+ {
995+ // Normalize: replace forward slashes with backslashes and strip any trailing separator
996+ let normalized = path. replace ( '/' , "\\ " ) ;
997+ let normalized = normalized. trim_end_matches ( '\\' ) ;
998+ tokio:: process:: Command :: new ( "explorer.exe" )
999+ . arg ( normalized)
1000+ . spawn ( )
1001+ . map_err ( |e| e. to_string ( ) ) ?;
1002+ return Ok ( ( ) ) ;
1003+ }
1004+ #[ cfg( target_os = "macos" ) ]
1005+ {
1006+ tokio:: process:: Command :: new ( "open" )
1007+ . arg ( & path)
1008+ . spawn ( )
1009+ . map_err ( |e| e. to_string ( ) ) ?;
1010+ return Ok ( ( ) ) ;
1011+ }
1012+ #[ cfg( target_os = "linux" ) ]
1013+ {
1014+ tokio:: process:: Command :: new ( "xdg-open" )
1015+ . arg ( & path)
1016+ . spawn ( )
1017+ . map_err ( |e| e. to_string ( ) ) ?;
1018+ return Ok ( ( ) ) ;
1019+ }
1020+ }
1021+
9871022#[ cfg_attr( mobile, tauri:: mobile_entry_point) ]
9881023pub fn run ( ) {
9891024 tauri:: Builder :: default ( )
9901025 . plugin ( tauri_plugin_shell:: init ( ) )
9911026 . plugin ( tauri_plugin_dialog:: init ( ) )
9921027 . plugin ( tauri_plugin_fs:: init ( ) )
9931028 . plugin ( tauri_plugin_opener:: init ( ) )
994- . invoke_handler ( tauri:: generate_handler![ start_download, fetch_formats, fetch_playlist_info, cancel_download, check_ytdlp_update, update_ytdlp] )
1029+ . invoke_handler ( tauri:: generate_handler![ start_download, fetch_formats, fetch_playlist_info, cancel_download, check_ytdlp_update, update_ytdlp, open_folder ] )
9951030 . run ( tauri:: generate_context!( ) )
9961031 . expect ( "error while running tauri application" ) ;
9971032}
0 commit comments