apisteuto cgi provlima

Giorgos Pallas gpall at hal.csd.auth.gr
Wed Oct 4 23:32:34 EEST 2000


Geia! Exo ena provlima sxedon aneksigito (me tis ptoxes mou gnoseis) se ena
cgi script se perl.
exo kanei mikro cgi script gia na psaxno tin mp3 database (format blepe
telos) mou kai na brisko se poio cd anikei ena mp3.
idou ena mikro apospasma pou tha eprepe na leitourgei alla den...
#!/usr/bin/perl -w

  use CGI qw/:standard/;
  print header,
        start_html('George Pallas MP3 Database'),
        h1('Find an MP3 from George Pallas Huge MP3 Collection...'),
        start_form,
        "What is the mp3 pattern to look for ",textfield('name'),p,
        submit,
        end_form,
        hr;
   if (param()) {

my($findm)=em(param('name'));
print p,"Searching for pattern '",$findm,"'",p;

#mexri edo kala, pairnei sosta apo ti forma to $findm

open(FILE_DATA,"my_mp3s.txt"); # ok to arxeio einai sto current directory

while ($line = <FILE_DATA>)
{
  chomp($line);

  if ($line =~ /\s*CDLABEL\s*:\s*([\w-]+)/)
     {
       $label=$1;
       print "NEO LABEL : ",$label,p;
      # KAI edo leitourgei perifima, briskei tis grammes ton LABEL
     }

  if ($line =~ /$findm/)        # EDO pou exo metabliti sto pattern den
enoei na kanei match...
    {               # otan to kano if ($line =~ /os/)  TOTE briskei kanonika
oles tis grammes pou exoun kapou to 'os'
       print "BRHKA!!! line = ",$line,p;
    }
} #while

 print hr;
}# if param

Ola leitourgoun kala mexri tin if ($line =~ /$findm/) i opoia POTE den
petyxainei... an tin antikatastiso me if ($line =~ /os/) tote briskei
kanonika oles tis grammes pou exoun gia paradeigma to 'os' ...
Na simeioso episis oti stin arxi to eixa kanei to scriptaki se .pl (oxi cgi
gia web) to opoio leitourgouse apsoga, diladi i if ($line =~ /$findm/)
petyxaine kanonika...
Kamia idea?
PS. sorry gia to megalo mail...


To format tis database einai :
CDLABEL : mplah_mplah

...md5sum... ./path_to_mp3/my.mp3

gia paradeigma :
CDLABEL :  MP3_MUSIK

227777563ac5043aa96cee228c0a710c  ./Bit/Beastie Boys - Beastie1.mp3
38f4eaaf7c5bfcc94415e2b8e39d5093  ./Bit/Beastie Boys - !beastyb2.mp3
============================================================================
============================================================================
======================
CDLABEL :  Musik

c0acab0d858e67b3ea819649478326d7  ./Asimos/asimos1.mp3
0cd030921ec63f85005a62894e202ee3  ./Asimos/asimos2.mp3


--
linux-greek-users mailing list -- http://lists.hellug.gr




More information about the Linux-greek-users mailing list