Topic: Help with WSF(Windows Script File) SVPTube

I have been trying to get the SVPTube WSF script to work so I can download the videos that I interpolate from Youtube.

I put in the path to ffmpeg.exe as "C:\ffmpeg" which by reading how the script works should work but it doesn't. When I try it out I get an error which points to this line of code: "shell.Run(cmd,1,true);"

Most likely something is going wrong when the cmd string is created. I've looked over the code and I don't see anything wrong and I haven't changed any of the code besides editing the ffmpeg path which you have to do anyways.

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);

And the exact error I get:

Script:
File path to svptube-dl.wsf
Line: 71
Char: 3
Error: The system cannot find the file specified.
Code: 80070002
Source: (null)

Re: Help with WSF(Windows Script File) SVPTube

Try to restart SVPtube after changing %PATH% value.

========
Oh, you've just modified path inside the script.
Ok, how that line of code looks now?

Re: Help with WSF(Windows Script File) SVPTube

Chainik wrote:

Try to restart SVPtube after changing %PATH% value.

========
Oh, you've just modified path inside the script.
Ok, how that line of code looks now?

Restarting SVPTube still produces the same error.

Here is a full copy paste in case I may have missed something:

<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>

Re: Help with WSF(Windows Script File) SVPTube

C:\\ffmpeg

double backslash

5 (edited by Prower 30-12-2014 17:50:04)

Re: Help with WSF(Windows Script File) SVPTube

Wow. Now I just feel embarrassed lol

Is there a way to fix the video titles? The first time I save a video it titles it "Getting info for xxxxxxxxx" instead of the actual video title. The second time I try it will work properly.

It seems the problem lies with SVPTube not updating the video title in time. Perhaps there is a way to make the script wait until the title is updated?

Re: Help with WSF(Windows Script File) SVPTube

Prower
The first time I save a video it titles it "Getting info for xxxxxxxxx" instead of the actual video title. The second time I try it will work properly.

I'll take a look