← Back to team overview

ubuntu-phone team mailing list archive

Re: exporting notes

 

El día Wednesday, September 09, 2015 a las 10:57:24AM +0200, Michael Zanetti escribió:

> Hi Matthias,
> 
> the notes are stored in ~/.local/share/com.ubuntu.reminders/. However,
> they are stored in ENML format (similar to html, with some Evernote
> specific extensions) which probably isn't what you want.
> 
> I think way to go here would be to add a feature to export the notes via
> content hub, either as plaintext or HTML. I can put that on my todo list
> but it might not happen really soon.
> 
> Br,
> Michael

Hi Michael,

Here is what I have found out meanwhile and what I use for export; this
fits what I need. Thanks for your hint in any case.

	matthias



The app 'notas' (real name 'reminders') stores the.local/share/com.ubuntu.reminders/@local as:

$ cat notes.cache
[notebooks]
4d853cee-9476-4e19-82fe-5f577b01698e=2

[notes]
a0ae2c53-1c7d-4d2a-b1c5-ea876e3f4ca1=10
da5e2110-d1a8-4470-a8bc-d5115720db57=21
efc58768-d28a-4df0-9e41-4893e5c2af54=2

deleted notes stay in the directory, like this one:

    note-09f23799-df97-40f9-b4ff-6835688ed644.enml  (a deleted one)

they are just not referenced in the notes.cache file, like this one
which is still valid:

    note-efc58768-d28a-4df0-9e41-4893e5c2af54.enml  (a valid one)

for every note exist two files, a *.info file and the note itself in *.enml file:

$ ls -l
total 40
-rw-rw-r-- 1 phablet phablet 133 sep  7 17:17 note-09f23799-df97-40f9-b4ff-6835688ed644.enml
-rw------- 1 phablet phablet 427 sep  7 17:17 note-09f23799-df97-40f9-b4ff-6835688ed644.info
-rw-rw-r-- 1 phablet phablet 567 sep  8 15:36 note-a0ae2c53-1c7d-4d2a-b1c5-ea876e3f4ca1.enml
-rw------- 1 phablet phablet 522 sep  8 15:36 note-a0ae2c53-1c7d-4d2a-b1c5-ea876e3f4ca1.info
-rw------- 1 phablet phablet 110 sep  7 17:33 notebook-4d853cee-9476-4e19-82fe-5f577b01698e.info
-rw-rw-r-- 1 phablet phablet 725 sep  8 06:35 note-da5e2110-d1a8-4470-a8bc-d5115720db57.enml
-rw------- 1 phablet phablet 529 sep  8 06:35 note-da5e2110-d1a8-4470-a8bc-d5115720db57.info
-rw-rw-r-- 1 phablet phablet 318 sep  9 11:26 note-efc58768-d28a-4df0-9e41-4893e5c2af54.enml
-rw------- 1 phablet phablet 530 sep  9 11:26 note-efc58768-d28a-4df0-9e41-4893e5c2af54.info
-rw------- 1 phablet phablet 179 sep  9 11:26 notes.cache

the *.enml files contain the notes itself, HTML snipsets packed in XML, text is in UTF-8
encoded:

$ cat note-efc58768-d28a-4df0-9e41-4893e5c2af54.enml
<?xml version="1.0"?><!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd";><en-note>
<p style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; padding-left:0px; text-indent:0px;"><br/></p>
<p style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; padding-left:0px; text-indent:0px;">9 de septiembre</p>
<p style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; padding-left:0px; text-indent:0px;"><br/></p>
<ul><li>día de compras en la tienda de la Coop. Possidenti Oliveti Limone sul Garda, por unos 88 euro aceite del lugar, vino, etc.</li>
<li>gasolinera 43 euro, debe alcanzar la casa,</li>
<li>...<br/></li></ul></en-note>


as the titel of the note is stored in the *.info file, it is a good idea
to repeat the title in the note itself, for example if you have one note
for any day, as I did showed it here with title "9 de septiembre";

I read the notes for export with a small script like this, based on the
order in the notes.cache file:

#!/bin/sh

cd ~/.local/share/com.ubuntu.reminders/@local

foundnotes=0

while read line; do
  echo $line | fgrep -q '[notes]' && {
    foundnotes=1
    continue
  }
  if [ $foundnotes = 1 ]; then
    name=`echo $line | sed 's/=.*$//'`
    echo note-$name
    cat note-$name.enml
    echo
    echo
  else
    continue
  fi
done < notes.cache

exit

-- 
Matthias Apitz, ✉ guru@xxxxxxxxxxx, 🌐 http://www.unixarea.de/  ☎ +49-176-38902045
No! Nein! ¡No! Όχι! -- Ευχαριστούμε!


References