picasaweb-backup 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -10
- data/bin/picasaweb-backup +14 -8
- data/lib/picasaweb-backup.rb +24 -8
- data/lib/{picasaweb-backup/version.rb → version.rb} +1 -1
- data/picasaweb-backup.gemspec +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -3,22 +3,26 @@
|
|
3
3
|
A gem and executable to backup all your photos stored on Google's Picasaweb
|
4
4
|
service.
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
Add this line to your application's Gemfile:
|
9
|
-
|
10
|
-
gem 'picasaweb-backup'
|
11
|
-
|
12
|
-
And then execute:
|
13
|
-
|
14
|
-
$ bundle
|
6
|
+
The original code came from http://blog.costan.us/2010/01/automated-backup-for-picasa-web-albums.html
|
15
7
|
|
16
|
-
|
8
|
+
## Installation
|
17
9
|
|
18
10
|
$ gem install picasaweb-backup
|
19
11
|
|
20
12
|
## Usage
|
13
|
+
```
|
14
|
+
_ _ _ _
|
15
|
+
_ __(_)__ __ _ _____ ___ __ _____| |__ ___| |__ __ _ __| |___ _ _ __
|
16
|
+
| '_ \ / _/ _` (_-< _` \ V V / -_) '_ \___| '_ \ _` / _| / / || | '_ \
|
17
|
+
| .__/_\__\__,_/__\__,_|\_/\_/\___|_.__/ |_.__\__,_\__|_\_\\_,_| .__/
|
18
|
+
|_| |_|
|
21
19
|
|
20
|
+
version 0.2.0
|
21
|
+
|
22
|
+
Options
|
23
|
+
--dir DIR optional directory in which the download should be executed
|
24
|
+
-h, --help print this help section
|
25
|
+
```
|
22
26
|
Create an empty folder an place a file called `account.yml` with the following
|
23
27
|
content:
|
24
28
|
|
data/bin/picasaweb-backup
CHANGED
@@ -18,6 +18,11 @@ opt_parser = OptionParser.new('Backing up your Picasaweb photos') do |opt|
|
|
18
18
|
opt.on("--dir DIR", "optional directory in which the download should be executed") do |dir|
|
19
19
|
opts[:dir] = dir
|
20
20
|
end
|
21
|
+
|
22
|
+
opt.on "-l","--log", "log to a file instead of stout" do
|
23
|
+
opts[:log] = true
|
24
|
+
end
|
25
|
+
|
21
26
|
opt.on("-h","--help", "print this help section") do
|
22
27
|
puts opt_parser
|
23
28
|
exit 0
|
@@ -25,11 +30,12 @@ opt_parser = OptionParser.new('Backing up your Picasaweb photos') do |opt|
|
|
25
30
|
end
|
26
31
|
|
27
32
|
opt_parser.parse!(ARGV)
|
33
|
+
cli = Picasaweb::CLI.new opts
|
28
34
|
|
29
35
|
begin
|
30
36
|
|
31
37
|
if opts[:dir]
|
32
|
-
|
38
|
+
cli.print "Changing working directory to #{opts[:dir]}"
|
33
39
|
Dir.chdir opts[:dir]
|
34
40
|
end
|
35
41
|
|
@@ -49,11 +55,11 @@ begin
|
|
49
55
|
|
50
56
|
if !File.directory? album[:title]
|
51
57
|
Dir.mkdir album[:title]
|
52
|
-
|
58
|
+
cli.print "Creating directory for album '#{album[:title]}'"
|
53
59
|
end
|
54
60
|
|
55
61
|
Dir.chdir album[:title] do
|
56
|
-
|
62
|
+
cli.print "Checking for new files in '#{album[:title]}'"
|
57
63
|
photos = nil
|
58
64
|
until photos
|
59
65
|
begin
|
@@ -66,7 +72,7 @@ begin
|
|
66
72
|
downloaded_photos = 0
|
67
73
|
photos.each do |photo|
|
68
74
|
if !File.exists? photo[:title]
|
69
|
-
|
75
|
+
cli.print " ==> #{photo[:title]}"
|
70
76
|
response = nil
|
71
77
|
until response
|
72
78
|
begin
|
@@ -81,13 +87,13 @@ begin
|
|
81
87
|
end
|
82
88
|
end
|
83
89
|
if downloaded_photos == 0
|
84
|
-
|
90
|
+
cli.print "==> no new photos found"
|
85
91
|
end
|
86
92
|
end
|
87
93
|
end
|
88
94
|
rescue => e
|
89
|
-
|
90
|
-
|
91
|
-
|
95
|
+
cli.print "ERROR: #{e.message}".red
|
96
|
+
cli.print ""
|
97
|
+
cli.print opt_parser
|
92
98
|
end
|
93
99
|
|
data/lib/picasaweb-backup.rb
CHANGED
@@ -3,18 +3,34 @@
|
|
3
3
|
# The script downloads the original version of the photos, and is not limited to
|
4
4
|
# 1600x1200 thumbnails.
|
5
5
|
#
|
6
|
-
#
|
7
|
-
# Copyright:: Copyright (C) 2010 Victor Costan
|
6
|
+
# Authors:: Victor Costan, Leonard Ehrenfried
|
8
7
|
# License:: MIT
|
9
8
|
|
10
|
-
require "
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
9
|
+
require "version"
|
10
|
+
require "yaml"
|
11
|
+
require "rubygems"
|
12
|
+
require "gdata"
|
13
|
+
require "logger"
|
14
14
|
|
15
15
|
module Picasaweb
|
16
|
-
|
17
|
-
|
16
|
+
class CLI
|
17
|
+
|
18
|
+
def initialize opts
|
19
|
+
@opts = opts
|
20
|
+
if @opts[:log]
|
21
|
+
@logger = Logger.new "picasaweb-backup.log", shift_age = "monthly"
|
22
|
+
@logger.datetime_format = "%Y-%m-%d %H:%M"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def print msg
|
27
|
+
if @logger
|
28
|
+
@logger.info msg
|
29
|
+
else
|
30
|
+
puts msg
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
18
34
|
end
|
19
35
|
end
|
20
36
|
|
data/picasaweb-backup.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picasaweb-backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gdata_19
|
@@ -76,7 +76,7 @@ files:
|
|
76
76
|
- Rakefile
|
77
77
|
- bin/picasaweb-backup
|
78
78
|
- lib/picasaweb-backup.rb
|
79
|
-
- lib/
|
79
|
+
- lib/version.rb
|
80
80
|
- picasaweb-backup.gemspec
|
81
81
|
homepage: http://github.com/lenniboy/picasaweb-backup
|
82
82
|
licenses: []
|