Author Topic: macro, md5 & create file  (Read 3175 times)

0 Members and 1 Guest are viewing this topic.

ebola

  • Guest
macro, md5 & create file
« on: August 10, 2008, 03:26:31 PM »
Hi

The macros in HFS are very confusing for me. Is there a way for this task:

- User uploads file
- ul is finished, hfs creates a md5 of the new file, renames file to "the_md5hash_of_the_file.extension", generates a html file with md5 hash as filename and generates in the ul-succesfull-page a link to the md5.html?

As far as I can see there is the option to create and rename files with macros. But how to generate MD5 automatically when a UL is finished? Or is there a way to call a external program to do the job?

As an alternative how would it look like to rename the new uploaded file in a random name containing 16 random numbers and generate a html with the same 16 numbers?


Thx for helping me,
ebola

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12888
    • View Profile
Re: macro, md5 & create file
« Reply #1 on: August 11, 2008, 04:24:59 PM »
the only macro you are missing is the one to generate the MD5.
i can easily introduce it, and i will soon. stay tuned for new beta releases.

it can be something like {.save|%item-resource%.md5| {.md5file|%item-resource%.}/save.}
that you would insert into section [upload-success]

for the random name you can use {.random number.}
It's all documented in the wiki, as you may know.


I wonder if i should just create an option to hash new uploaded files, or leave this to tricky macros. :-/

ebola

  • Guest
Re: macro, md5 & create file
« Reply #2 on: August 11, 2008, 06:21:41 PM »
Hi

Thx for your answer :)
I will wait for next betas. Sound just too cool !!

Well, I would love a option to hash new files automatically + generate a file "%filename%.md5" without using macros.


Are there some examples using the different macros? In the wiki we find all the different syntax for all macros but some examples that show the syntax in "reallife" would be more friendly for newcomers. If you first open the macro-wiki you just think "Oh shit, come on!". Macros are cool but at the moment only advanced members take profit from them - for new users this is more than they can handle...

Thx + cheers,
ebola

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12888
    • View Profile
Re: macro, md5 & create file
« Reply #3 on: August 11, 2008, 06:54:36 PM »
Well, I would love a option to hash new files automatically + generate a file "%filename%.md5" without using macros.

ok, but you won't see it in next build. still undecided.
in the while, i tested this code and it works
{.save|%item-resource%.md5|{.md5 file|%item-resource%.}.}
use it in next build!

mmm, what if uploaded files will behave just accordingly to the feature
menu -> fingerprints -> create fingerprint on addition

wouldn't it be enough?

Quote
Are there some examples using the different macros?

plenty of them, in the "template" board of this forum.
you are right, some examples may be included in the wiki itself.
in the while you can refer the forum.