Created
April 15, 2020 02:52
-
-
Save nhalstead/d0804bab713f1a3b0875578accf1f465 to your computer and use it in GitHub Desktop.
GNotes to Joplin Import Format, This will convert a GNotes Export into a plain text import for Joplin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import sys | |
import time | |
dataIn = float(sys.stdin.read()) | |
os.utime(sys.argv[1], (dataIn, dataIn)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Must be run in the folder containing the desired gnotes backup | |
BASE=/tmp/gnotes | |
rm -Rf $BASE | |
IFS=$'\n' | |
for N in `find ./ -maxdepth 1 -mindepth 1 -type d ` | |
do | |
FOLDER=$N | |
mkdir -p $BASE/$FOLDER | |
echo "Scan: $N" | |
for SUB in `find $N/ -mindepth 1 -type d` | |
do | |
echo " Found ${SUB}" | |
TITLE=`sed 's/.*<p class="note_content">//;s/&/a/g;s/ / /g;s/"/"/g;s/<br>/\n/g;s:</p>.*$::' $SUB/content.html | head -n1|sed 's#/#_#'` | |
TITLE=`echo $TITLE | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]'` | |
sed 's/.*<p class="note_content">//;s/ / /g;s/&/\&/g;s/>/\>/g;s/</\</g;s/"/"/g;s/<br>/\n/g;s:</p>.*$::' $SUB/content.html > $BASE/$FOLDER/$TITLE.txt | |
# Write Timestamp To File | |
cat $SUB/content.html | grep -Po '<input type="hidden" name="X-Modified-Date" value="([0-9]*)" \/>' | sed 's/[a-zA-Z\s\-\"\<\>\/\-\=\ \-]*//g' | cut -c -10 | ./convert_ts.py "$BASE/$FOLDER/$TITLE.txt" | |
echo "Written to ${N}/${SUB}" | |
# exit | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment