Jump to content

PHP media server - issue when trying to schedule tv recordings


Recommended Posts

Hi all

 

I am currenlty in the process of creating a media server on a linux machine using Apache and PHP scripting.

 

I'd imagine lots of people have already done this.

The media server that I made is slightly different though.

 

On my media server all media files are in xvid format (which cannot be streamed).

However my media server on user selection of film transcodes on the fly into flv format using FFmpeg to do the transcoding on the fly (takes a bit of horse power but works sweet).

 

Client pcs use fwplayer to play the video content.

 

So far so good, howerver I am creating a php web page to schedule tv recordings (since the server has a tv card) and this is where my problem is.

 

I create a webpage to schedule a tv recording 'scheduletvrecording.php' and this parses out the channel name and start time, duration etc.

This works by calling 'tvcreate.php' file

the web link shows as :-

http://10.0.0.1/tvcreate.php?channelname=bbc1&starttime=1200&duration=90

 

The 'tvcreate.php' doesnt seem to recognise the values I am parsing into it.

 

for now tvcreate.php should just create a test.txt file with the settings that i parsed from the 'schduletvrecording.php' web page.

 

I know php executes on the server so i will plan to create a shell file with the recording settings and get at to schedule a time to record.

 

I have tried various work arounds but so far got no where.

id love some help on this as I am really stumped now.

Thanks in advance.

 

Rich

 

[attachment deleted by admin]

Link to comment
Share on other sites

UPDATE:

 

I have now managed to parse information through to the tvcreate.php file (attached).

 

My only problem now is that I try to use the command at (to schedule a bash file to be ran at a set time) and I get the error :-

 

You do not have permission to use at.

 

How can I get the at command to run from the www-data user ?

 

[attachment deleted by admin]

Link to comment
Share on other sites

well i got a bit further and the php script was parsing variables to the bash file (rec-gen.sh).

 

I changed something (cant remember now) and the variables are no longer being parsed through

 

Could someone look this over and correct me

 

PHP file :-

<?

// this is the script to schedule a tv recording using

//'channelname' for channel name

//'starttime' for start time

//'duration' is the recording duration

 

//full path to record video.

$path = '/programs';

 

//listen for input figures for input

$channelname = htmlspecialchars($_GET["channelname"]);

$starttime = htmlspecialchars($_GET["starttime"]);

$duration = htmlspecialchars($_GET["duration"]);

 

$cmd = 'export PATH="/usr/bin/"; /home/user/recorder/rec-gen.sh $channelname $starttime $duration 2>&1';

echo "<pre>".shell_exec($cmd)."</pre>";

// the above variables are not parsed out to rec-gen.sh

 

echo "should correctly display the listed variables ==== ";

echo $channelname;

echo $starttime;

echo $duration;

 

?>

 

bash file for now is set to just echo out the variables :-

echo -e "var1: $1, var2: $2, var3: $3"

 

If I run the php script as "http://server1/tvcreate.php?channelname=ITV1&starttime=01:00&duration=90"

 

I get

 

var1: , var2: , var3: --------------this is the output from the script file but shows no values

 

 

should correctly display the listed variables ==== ITV10090 ------------this is the output from the php script.

 

This clearly shows that the php file is correctly displaying the input but is not parsing the variables to the bash script.

 

So what am i doing wrong ?

Thanks in advance.

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.