L1: deutsche P2S-Anleitung als Ressource hinterlegt
Herb-Hinweis: https://wiki.bambulab.com/de/p2s/manual/p2s-intro ist Bambus offizielle deutsche Anleitung fuer den P2S, passt sinngemaess auch fuer unsere P1S + X1C (alle drei geschlossen, gleiches Layout). Der A1 mini ist anders und braucht eigene Quelle. - seed.py: aufgabe_md von L1 enthaelt den Link - migrations/2026-05-24_l1_p2s_link.py: idempotenter Update fuer bestehende DB-Stände, ergaenzt nur wenn Link noch nicht drin - docs/lektion-L1-drucker-kennenlernen.md: Sektion "Externe Ressourcen" ergaenzt mit beiden Links (Academy + P2S-Wiki)
This commit is contained in:
52
migrations/2026-05-24_l1_p2s_link.py
Normal file
52
migrations/2026-05-24_l1_p2s_link.py
Normal file
@@ -0,0 +1,52 @@
|
||||
"""Migration 2026-05-24: L1 bekommt Hinweis auf die deutsche P2S-Anleitung.
|
||||
|
||||
Hintergrund: Herb hat darauf hingewiesen, dass es auf
|
||||
https://wiki.bambulab.com/de/p2s/manual/p2s-intro
|
||||
eine deutsche Anleitung speziell fuer unseren P2S gibt. Da 3 unserer
|
||||
4 Drucker P1S/X1C/P2S sind und die P2S-Anleitung am aktuellsten ist,
|
||||
binden wir den Link in L1 ein.
|
||||
|
||||
Idempotent: Update wird nur ausgefuehrt, wenn der Link noch nicht im
|
||||
aufgabe_md drin ist.
|
||||
"""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
||||
from database import get_db
|
||||
|
||||
|
||||
P2S_LINK_DE = "https://wiki.bambulab.com/de/p2s/manual/p2s-intro"
|
||||
P2S_HINWEIS = (
|
||||
"\n\n**Anleitung speziell fuer unsere geschlossenen Drucker (Deutsch):** "
|
||||
f"<{P2S_LINK_DE}>\n"
|
||||
"Die P2S-Anleitung passt sinngemaess auch fuer P1S/X1C, "
|
||||
"der A1 mini ist ein anderer Drucker (offenes Gehaeuse — Haende weg vom Hotend!)."
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
conn = get_db()
|
||||
row = conn.execute(
|
||||
"SELECT aufgabe_md FROM lektion WHERE nummer = 1"
|
||||
).fetchone()
|
||||
if not row:
|
||||
print("[migration] L1 noch nicht in DB — Skip (seed.py legt es spaeter mit Hinweis an).")
|
||||
conn.close()
|
||||
return
|
||||
if P2S_LINK_DE in (row["aufgabe_md"] or ""):
|
||||
print("[migration] L1 enthaelt P2S-Link bereits — nichts zu tun.")
|
||||
conn.close()
|
||||
return
|
||||
neu = (row["aufgabe_md"] or "") + P2S_HINWEIS
|
||||
conn.execute(
|
||||
"UPDATE lektion SET aufgabe_md = ? WHERE nummer = 1",
|
||||
(neu,)
|
||||
)
|
||||
conn.commit()
|
||||
conn.close()
|
||||
print(f"[migration] L1 aufgabe_md um P2S-Link ergaenzt ({len(P2S_HINWEIS)} Zeichen).")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user