File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 9
9
require 'readline'
10
10
require 'socket'
11
11
12
+ if not defined? ( OAI ::Const ::VERBS )
13
+ require 'oai/constants'
14
+ end
15
+
12
16
require 'oai/client'
13
17
require 'oai/harvester/config'
14
18
require 'oai/harvester/harvest'
Original file line number Diff line number Diff line change 5
5
module OAI
6
6
module Harvester
7
7
8
- LOW_RESOLUTION = "YYYY-MM-DD"
8
+ LOW_RESOLUTION = OAI :: Const :: Granularity :: LOW
9
9
10
10
class Config < OpenStruct
11
11
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ def harvest(site)
38
38
harvest_time = Time . now . utc
39
39
end
40
40
41
- if "YYYY-MM-DD" == granularity ( opts [ :url ] )
41
+ if OAI :: Const :: Granularity :: LOW == granularity ( opts [ :url ] )
42
42
opts [ :until ] = harvest_time . strftime ( "%Y-%m-%d" )
43
43
opts [ :from ] = @from . strftime ( "%Y-%m-%d" ) if @from
44
44
else
@@ -139,7 +139,7 @@ def filename(from_time, until_time)
139
139
"#{ from_time . strftime ( format ) } _til_#{ until_time . strftime ( format ) } " \
140
140
"_at_#{ until_time . strftime ( '%H-%M-%S' ) } "
141
141
end
142
-
142
+
143
143
def granularity ( url )
144
144
client = OAI ::Client . new url
145
145
client . identify . granularity
@@ -149,7 +149,7 @@ def granularity(url)
149
149
def earliest ( url )
150
150
client = OAI ::Client . new url
151
151
identify = client . identify
152
- if "YYYY-MM-DD" == identify . granularity
152
+ if OAI :: Const :: Granularity :: LOW == identify . granularity
153
153
Time . parse ( identify . earliest_datestamp ) . strftime ( "%Y-%m-%d" )
154
154
else
155
155
Time . parse ( identify . earliest_datestamp ) . xmlschema
You can’t perform that action at this time.
0 commit comments