<job id="svptube">
<script language="JScript">
///////////////////////////////////////
// User defined values
// Folder to put downloaded files in.
// Default value is Downloads folder.
var downloadPath="";
// Path to the video player's executable.
// If empty then use default the video player for MP4 files
var videoPlayerPath="";
// Directory oath of the ffmpeg executable, leave it empty if ffmpeg.exe is in PATH
var ffmpegPath = "C:\ffmpeg";
// Ask if you want to play downloaded video every time
var openAfterDownloading=false;
///////////////////////////////////////
var shell=WScript.CreateObject("WScript.Shell");
if(!downloadPath.length)
    downloadPath = shell.ExpandEnvironmentStrings("%HOMEDRIVE%%HOMEPATH%\\Downloads");
if(!videoPlayerPath.length)
    videoPlayerPath = shell.RegRead("HKCU\\Software\\SVP-Team\\SVPtube\\player_default").split("\"")[1];
var videoURL,audioURL,subsURL;
switch(WScript.Arguments.length)
{
case 6: subsURL =WScript.Arguments(4);
case 4: audioURL=WScript.Arguments(2);
case 2: videoURL=WScript.Arguments(0); break;
default: 
    WScript.Echo("Something is wrong with script argumets ("+
            WScript.Arguments.length+")!");
    WScript.Quit(0)
}
choice=shell.Popup("Play the video (YES) or save it (NO)?",0,"SVPtube",4+32);
if(choice<0) WScript.Quit(0);
if(choice==6) //play it
{
    cmd = "\""+videoPlayerPath+"\" \""+videoURL+"\"";
    if(audioURL) cmd += " /dub \""+audioURL+"\"";
    if(subsURL) cmd += " /sub \""+subsURL+"\"";    
    shell.Run(cmd,1,false);
}
else if(choice==7) //save it
{
    fileName=WScript.Arguments(WScript.Arguments.length-1);
    path = downloadPath+"\\"+fileName+".mp4";
    cmd = "\"";
    if(ffmpegPath.length>0)
        cmd = "\""+ffmpegPath+"\\";
    cmd += "ffmpeg.exe\" -y -i \""+videoURL+"\" ";
    if(audioURL) cmd += "-i \""+audioURL+"\" ";
    if(subsURL) cmd += "-i \""+subsURL+"\" ";
    cmd += "-vcodec copy ";
    if(audioURL) cmd += "-acodec copy ";
    if(subsURL) cmd += "-scodec mov_text "; 
    
    cmd += "\""+path+"\"";
    shell.Run(cmd,1,true);
    if(openAfterDownloading)
    {
        choice=shell.Popup("Video was saved to "+path+
            ".\nOpen it the video player now?",0,"SVPtube",4+32);
        if(choice==6)
            shell.Run("\""+videoPlayerPath+"\" \""+path+"\"",1,false);
    }
}
</script>
</job>