archdown 0.4 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +22 -2
- data/lib/archdown/download.rb +7 -1
- data/lib/archdown/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -6,11 +6,31 @@ Command-line utility to download books from archive.org using archivist-client
|
|
6
6
|
Example Usage
|
7
7
|
-------------
|
8
8
|
|
9
|
+
Download from the command-line:
|
10
|
+
|
9
11
|
```sh
|
10
|
-
$
|
11
|
-
$
|
12
|
+
$ gem install archdown
|
13
|
+
$ archdown -y 1700-1830
|
12
14
|
|
13
15
|
# ...
|
14
16
|
# downloads a lot of books into ./library
|
15
17
|
# ...
|
18
|
+
```
|
19
|
+
|
20
|
+
More advanced usage: use as a Ruby library. Here's an example of a query that downloads a book by archive.org identifier:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
d = Archdown::Download.new('library',
|
24
|
+
:filters => ["identifier:firstbooknapole00gruagoog"])
|
25
|
+
|
26
|
+
d.go!{ |metadata, librarian| puts m.inspect }
|
27
|
+
```
|
28
|
+
|
29
|
+
Or a set of books within a range of years:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
d = Archdown::Download.new('library',
|
33
|
+
:start_year => 1800, :end_year => 1850)
|
34
|
+
|
35
|
+
d.go!{ |metadata, librarian| puts m.inspect }
|
16
36
|
```
|
data/lib/archdown/download.rb
CHANGED
@@ -18,7 +18,13 @@ module Archdown
|
|
18
18
|
page = 1
|
19
19
|
loop do
|
20
20
|
books = ::Retriable.retriable :on => Faraday::Error::TimeoutError do
|
21
|
-
@
|
21
|
+
terms = @search_terms.merge(:page => page)
|
22
|
+
begin
|
23
|
+
@client.search(terms)
|
24
|
+
rescue e
|
25
|
+
$stderr.puts "Search Terms: #{JSON.pretty_generate(terms)}"
|
26
|
+
raise
|
27
|
+
end
|
22
28
|
end
|
23
29
|
|
24
30
|
break if books.empty?
|
data/lib/archdown/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: archdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.4.1
|
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: 2014-
|
12
|
+
date: 2014-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: archivist-client
|