Public feed
#529604
my $nfo_file = "temp.nfo";#put this in properties file i.e. get this dynamically
&nfo;
&parse;
sub parse {
my @asterisk;
my $year;
my $album;
my $temp1; my $temp2;
#avoid use of global variables .. can prove out be royal pain once you start adding more functionality to the progs.
open(INFILE, $nfo_file) or die "WER DA FUK IS DA FILE?! - $!"; # self-explantory
print("lol it werkz lol\n"); # it worked
while (<INFILE>) {
push (@asterisk, split(/\n/));
}
$temp1 = $asterisk[4]; # assign raw album to $temp1
$temp2 = $asterisk[7]; # assign raw release date to $temp2
close(INFILE);
chomp $temp1; chomp $temp2; # remove newline & forward slash.
chop $temp1; chop $temp2; # same as above
# I would prefer regex.
$album = substr($temp1, 8); # shave off NFO formatting
$year = substr($temp2, 11); # same as above
print ("Year: ", $year, "\nAlbum: ", $album);
}
sub nfo {
my $nfo_gen = "tag *.mp3 --nocheck --nfo $nfo_file";
system($nfo_gen) or print STDERR "WDF JUS HAPND?! - $!";
print $nfo;
}