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 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
- $ bundle install
11
- $ bundle exec ruby archdown.rb -y 1700-1830
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
  ```
@@ -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
- @client.search(@search_terms.merge(:page => page))
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?
@@ -1,3 +1,3 @@
1
1
  module Archdown
2
- VERSION = '0.4'
2
+ VERSION = '0.4.1'
3
3
  end
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: '0.4'
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-07-14 00:00:00.000000000 Z
12
+ date: 2014-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: archivist-client