If you use Everpad you can use the following script to export your notes to html files. The script will write the notes into ~/exported_notes and the notes will be sorted under folders with their notebook names:
import os
import sys
import datetime
import sqlite3
export_path = os.getenv("HOME") + '/exported_notes'
#Create directory if it does not exist
if not os.path.exists(export_path):
os.makedirs(export_path)
# Create a connection to the database.
filename = os.getenv("HOME") + '/.everpad/everpad.5.db'
conn = sqlite3.connect(filename, detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
# Create a cursor object to do the interacting.
c = conn.cursor()
# Grab the columns we need.
sql = 'SELECT notebooks.name, notes.title, notes.content FROM notes'
sql += ' inner join notebooks on notes.notebook_id = notebooks.id'
rows = c.execute(sql)
# Iterate over the result.
for row in rows:
note_path = export_path + '/' + row[0].replace("/", "_")
note_path = note_path.replace(" ", "_");
if not os.path.exists(note_path):
os.makedirs(note_path)
note_path += '/' + row[1].replace("/", "_") + '.html'
note_path = note_path.replace(" ", "_");
note = open(note_path, 'a+')
note.write('<h1>'+row[1].encode('utf-8')+'</h1></br>')
note.write(row[2].encode('utf-8'))
note.close()
# Commit the changes and close everything.
conn.commit()
c.close()
conn.close()
No comments:
Post a Comment