use strict;
use LWP::Simple;

my %albums;
open(FILEWRITER,">> /var/www/cron/mc/172_30_11_23/raaga_data.txt");
open(FILEREADER,"/var/www/cron/mc/172_30_11_23/raaga_data.txt");
while(my $line = <FILEREADER>){
	chomp($line);
#	print $line;
	(my $album,my $artist) = split(/\-\-\-\-\-\-\-\->/,$line);
	#print $artist;
	$albums{$album} = $artist;
}
close(FILEREADER);
#while((my $key, my $val) = each(%albums)){
#	print $key."--".$val;
#}
my $output = get("http://www.raaga.com/channels/hindi/newreleases.asp");
my @albums = $output =~ /<tr valign=top>(.*?)<\/tr>/imsg;
foreach (@albums){
	my $movie="";
	if($_ =~ /<a href.*?>(.*?)<\/a>/ims){
		$movie = $1;
	}
	my @artists = $_ =~ /<td width=30% class=smlTxt>(.*?)&nbsp;<\/td>/imsg;
	my $cast = $movie."-------->".$artists[1];
	if(not exists($albums{$movie})){
		print FILEWRITER $cast."\n";
	}
}
close(FILEWRITER);
