add script that could be useful
This commit is contained in:
parent
16a2b9880e
commit
8542a9f675
2 changed files with 33 additions and 0 deletions
28
extract-hinweise.py
Executable file
28
extract-hinweise.py
Executable file
|
@ -0,0 +1,28 @@
|
|||
#! /usr/bin/python3
|
||||
"""Extract the note texts from a notes.osn file to make them printable."""
|
||||
import sys
|
||||
|
||||
|
||||
def condprint(printstr):
|
||||
if not printstr.isspace():
|
||||
print(printstr.strip().replace(
|
||||
""", '"').replace("newline", "\n"))
|
||||
|
||||
|
||||
with open(sys.argv[1], "rt") as file:
|
||||
useline = False
|
||||
for line in file:
|
||||
if useline:
|
||||
if '</div>' in line:
|
||||
condprint(line.split('</div>')[0])
|
||||
useline = False
|
||||
else:
|
||||
condprint(line)
|
||||
else:
|
||||
if "<name>" in line:
|
||||
condprint("newline" +
|
||||
line.split('<name>')[1].split('</name>')[0])
|
||||
if '<div class="note-comment-text">' in line:
|
||||
condprint(line.split('<div class="note-comment-text">'
|
||||
)[1].split('</div>')[0])
|
||||
useline = '</div>' not in line
|
|
@ -34,6 +34,11 @@
|
|||
ein Shell-Skript zum umbenennen von Bildern, wobei das Datum als Dateiname genutzt wird
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="extract-hinweise.py">
|
||||
ein Python-Skript zum Heraussuchen von den Beschreibungen von OSM-Notes aus .osn-Dateien, siehe auch "Tricks und Anleitungen"
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="listLinks.sh">
|
||||
ein Shell-Skript zum Finden und auflisten aller symlinks in einem Ordner inklusive verlinktem Ort
|
||||
|
|
Loading…
Reference in a new issue