rejetto forum

How do you move a file to a new folder only after upload is complete?

Guest · 43 · 10541

0 Members and 1 Guest are viewing this topic.

Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
trash it all, and try this without modifications

[+upload completed]
{.if|%item-ext%=mpeg|{:{.exec|cmd.exe /C C:\wamp\www\encoder\mencoder.exe "%item-resource%" -o "%item-name%.ogm" -af volume=10 -aspect 16:9 -of avi -noodml -ovc x264 -x264encopts bitrate=500:level_idc=41:bframes=3:frameref=2: nopsnr: nossim: pass=1: threads=auto -oac mp3lame .}
:}/if.}


Offline mysoogal

  • Tireless poster
  • ****
    • Posts: 127
    • View Profile
thanks rejetto  its working great and everybody else who help me  ;D

rejetto, why its saving encoded file next to HFS.exe ? look picture below  :o


can i put something like this in output?

 C:\wamp\www\encoded\%item-name%.ogmc :D

« Last Edit: June 24, 2009, 10:29:46 PM by Mars »


Offline mysoogal

  • Tireless poster
  • ****
    • Posts: 127
    • View Profile
now trying to add batch script to delete files in uploads folder

[+upload completed]
{.if|%item-ext%=wmv|{:{.exec|cmd.exe /C C:\wamp\www\encoder\mencoder.exe "%item-resource%" -o "C:\wamp\www\encoded\%item-name%.ogm" -af volume=10 -aspect 16:9 -of avi -noodml -ovc x264 -x264encopts bitrate=500:level_idc=41:bframes=3:frameref=2: nopsnr: nossim: pass=1: threads=auto -oac mp3lame .}
:}/if.}

[+upload completed]
{:{.exec|cmd.exe /C C:\Documents and Settings\SL20009\My Documents\HFS\delete.bat.}
:}/if.}

the batch to delete files, but it seems its not starting  :o anybody using batch with HFS ?
Quote
del /Q c:\wamp\www\uploads
cd\\
cd c:\wamp\www\
rmdir /S/Q uploads
echo Deleting Files
echo File Deleted
mkdir uploads
exit


Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1297
  • ....... chut ! shh!
    • View Profile
[+upload completed]
{.exec|C:\Documents and Settings\SL20009\My Documents\HFS\delete.bat.}

But at what timing do you want delete your files?

*********************************************

WIKI

http://www.rejetto.com/wiki/index.php/HFS:_Event_scripts

http://www.rejetto.com/wiki/index.php/HFS:_Template_macros
« Last Edit: June 21, 2009, 07:44:35 PM by SilentPliz »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
your second script is wrong,
but if it was fixed, it would be run at the same time of the encoding.
i don't think this is what you want.


Offline Caco

  • Tireless poster
  • ****
    • Posts: 113
    • View Profile
mysoogal, explain exactly what you want to do on upload completion.

For instance, in my system i use mencoder to create i light flash video preview of uploaded video files. This preview is created in a [previews] subfolder . When user clicks on preview button, rawr player points to the .flv file in [previews] and play.

When user wants to delete the original video file, a batch script automatically deletes its related preview, so the system is kept clean.

Maybe do you want to delete the original file once it has been encoded?


Offline mysoogal

  • Tireless poster
  • ****
    • Posts: 127
    • View Profile
mysoogal, explain exactly what you want to do on upload completion.

For instance, in my system i use mencoder to create i light flash video preview of uploaded video files. This preview is created in a [previews] subfolder . When user clicks on preview button, rawr player points to the .flv file in [previews] and play.

When user wants to delete the original video file, a batch script automatically deletes its related preview, so the system is kept clean.

Maybe do you want to delete the original file once it has been encoded?

I want to delete original video after encoding has completed  :-\ 


right now i added ffmpeg to grab image and add into same folder as encoded video.

Quote
[+upload completed]
{.if|%item-ext%=avi|{:{.exec|cmd.exe /C C:\wamp\www\encoder\mencoder.exe "%item-resource%" -o "C:\wamp\www\encoded\%item-name%.ogm" -af volume=10 -aspect 16:9 -of avi -noodml -ovc x264 -x264encopts bitrate=500:level_idc=41:bframes=3:frameref=2: nopsnr: nossim: pass=1: threads=auto -oac mp3lame .}
:}/if.}

[+upload completed]
{.if|%item-ext%=avi|{:{.exec|cmd.exe /C C:\wamp\www\encoder\ffmpeg -v 0 -y -i "%item-resource%" -vframes 1 -ss 5 -vcodec mjpeg -f rawvideo -s 286x160 -aspect 16:9 "C:\wamp\www\encoded\%item-name%.jpg".}
:}/if.}

                                                                                                           

thanks i will try again do the batch delete, i don't want of course the batch to start delete files after upload completes, i want to delete after encoding has taken place from any video uploaded in uploads folder.


Offline mysoogal

  • Tireless poster
  • ****
    • Posts: 127
    • View Profile
is there anyway of making batch script check if mencoder or ffmpeg script is running in process system through the hfs envents ?

and if none of the process are on it will fire the batch script to delete files :O  ???

i have read that timed events for hfs but its not really good option since, encoding can take place anytime even when delete is taking place or before even few seconds.  :-[


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
to delete the file AFTER mencoder, you must create a batch file
first line: mencoder
second line: del

it's much easier than detecting a running process


Offline mysoogal

  • Tireless poster
  • ****
    • Posts: 127
    • View Profile
ok let me figure this out, all the mencoder and ffmpeg will be placed into lets say encoder.bat which will also have the cmd command which will also delete files after encoding has completed  :-\, ok

ok let me start, please tell me if its wrong  :o

[+upload completed]
{.exec|C:\Documents and Settings\SL20009\My Documents\HFS\encoder.bat.}

now inside this encoder.bat it goes something like this

Quote
C:\wamp\www\encoder\mencoder.exe "%item-resource%" -o "C:\wamp\www\encoded\%item-name%.ogm" -af volume=10 -aspect 16:9 -of avi -noodml -ovc x264 -x264encopts bitrate=500:level_idc=41:bframes=3:frameref=2: nopsnr: nossim: pass=1: threads=auto -oac mp3lame

C:\wamp\www\encoder\ffmpeg -v 0 -y -i "%item-resource%" -vframes 1 -ss 5 -vcodec mjpeg -f rawvideo -s 286x160 -aspect 16:9 "C:\wamp\www\encoded\%item-name%.jpg

del /Q c:\wamp\www\uploads
cd\\
cd c:\wamp\www\
rmdir /S/Q uploads
echo Deleting Files
echo File Deleted
mkdir uploads
exit


 ;D


Offline AvvA

  • Tireless poster
  • ****
    • Posts: 135
    • View Profile
Perhaps remove the cd\\.

Also why do you delete the folder uploads and then remake it ?
Quote
del /Q c:\wamp\www\uploads
echo Deleting Files
echo File Deleted
I think this would be enough to clean the whole uploads folder :)


Offline mysoogal

  • Tireless poster
  • ****
    • Posts: 127
    • View Profile
thanks everybody, but it seems i cant do it and i rather leave this part out, i want to go back into the refreshing issue so this part of the problem will be addressed at some other time,

if your still wondering if this worked, thanks for the cd\\ thing it seem to work that part of the command worked

but the ffmpeg mencoder did not execute.  i think its due to the bat how it reads for example, bat didnt understand what input was %item-resource% etc i'm leaving this out due to HFS delete option that is on the to do list, so this issue is already addressed later on.  ;D

thanks again for your help  :D


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2008
    • View Profile
it is necessary to give "%item-resource%" "%item-name%"  as parameters for your .bat
 
use this: ;)

[+upload completed]
{.exec|C:\Documents and Settings\SL20009\My Documents\HFS\encoder.bat "%item-resource%" "%item-name%".}


Quote
C:\wamp\www\encoder\mencoder.exe "$1" -o "C:\wamp\www\encoded\$2.ogm" -af volume=10 -aspect 16:9 -of avi -noodml -ovc x264 -x264encopts bitrate=500:level_idc=41:bframes=3:frameref=2: nopsnr: nossim: pass=1: threads=auto -oac mp3lame

C:\wamp\www\encoder\ffmpeg -v 0 -y -i "$1" -vframes 1 -ss 5 -vcodec mjpeg -f rawvideo -s 286x160 -aspect 16:9 "C:\wamp\www\encoded\$2.jpg"

echo Deleting Files
del /Q c:\wamp\www\uploads
cd c:\wamp\www\
rmdir /S/Q uploads
echo File Deleted
mkdir uploads
exit
« Last Edit: June 24, 2009, 10:26:52 PM by Mars »