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 account_note_exporter(local_account_path)
account_id = File.basename(local_account_path)
sqlite3_db_path = "#{local_account_path}/localNoteStore/LocalNoteStore.sqlite"
sqlite3_db_connection = SQLite3::Database.new(sqlite3_db_path)
csv_export_filename = "evernote-#{account_id}-#{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(local_account_path, 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, account_id)
note_index += 1
end
end
puts "Export evernote(#{account_id}) notes to #{csv_export_filename}, Done!"
puts "Execute `open #{csv_export_filename}`\n"
end
|