You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I propose a rednotebook 2 journee converter. It has to be improved.
from os import listdir
from os.path import isfile, join
import re
sourcedir = '../01_datainput/'
destdir = '../02_dataoutput/'
sourcefiles = [f for f in listdir(sourcedir) if isfile(join(sourcedir, f))]
for sourcefile in sourcefiles:
f = open((sourcedir + sourcefile), "r")
daynote=""
isfirstmounthday = True
for line in f:
newdaysearch = re.search("^.[0-9]:$", line)
if newdaysearch: # is it the line that contains the new day?
if not isfirstmounthday: # if it is not the first day of the file, I have to save the gathered information
if isopensinglequotepresent:
daynote = daynote[::-1]
daynote = daynote.replace("'", "", 1)
daynote = daynote[::-1]
daynote=daynote.replace('\\n', '\n').replace('\\t', '\t')
fwrite=open((destdir + filedestname), "w")
fwrite.write(daynote)
fwrite.close()
daynote=""
#let's compute the new filename
newdaystring=line.replace(":","")
newdaystring=newdaystring.replace(" ","")
newdaystring = newdaystring.replace('\n' '', "")
filedestname=sourcefile.replace(".txt","")
filedestname=filedestname+'-'+newdaystring+".txt"
isfirstmounthday = False
else:
if daynote == "":
isopensinglequotepresent = False
line=line.replace(" text: ","")
if line[0] == "'":
line = line.replace("'", "",1)
isopensinglequotepresent=True
#if not re.search(". *'$",line):
daynote=daynote + line
# saving the last day in the file
if isopensinglequotepresent:
daynote = daynote[::-1]
daynote = daynote.replace("'", "", 1)
daynote = daynote[::-1]
daynote = daynote.replace('\\n', '\n').replace('\\t', '\t')
fwrite = open((destdir + filedestname), "w")
fwrite.write(daynote)
fwrite.close()
f.close()
The text was updated successfully, but these errors were encountered:
Wow, thanks for this. I actually used rednotebook before I built this, and this is a really useful conversion script. I might use this manually or archive this somewhere. If this could be ported to js/ts perhaps I could add a feature where people could import their rednotebook ?
Hi, I propose a rednotebook 2 journee converter. It has to be improved.
The text was updated successfully, but these errors were encountered: