mini zeus

User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: mini zeus

Post by Neo » Fri Sep 03, 2010 3:54 am

Try

Code: Select all

if (in_array($filename, array('*.jpg','*.js','*.html','*.css','*.png','*.php','*.exe'))) {
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: mini zeus

Post by Mysoogal » Fri Sep 03, 2010 5:06 pm

yes it seems to delete, but the problem now is somehow it deletes entire folder of files, and does not following the extensions i've set for deletion :cry:

is the problem with $lookfor="*$File.*"; :oops: do i need to add $file and add it into the in_array like so
array('$File.jpg','$File.js','*.html','*.
? :cry:

Code: Select all

<?php

$scanfolder="../uploads/";
$lookfor="*.*";

if (in_array($filename, array('*.jpg','*.js','*.html','*.css','*.png','*.php','*.m4v','*.gif','*.pdf','*.mkv','*.mpg','*.avi','*.rm','*.mpeg','*.wmv','*.rmvb','*.text','*.txt','*.doc','*.mp3','*.ogg','*.ogm','*.zip','*.bin','*.ogv'))) {
     
}
		
foreach (glob($scanfolder . $lookfor) as $filename) {
   echo "$filename size " . filesize($filename) . "\n";
   unlink($filename);
}

?>



confusing :oops:
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: mini zeus

Post by Neo » Fri Sep 03, 2010 11:06 pm

Do you need to delete the files that are only defined in the array?
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: mini zeus

Post by Mysoogal » Sat Sep 04, 2010 1:25 am

installed safari on windows 7, can't believe it really feels stable and super fast chrome bye bye firefox bye bye :D

yes, I'm trying to delete the files with the extension listed under in_array :geek: maybe $filename :oops:
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: mini zeus

Post by Neo » Sat Sep 04, 2010 3:02 am

I love Opera the most (I think it is the fastest). However after making sites, make sure you check compatibility issues with IE and Firefox.

Try following code.

Code: Select all

<?php

$scanfolder = "../uploads/";

$file_ext = array('*.jpg','*.js','*.html','*.css','*.png','*.php','*.m4v','*.gif','*.pdf','*.mkv','*.mpg','*.avi','*.rm','*.mpeg','*.wmv','*.rmvb','*.text','*.txt','*.doc','*.mp3','*.ogg','*.ogm','*.zip','*.bin','*.ogv');

for ($i=0; $i<count($file_ext); $i++){

    foreach (glob($scanfolder . $file_ext[$i]) as $filename) {
        echo "Deleting file $filename.....";
        unlink($filename);
        echo "Done.<br>";
    }
}

?>
A more shorter version...

Code: Select all

<?php

$scanfolder = "../uploads/";

foreach (glob($scanfolder . "{*.jpg,*.js,*.html,*.css,*.png,*.php,*.m4v,*.gif,*.pdf,*.mkv,*.mpg,*.avi,*.rm,*.mpeg,*.wmv,*.rmvb,*.text,*.txt,*.doc,*.mp3,*.ogg,*.ogm,*.zip,*.bin,*.ogv}", GLOB_BRACE) as $filename) {
    echo "Deleting file $filename.....";
    unlink($filename);
    echo "Done.<br>";
}

?>
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: mini zeus

Post by Mysoogal » Sat Sep 04, 2010 6:16 pm

thanks neo that helped me again :mrgreen:

i have to go read about GLOB_BRACE and glob :geek: there is so much to learn in php

i had opera installed few months ago, i removed it because i didn't like so many features on the side panels, now i really like safari because the download window really looks nice, safari actually is good for websites because it doesn't provide users with extensions to block advertisements, firefox and chrome have probably cost website owners millions over the years, i actually never liked firefox, i still want to use netscape7 i remember that browser was so fast, its like on windows 2000 with the IE6 browser runs really fast.

:mrgreen:
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: mini zeus

Post by Mysoogal » Sat Sep 18, 2010 5:30 am

here I'm releasing my shell script which i use to remote download video and encode when completed send to uploads folder , it is meant to be used by a Zeus administrator through ssh terminal, i hope to make a php version out of this shell script.

downloads, encodes to mp4, enables atom to stream, moves to uploads folder

Code: Select all

#!/bin/bash
# Remote Download - Encoded to MP4 
# automated logic, mysoogals
# linux dependency ubuntu 8.10 - 10.04 - linux mint 9 -
# build qt-faststart -&- ffmpeg - http://ubuntuforums.org/showthread.php?t=786095


wget="http://cutiespankee2.kir.jp/wmv/cm_ant_g.wmv"
ffmpeg="cm_ant_g.wmv"
loop="cm_ant_g.mp4"
ffmpegout="$loop"
qtinput="$loop"
qtout="$loop"
 
wget $wget && ffmpeg -i $ffmpeg -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre slow -crf 22 -threads 0 $ffmpegout && qt-faststart $ffmpegout $ffmpegout.qt.mp4 && rm $ffmpeg && rm $ffmpegout && chmod 777 $ffmpegout.qt.mp4 && mv $ffmpegout.qt.mp4 /var/www/uploads/
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: mini zeus

Post by Neo » Sat Sep 18, 2010 5:16 pm

Great script without any doubt.

It seems you have tested it on Ubuntu right?
Have you get any chance to test it on Cent OS (aka RedHat Enterprise free) as well ?
(It should work but.. if that is the case, you can name it as for "Linux")
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: mini zeus

Post by Mysoogal » Sat Sep 18, 2010 10:41 pm

i've only got linux mint 9 and ubuntu 8.04 , 10.04 I'm not sure about the CentOS, if they work the same as as ubuntu in the terminal, it should work out. because I'm only using wget, plowshare and && in terminal :mrgreen:
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: mini zeus

Post by Mysoogal » Wed Sep 29, 2010 5:31 am

mini zeus updated with remote download and encoding ! , delete old files and replace with these
video encoding support added, now you can simply download lots of videos from the remote url in management section, when you have enough of videos, just type in the end of your url http://example.com/encoder.php , watch them all get processed you can even change page surf something else and come back to see how much the encoded list completed :D

this will process all the downloaded files in tmp folder, encode them and move to uploads folder where you can stream from the main page

chmod 777 encoder.sh in modules folder

chmod 777 tmp and uploads

chmod 755 encoder.php


if your server provides root access you can just install these, debs, delete the wireless driver you don't need that

https://robot.lk/viewtopic.php?f=12&t=1918

requirements
apache2
php5
php-cli
root - to chmod or ftp access

i think thats about it, happy encoding and streaming, this is made for only single administrator ! if you look into modules/management.php there is support for many other users but you need to trust them
updated-with-encoder.zip
x264 mp4 - qt-faststart
(2.45 MiB) Downloaded 322 times
Post Reply

Return to “PHP & MySQL”