0

I need a BIG HELP, first I want to say Im REALLY BAD with PHP :D so basically I have a php script witch auto generate list of videos from a folder on my host with 1 media player http://img687.imageshack.us/img687/5915/snap20120703at155809.png - As you can see there are too many clips (over 8000) and there are 6 folders with that much clips so its really hard to sort them...So I thinked to make them in a calendar as you can see the clips are with names "motion-year-month-day-hours" and I want to put them in this calendar http://img839.imageshack.us/img839/4871/snap20120703at160131.png and in the days to be 6 options (with the 6 folders of the vidoes) and when you press for example in day 1 - Camera 1 to be popup with the media clip and the filtered videos ONLY FOR THAT DAY.

If anyone think that can help me with this he will really SAVE ME I can share the hole codes but I think it will be too much of a flood...so if anyone can help me please leave Skype, MSN or something he will be my savior. I can repay him with graphics or banner or header or cover etc...Im not good in PHP but Im good in PhotoShop :)
THANKS!

Edited by bulqr4eto

3
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by diafol
0

Filtering the files on the date is not so hard, think a function can be made quickly that does that. However, it is unclear which calendar you use and how you would integrate something like that.

0

http://arshaw.com/fullcalendar/download/

This is the calendar

And this is my php for the media player and the auto listing

<?php
    $dir = "/usr/local/apache2/htdocs/hari/Camera 1 sb/"; // the full dir to the folder with videos, the videos must be in this folder not in sub-folder

    $handle = opendir($dir);

        $i=0;

        unset($files);

    # Taking the list of videos from the folder and recording them in massive $files
        while($entry = readdir($handle)){
            if($entry != "." && $entry != ".."){
                    $ef[$i] = $entry;   
                    $files[$i++] = "http://kameri.us.to/Camera 1 sb/" . $entry; 
            }
        }

    $file = $_GET['file'];

    # Printing the list of the videos
    if($file == "") 
        $value = $files[0];
    else 
        $value = $files[$file];
?>

<OBJECT id='mediaPlayer' width="320" height="240"
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codebase='http://activex.microsoft.com/activex/controls/ mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>
<param name='fileName' value="<?=$value?>">
<param name='animationatStart' value='1'>
<param name='transparentatStart' value='1'>
<param name='autoStart' value='1'>
<param name='ShowControls' value='0'>
<param name='ShowDisplay' value='0'>
<param name='ShowStatusBar' value='0'>
<param name='loop' value='0'>
<EMBED type='application/x-mplayer2'
pluginspage='http://microsoft.com/windows/mediaplayer/ en/download/'
id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='0'
bgcolor='darkblue' showcontrols='0' showtracker='1'
showdisplay='0' showstatusbar='0' videoborder3d='0' width="320" height="240"
src="<?=$value?>" autostart='1' designtimesp='5311' loop='0'>
</EMBED>
</OBJECT> 

<p ></p>

<?php 
    foreach ($files as $key => $value) {
        print "<a href='?file=$key'>" . $ef[$key] . "</a><br/>";
    }
?>

Edited by bulqr4eto

0

Suppose you want all files for 2012-07-03, you could do something like this:

$files = glob($dir . 'motion-2012-07-03-??-??-??.avi');

This would replace the opendir / readdir loop. You will have to loop the $files array to generate your links.

Edited by pritaeas

0

Yeah but I want not only for "07-03" but for every day in the future to be auto generated. I mean the videos to be auto filtered in the future

0

Well, of course. That was just a sample, you can pass those values in as variables. So, for today it would something like:

$date = date('Y-m-d');
$files = glob($dir . "motion-{$date}-??-??-??.avi");
0

For this should be straightforward:
To retrieve for a particular date - as Pritaeas says:

$cam = (isset($_GET['cam']) && is_int($_GET['cam']) && $_GET['cam'] > 0 && $_GET['cam'] < 7) ? intval($_GET['cam']) : 1;
$date = ... (get this from the form/calendar/datepicker/whatever), e.g. 03/07/2012
list($d,$m,$y) = explode($date,'/'); // optional - depending on format of $date
$dir = "/usr/local/apache2/htdocs/hari/Camera $cam sb/";
$files = glob($dir . "motion-$y-$m-$d-??-??-??.avi");
// OR EVEN $files = glob($dir . "motion-$date-??-??-??.avi"); depending on format of $date
print_r($files);

Yurk! I noticed you have spaces in your directory name. I feel all dirty... :(
BTW - just an example, not production-ready.

Edited by diafol

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.