Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > share winlyrics to wmp SMI in perl

Reply
Thread Tools

share winlyrics to wmp SMI in perl

 
 
lechee
Guest
Posts: n/a
 
      08-31-2004
#!/usr/bin/perl
#
# lrc2smi lyrics to plain text (wmp smi) v1.00 (perl)
#
# convert lyrics .lrc to WMP smi
#
# copyright 2004 Lechee.Lai lecheel at yahoo dot com
#

# global variable
use File::Basename;
my $tcount=0;
my $tcontext;


$argc=@ARGV
&convertLRC();
exit 1;


sub convertLRC {
open(FILE, @ARGV[0]) or die "lrc2smi: you must have \"@ARGV[0]\"
for convert \n";
my $out=basename(@ARGV[0],"");
if ($out=~/(.*)\..*/ and !$option{'withextension'})
{$out=~s/(.*)\..*/$1\.smi/;}
else {$out.=".smi";}
$pureLrc = ">$out";

@file = <FILE>;
close (FILE);
open (NEWFILE, $pureLrc) or die "$!";
&SMIbegin();
&SMItitle();
foreach $line (@file) {
chomp ($line);
$line1 = $line;
# if ($line1 =~ /^\[(\d{2})\\d{2})\](.*)$/) { # check [nn:nn]
if ($line1 =~ /^(.*)((.*)(])/) { # check *:*]
$line2 = $line1;
if ($line2 =~ /\d(+\d+(])/) { # check nnn:nnn]
# if (1) {
$l1 = $line1;
checkTimeStamp($line1);
$noMore=0;

while ($noMore==0) {

if ($l1 =~ /^(.*)\d{2}(])/) { # have vaild
timestamp
$pos = index($l1, "]");
$timestamp = substr($l1, 0, $pos+1);


if ($timestamp =~ /^\[(\d{2})\\d{2})\](.*)$/) {

my ($m, $s) = ($1, $2);
my $sec = $s+60*$m;

while (exists $times{$sec}){
$sec += 0.01;
}

&SMItime($sec);
}
if ($tcount) {
print NEWFILE "$tcontext";
}
print NEWFILE "\n";
$l1 = substr($l1,$pos+1);
} else {
$noMore=1;
}

}
} else {

# print "###$line1\n";
}
} else {
# print "---$line\n";
}

}
&SMIend();
close(NEWFILE);
}

sub checkTimeStamp($) {
my ($line) = @_;
$tcount = 0; # initialize for TimeCount
$pos = rindex($line,"]");
$tcontext = substr($line,$pos+1);
if ($pos>5) {
$tcount = 1;
}
# print "...$tcontext\n";

}



sub SMIbegin {
print NEWFILE "<SAMI>\n";
print NEWFILE "<HEAD>\n";
print NEWFIEL "<TITLE>Lechee Lyrics SMI</TITLE>\n";
}

sub SMItitle {
print NEWFILE "<STYLE TYPE=\"text/css\">\n<!--\nP {\n";
print NEWFILE "margin-left:8pt;\n";
print NEWFILE "margin-right:8pt;\n";
print NEWFILE "margin-bottom:24pt;\n";
print NEWFILE "Background-image : url();\n";
print NEWFILE "line-height:48pt;\n";
print NEWFILE "Background-color:#000000;\n";
print NEWFILE "text-align:center;\n";
print NEWFILE "font-size:16pt;\n";
print NEWFILE "font-family:,tahoma,arial,dotum,sans-serif;\n";
print NEWFILE "font-weight:bold;\n";
print NEWFILE "font-style:Normal;\n";
print NEWFILE "color:#ffff00;\n";
print NEWFILE "}\n";
print NEWFILE ".CCUS {Name:English; lang: en-US;\n}\n-->\n";
print NEWFILE "</STYLE>/n</HEAD>\n";
print NEWFILE "<BODY>\n";
}

sub SMIend {
print NEWFILE "</BODY>\n";
print NEWFILE "</SAMI>\n";
}

sub SMItime($) {
my ($tt) = @_;
print NEWFILE "<SYNC Start=";
print NEWFILE $tt;
print NEWFILE "000><P Class=EGCC>";
}
 
Reply With Quote
 
 
 
 
Anno Siegel
Guest
Posts: n/a
 
      09-01-2004
lechee <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> #!/usr/bin/perl


[150 lines of undocumented code of dubious quality snipped]

The place to share Perl code is the CPAN, not Usenet.

Anno
 
Reply With Quote
 
 
 
 
lechee
Guest
Posts: n/a
 
      09-03-2004
http://www.velocityreviews.com/forums/(E-Mail Removed)-berlin.de (Anno Siegel) wrote in message news:<ch45dj$7dn$(E-Mail Removed)-Berlin.DE>...
> lechee <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> > #!/usr/bin/perl

>
> [150 lines of undocumented code of dubious quality snipped]
>
> The place to share Perl code is the CPAN, not Usenet.
>
> Anno


why I can not share the perl in usenet, google can search anything we
want, I like google with usenet
 
Reply With Quote
 
Anno Siegel
Guest
Posts: n/a
 
      09-03-2004
lechee <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> (E-Mail Removed)-berlin.de (Anno Siegel) wrote in message
> news:<ch45dj$7dn$(E-Mail Removed)-Berlin.DE>...
> > lechee <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> > > #!/usr/bin/perl

> >
> > [150 lines of undocumented code of dubious quality snipped]
> >
> > The place to share Perl code is the CPAN, not Usenet.
> >
> > Anno

>
> why I can not share the perl in usenet, google can search anything we
> want, I like google with usenet


Usenet is a discussion forum. The fact that google has chosen to
archive it doesn't make it an archive itself.

Anno
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Share-Point-2010 ,Share-Point -2010 Training , Share-point-2010Hyderabad , Share-point-2010 Institute Saraswati lakki ASP .Net 0 01-06-2012 06:39 AM
SOLVED - can't open file in windows media player / WMP. But can in VLC - video LAN .. Now can in WMP jameshanley39@yahoo.co.uk Computer Information 2 09-19-2007 02:53 AM
Want to replace WMP 10 visualizations with ones from Wmp 8/9 blnstr Computer Support 1 12-08-2006 04:43 AM
3550 -- SMI vs. EMI Rick Kunkel Cisco 2 07-16-2003 01:41 AM
Catalyst 3550 EMI Upgrade Kit (CD-3550-EMI=) problem! show version = SMI desdronox Cisco 1 07-10-2003 02:08 AM



Advertisments