// // Version 1. // // Windows version of a combined twaudiorip.sh / twaudiorip-runner.sh // // Download the newest mp3 files from Twaud.io user. // (Only those mp3's that are listed in the RSS feed.) // // This script will get usernames from a central tracker. It will keep // running until it sees a file called STOP.txt in its directory. // // Usage: cscript twaudiorip.js // var WshShell = WScript.CreateObject("WScript.Shell"); var FileSystemObject = new ActiveXObject("Scripting.FileSystemObject"); function runWget(wgetCommand) { // redirect stderr to stdout // http://www.digitalenginesoftware.com/blog/archives/27-WshShell.Exec-Considered-Harmful-Due-To-Blocking.html var wget = WshShell.Exec("%comspec% /c \""+wgetCommand+" 2>&1\""); var stdOut = ""; var stdErr = ""; while (wget.Status == 0) { if (!wget.StdOut.AtEndOfStream) { stdOut += wget.StdOut.ReadAll(); } WScript.Sleep(100); } if (!wget.StdOut.AtEndOfStream) { stdOut += wget.StdOut.ReadAll(); } return { Status:wget.Status, StdOut:stdOut, StdErr:stdErr }; } function mkdirP(dir) { var dirParts = dir.split("\\"); var curDir = WshShell.CurrentDirectory; for (var i=0; i