Class: EvernoteExporter

Inherits:
Object
  • Object
show all
Defined in:
lib/evernote-exporter.rb

Class Method Summary collapse

Class Method Details

.account_note_exporter(local_account_path) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/evernote-exporter.rb', line 38

def ()
   = File.basename()
  sqlite3_db_path = "#{}/localNoteStore/LocalNoteStore.sqlite"
  sqlite3_db_connection = SQLite3::Database.new(sqlite3_db_path)

  csv_export_filename = "evernote-#{}-#{Time.now.strftime('%y%m%d%H%M')}.csv"
  CSV.open(csv_export_filename, "wb") do |csv_row|
    csv_row << ['笔记本组', '笔记本', '标题', '更新时间', '笔记大小', '存储大小', '存储大小(格式化)', '存储路径']

    note_index = 1
    note_count = sqlite3_db_connection.execute(sql_note_count).to_a.flatten[0]
    sqlite3_db_connection.prepare(sql_note_list).execute.each_hash do |record|
      filesize_hash = _local_note_filesize(, record['uuid'])
      csv_row << [record['zstack'], record['zname'], record['title'], record['updated_at'], record['note_size'], filesize_hash[:local_note_size], filesize_hash[:local_note_size_human], filesize_hash[:local_note_path]]
      set_progress(note_index, note_count, )
      note_index += 1
    end
  end

  puts "Export evernote(#{}) notes to #{csv_export_filename}, Done!"
  puts "Execute `open #{csv_export_filename}`\n"
end

.doObject



28
29
30
31
32
33
34
35
36
# File 'lib/evernote-exporter.rb', line 28

def do
  whoami = `whoami`.strip
   = "/Users/#{whoami}/Library/Application Support/com.yinxiang.Mac/accounts/app.yinxiang.com"

  Dir.glob([, '*'].join('/')) do ||
    ()
    puts "\n"
  end
end