Skip to content

Commit

Permalink
add --download-only option
Browse files Browse the repository at this point in the history
This just downloads, resizes, and saves the picture.  The desktop
wallpaper will not be changed.
  • Loading branch information
mschout committed Apr 14, 2010
1 parent c9ccd71 commit da38946
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -6,6 +6,7 @@ Revision history for ng-daily-wallpaper
- add --prev option to get previous pictures of the day
- change file storage organization, saving originals under $dir/orig, and
resized images under $dir/WIDTHxHEIGHT
- add --download-only option which just downloads and resizes the picture

0.02 2010-04-01
- initial release
29 changes: 19 additions & 10 deletions bin/ng-daily-wallpaper
Expand Up @@ -12,16 +12,18 @@ use WWW::Mechanize;
use X11::Resolution;

my %opts = (
monitors => 1,
prev => 0,
dir => "$ENV{HOME}/Pictures/National Geographic"
monitors => 1,
prev => 0,
'download-only' => 0,
dir => "$ENV{HOME}/Pictures/National Geographic"
);

GetOptions(\%opts,
'monitors|m=i',
'prev|p=i',
'dir|d=s',
'date=s') or pod2usage;
'date=s',
'download-only') or pod2usage;

my $url =
'http://photography.nationalgeographic.com/photography/photo-of-the-day/';
Expand All @@ -31,7 +33,9 @@ my $tempfile = download_picture();

if (-e $tempfile) {
my $scalefile = resize_picture($tempfile);
system qw(gconftool-2 --type string --set /desktop/gnome/background/picture_filename), $scalefile;
unless ($opts{'download-only'}) {
system qw(gconftool-2 --type string --set /desktop/gnome/background/picture_filename), $scalefile;
}
}

sub get_resolution {
Expand Down Expand Up @@ -123,11 +127,12 @@ __END__
ng-daily-wallpaper [options]
Options:
--help display this help message
--monitors number of displays
--dir directory where images are saved
--date use previously downloaded picture for this date
--prev get Nth previoius picture of the day (up to 3)
--help display this help message
--monitors number of displays
--dir directory where images are saved
--date use previously downloaded picture for this date
--prev get Nth previoius picture of the day (up to 3)
--download-only only download picture (do not set as wallpaper)
=head1 DESCRIPTION
Expand All @@ -150,6 +155,10 @@ Set directory where images are saved.
default: C<$HOME/Pictures/National Geographic>
=item B<--download-only>
Just download the picture and resize it. Do not set as desktop wallpaper
=item B<--monitors, -m>
Set the number of displays in use. The picture will be scaled to fit on exactly one display.
Expand Down

0 comments on commit da38946

Please sign in to comment.