View Single Post
  #14  
Old 12-26-2012, 06:24 AM
Ed999 Ed999 is offline
Senior Member
 
Join Date: Feb 2009
Posts: 115
Ed999 is on a distinguished road
Default

Download from BBC iPlayer - TV Show - Javascript method -- Continued


/ Continued...


Code:
ECHO    // LEVEL 2 TAGS  [Child tags]                                                                     >> %temp%\temp.htm
ECHO.                                                                                                     >> %temp%\temp.htm
ECHO    // Loop through each Child tag                                                                    >> %temp%\temp.htm
ECHO    var b = a[i].childNodes;                                                                          >> %temp%\temp.htm
ECHO.                                                                                                     >> %temp%\temp.htm
ECHO    // Loop instruction                                                                               >> %temp%\temp.htm
ECHO    for (j=0;j^<b.length;j++) {                                                                       >> %temp%\temp.htm
ECHO.                                                                                                     >> %temp%\temp.htm
ECHO        // Specify a target element within the Child tag                                              >> %temp%\temp.htm
ECHO        // Specified element must exist in ALL the Child tags                                         >> %temp%\temp.htm
ECHO        element3 = b[j].attributes.getNamedItem("supplier").nodeValue;                                >> %temp%\temp.htm
ECHO.                                                                                                     >> %temp%\temp.htm
ECHO        // Conditional Filter                                                                         >> %temp%\temp.htm
ECHO        // Pass only the Child tag that contains the desired supplier                                 >> %temp%\temp.htm
ECHO        if ( element3=="%supplier%" ) {                                                               >> %temp%\temp.htm
ECHO.                                                                                                     >> %temp%\temp.htm
ECHO        // Test value of element                                                                      >> %temp%\temp.htm
ECHO        // alert( "Supplier = " + element3 );                                                         >> %temp%\temp.htm
ECHO.                                                                                                     >> %temp%\temp.htm
ECHO        // Write elements in selected Child tag to file                                               >> %temp%\temp.htm
ECHO        fh.WriteLine( '@echo off' );                                                                  >> %temp%\temp.htm
ECHO        fh.WriteLine( ':: Media tag #' + [i] + ', Child tag #' + [j] );                               >> %temp%\temp.htm
ECHO        fh.WriteLine( '' );                                                                           >> %temp%\temp.htm
ECHO        fh.WriteLine( 'SET rtmpdump=%rtmpdump%' );                                                    >> %temp%\temp.htm
ECHO        fh.WriteLine( '' );                                                                           >> %temp%\temp.htm
ECHO        fh.WriteLine( 'SET protocol='    + b[j].attributes.getNamedItem("protocol").nodeValue    );   >> %temp%\temp.htm
ECHO        fh.WriteLine( '' );                                                                           >> %temp%\temp.htm
ECHO        fh.WriteLine( 'SET server='      + b[j].attributes.getNamedItem("server").nodeValue      );   >> %temp%\temp.htm
ECHO        fh.WriteLine( '' );                                                                           >> %temp%\temp.htm
ECHO        fh.WriteLine( 'SET application=' + b[j].attributes.getNamedItem("application").nodeValue );   >> %temp%\temp.htm
ECHO        fh.WriteLine( '' );                                                                           >> %temp%\temp.htm
ECHO        fh.WriteLine( 'SET identifier='  + b[j].attributes.getNamedItem("identifier").nodeValue  );   >> %temp%\temp.htm
ECHO        fh.WriteLine( '' );                                                                           >> %temp%\temp.htm
ECHO.                                                                                                     >> %temp%\temp.htm
ECHO        var str1 = b[j].attributes.getNamedItem("authString").nodeValue;                              >> %temp%\temp.htm
ECHO        fh.WriteLine( 'SET authString=' + str1.replace(/^&/g,"^&") );                                 >> %temp%\temp.htm
ECHO        fh.WriteLine( '' );                                                                           >> %temp%\temp.htm
ECHO.                                                                                                     >> %temp%\temp.htm

::          NOTES: 1. The symbol & must be carat-escaped using REPLACE (character to replace, replacement character).
::                 2. A carat (symbol ^) must preceed & in the first argument; g [global] means replace ALL instances.
::                 3. In second argument no escaping is needed: use of double quotes forces the symbols to be read literally

ECHO        fh.WriteLine( '::  *** Command Line : TV : LIMELIGHT : %bitrate% kbps ***' );                 >> %temp%\temp.htm
ECHO        fh.WriteLine( '"%%rtmpdump%%" --live --protocol "%%protocol%%" --host "%%server%%" '      +   >> %temp%\temp.htm
ECHO                      '--port %port% -a "%%application%%?%%authString%%&%%identifier%%" '         +   >> %temp%\temp.htm
ECHO                      '-y "%%identifier%%" '                                                      +   >> %temp%\temp.htm
ECHO                      '-o "Live %ID% ['+element2+'kbps] ['+element3+'] %currDate% %currTime%.flv" '); >> %temp%\temp.htm

::          NOTES: 1. The symbol % must be doubled in a Batch file (in contrast to a Command Line),
::                    to prevent it being expanded immediately as if it was an environment variable.

ECHO.                                                                                                     >> %temp%\temp.htm
ECHO.                                                                                                     >> %temp%\temp.htm
ECHO    }   }         // Close Child function                                                             >> %temp%\temp.htm
ECHO    }   }   }     // Close Primary function                                                           >> %temp%\temp.htm
ECHO    }                                                                                                 >> %temp%\temp.htm
ECHO }                                                                                                    >> %temp%\temp.htm
ECHO.                                                                                                     >> %temp%\temp.htm
ECHO ^</SCRIPT^>                                                                                          >> %temp%\temp.htm
ECHO.                                                                                                     >> %temp%\temp.htm
ECHO ^</head^>                                                                                            >> %temp%\temp.htm
ECHO ^<body onload="loadXML();window.close()"^> ^</body^>                                                 >> %temp%\temp.htm
ECHO ^</html^>                                                                                            >> %temp%\temp.htm


::  *** Run HTM file in Internet Explorer ***
"C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE" %temp%\temp.htm

::  *** Run MediaSelector.bat ***
CALL "C:\MediaSelector.bat"
Reply With Quote