[greenstone-users] Re: Search Collection Location and KB instead ofbyes

From Diego Spano
DateTue Mar 10 01:58:00 2009
Subject [greenstone-users] Re: Search Collection Location and KB instead ofbyes
In-Reply-To (49B45A38-5070802-cs-waikato-ac-nz)
Hi Dwight, about #1. If you want to get sizes in MB you can modify the
plugin just to meka the import process generate the [FileSize] metadata in
MB directly.


If you are using version 2.80 you can edit /perlib/ConvertToPlug.pm and in
line 428 aprox. you have:


$doc_obj->set_utf8_metadata_element($doc_obj->get_top_section(), "FileSize",
(-s $filename));

(-s $filename) gets the size in bytes, but if you modify it like this:

my $mysizeinMB = sprintf("%.2f",((-s $filename)/1024));
$doc_obj->set_utf8_metadata_element($doc_obj->get_top_section(), "FileSize",
$mysizeinMB);

then you will have MB instead of bytes.

If you have v2.81, then you have to modify then modify Convertbinaryfile.pm
at line 437 aprox:

$doc_obj->set_utf8_metadata_element($doc_obj->get_top_section(), "FileSize",
(-s $filename_full_path));

Replace it with:

my $mysizeinMB = sprintf("%.2f",((-s $filename_full_path)/1024));
$doc_obj->set_utf8_metadata_element($doc_obj->get_top_section(), "FileSize",
$mysizeinMB);

All these applies to import PDF or other text documents. If you are
importing images with ImagePlugin you have to modify ImageConverter.pm and
write these

my $sizeinMB = sprintf("%.2f",(($image_size)/1024));
$doc_obj->set_metadata_element ($section, "FileSize", $sizeinMB);


Hope these helps.

Diego Spano


Diego Spano
Director de Proyectos para Argentina
www.prodigioconsultores.com

-----Mensaje original-----
De: greenstone-users-bounces@list.scms.waikato.ac.nz
[mailto:greenstone-users-bounces@list.scms.waikato.ac.nz] En nombre de
Katherine of Greenstone Team
Enviado el: domingo, 08 de marzo de 2009 21:52
Para: DTMartin
CC: greenstone-users@list.scms.waikato.ac.nz
Asunto: [greenstone-users] Re: Search Collection Location and KB instead of
byes

Hi Dwight

All the formatting options can be seen at
http://wiki.greenstone.org/wiki/index.php/How_to_format_the_output_of_your_c
ollection

For 2, you can use [collection] or [collection:collectionname] to show
which collection the doc came from.

For 1, we don't have any built in way to do this. You could try javascript?

Regards,
Katherine

DTMartin wrote:
> Hello,
>
> I have two questions.
>
> 1. Is there a format statement that shows KB instead of just bytes?
Right
> now my format statement use ([ex.FileSize] bytes) For large files this
> looks cumbersome
>
> 2. When doing a search across collections is there a format feature that
> allows me to display which collection the file came from?
>
> Thanks for your help
>
> Dwight
>
>
>

_______________________________________________
greenstone-users mailing list
greenstone-users@list.scms.waikato.ac.nz
https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-users