Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   Playing online streaming in media players (http://stream-recorder.com/forum/forumdisplay.php?f=77)
-   -  

Zapni.TV: make batch file with Zapni.TV channels for opening in VLC

(http://stream-recorder.com/forum/showthread.php?t=10295)

karlo2105 10-24-2011 08:04 AM

Zapni.TV: make batch file with Zapni.TV channels for opening in VLC


 
Hello I would like to know how to make a php script for Zapni.tv channels. They use http for streaming with tickets. Here is an example: _www.zapni.tv/play.php?id=240 . My purpose is to make a batchfile with those channels.

I tried with that but it's not opening VLC in batchfile.

Quote:

<?php

$ch = curl_init("http://www.zapni.tv/play.php?id=240");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$page = curl_exec($ch);

preg_match_all('/(http):\/\/(www\.zapni\.tv\/stream\/vlc\.php)\?(.*)/', $page, $matches);

foreach($matches[0] as $v)
{
echo strip_tags($v) . "<br />";
}



?>
Thanks for help.

KSV 10-26-2011 02:32 AM

Re: Zapni.TV: make batch file with Zapni.TV channels for opening in VLC


 
is the above posted code fragment your whole script? i can't see where are you even launching vlc? here is the full script which will work with vlc streams available on the site.
Code:

<?php
  echo "KSV ZapniTV Downloader\n";
  $format = "%-8s : %s\n";
  function runAsync($command)
    {
      $WshShell = new COM("WScript.Shell");
      $oExec    = $WshShell->Run($command, 1, false);
      unset($WshShell, $oExec);
    }

  if ($argc <= 1)
    {
      echo "Enter URL : ";
      $url = trim(fgets(STDIN));
    }
  else
      $url = $argv[1];
  echo "Retrieving html . . .\n";
  $html = file_get_contents($url);
  preg_match('/<a.*?>(.*?[vlc|vlc_2].php.*?)<\/a>/i', $html, $links);

  if (file_exists("C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe"))
      $vlc = "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe";
  else
      $vlc = "C:\\Program Files\\VideoLAN\\VLC\\vlc.exe";
  if (isset($links[1]))
    {
      $command = "\"$vlc\" \"$links[1]\"";
      printf($format, "Command", $command);
      runAsync($command);
    }
  echo "Finished.\n";
?>

Code:

http://www.mediafire.com/file/xdp7efl44fjv74f/KSV%20-%20ZapniTV.zip

karlo2105 10-26-2011 03:54 AM

Re: Zapni.TV: make batch file with Zapni.TV channels for opening in VLC


 
No I found this script on this website and I launched vlc in batchfile.

So my command was like that :

Code:

%php% ZapniTV.php
curl "http://www.zapni.tv/play.php?id=240" | %vlc% -

It gave me latest http address but without opening VLC.
So I replaced my script with yours in file ZapniTV.php.
When i launch this command :
Code:

call %php% ZapniTV.php
it asks me to give http address and I have to copy and paste link. After 30 seconds it stops. Is it possible to automatize stream launching because copy/paste isn't very interesting for batchfile. ;-)

KSV 10-26-2011 05:29 AM

Re: Zapni.TV: make batch file with Zapni.TV channels for opening in VLC


 
in batch file the following command works for me without explicitly asking for url. my script doesn't create any junk file.

Code:

call php ZapniTV.php "http://zapni.tv/play.php?id=240"

karlo2105 10-26-2011 05:39 AM

Re: Zapni.TV: make batch file with Zapni.TV channels for opening in VLC


 
Thanks that's working great. ;-)


All times are GMT -6. The time now is 06:28 PM.