Skip to content

Commit 1a55105

Browse files
committed
Add STDOUT infomation of importing for the sake of simplicity
1 parent cb835f9 commit 1a55105

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/ever2boost/evernote_authorizer.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def fetch_notes(filter)
4848
# get latest 250 notes
4949
# TODO: display message like "ignored first #{(number_of_notes - 250).to_s} notes due to EvernoteAPI access limitation" if number_of_notes > 250
5050
start_index = number_of_note > 250 ? number_of_note - 250 : 0
51-
self.note_store.findNotesMetadata(self.developer_token, filter, start_index, number_of_note, spec)
51+
self.note_store.findNotesMetadata(self.developer_token, filter, start_index, 1, spec)
5252
end
5353

5454
# Download the all of notes fron Evernote and generate Boostnote storage from it
@@ -65,8 +65,9 @@ def import(output_dir)
6565
note_guids = self.fetch_notes(filter).notes.map(&:guid)
6666
# TODO: assign the booleans
6767
en_notes = note_guids.map {|note_guid| self.note_store.getNote(self.developer_token, note_guid, true, true, false, false)}
68-
en_notes. each do |en_note|
68+
en_notes.each do |en_note|
6969
note = Note.new(title: en_note.title, content: en_note.content, notebook_guid: en_note.notebookGuid)
70+
puts "importing #{find_notebook_by_guid_from_notebook_list(notebook_list, note).title}"
7071
notebook_list.each do |list|
7172
# TODO: break if note not found
7273
CsonGenerator.output(list.hash, note, output_dir) if list.guid == note.notebook_guid
@@ -87,5 +88,11 @@ def abort_with_message(exception)
8788
raise exception
8889
end
8990
end
91+
92+
def find_notebook_by_guid_from_notebook_list(notebook_list, note)
93+
notebook_list.map do |nl|
94+
nl if note.notebook_guid == nl.guid
95+
end.compact.first
96+
end
9097
end
9198
end

0 commit comments

Comments
 (0)