+
+ |
+$today_long |
+ |
+
+
EOF
close (INDEX);
}
@@ -259,7 +371,7 @@ sub directDownload ($$) {
my $cDir = $date->{'mon2'} . $date->{'year2'};
my $cDate = $date->{'day2'};
- my $cmd = "wget -q $file --referer=\"" . $comics->{$comic}{'url'} ."\" --user-agent=\"$USER_AGENT\" -O - | /usr/bin/convert - jpeg:images/$cDir/$comic-$cDate.jpg";
+ my $cmd = "wget -q $file --referer=\"" . $comics->{$comic}{'url'} ."\" --user-agent=\"$USER_AGENT\" -O - | /usr/bin/convert - jpeg:images/$cDir/$comic-$cDate.jpg";
return system($cmd);
}
@@ -271,13 +383,20 @@ sub indexDownload ($$) {
my ( @lines, $comicLine, $mainURL );
my $comicIndex = "indexes/index.$comic";
- `wget -q $comics->{$comic}{'url'} -O $comicIndex`;
+ my $wget_cmd = "wget -q --referer=\"$comics->{$comic}{'url'}\" " .
+ "--user-agent=\"$USER_AGENT\" " .
+ "$comics->{$comic}{'url'} -O $comicIndex";
+ system($wget_cmd);
if ( ! open FILEN, "<$comicIndex" ) {
return "ERROR: Can't open index file for " . $comics->{$comic}{'fullName'} .
" (" . $comics->{$comic}{'url'} . ")";
}
- @lines = ;
+ while () {
+ my $line = $_;
+ $line =~ s/\R|\ \ +|\t//g if ( $comics->{$comic}{'remove_newliens'} );
+ push @lines, $line;
+ }
close (FILEN);
unlink ("$comicIndex");
@@ -291,10 +410,10 @@ sub indexDownload ($$) {
## Find the comic strip URL based on the specified regex in the search
##
foreach my $line (@lines) {
- if ( $line =~ m/$comics->{$comic}{'search'}/ ) {
+ if ( $line =~ m/$comics->{$comic}{'search'}/i ) {
$comicLine = $1; chomp $comicLine;
}
- }
+ }
##
## Save the file to the appropriate directory
@@ -305,7 +424,7 @@ sub indexDownload ($$) {
if ( $comicLine ) {
if ( $comicLine =~ m/(gif|jpg|png)/i ) { $comics->{$comic}{'ext'} = $1; }
my $comicURL = ( $comicLine =~ m/http/ ) ? $comicLine : $mainURL . $comicLine;
- my $cmd = "wget --user-agent=\"$USER_AGENT\" --referer=\"" . $comics->{$comic}{'url'} . "\" -q $comicURL -O - | /usr/bin/convert - jpeg:images/$cDir/$comic-$cDate.jpg";
+ my $cmd = "wget --user-agent=\"$USER_AGENT\" --referer=\"" . $comics->{$comic}{'url'} . "\" -q $comicURL -O images/$cDir/$comic-$cDate.$comics->{$comic}{'ext'}";
system( $cmd );
return 0;
}
@@ -345,6 +464,8 @@ sub fetchDates () {
$dates{'day2'} = ( $dates{'day'} < 10 ) ? "0" . $dates{'day'} : $dates{'day'};
$dates{'mon'}++;
$dates{'mon2'} = ( $dates{'mon'} < 10 ) ? "0".$dates{'mon'} : $dates{'mon'};
+ my @days = qw/ Sunday Monday Tuesday Wednesday Thursday Friday Saturday /;
+ $dates{'wday'} = $days[$dates{'dow'}];
return %dates;
}
|