feature(helioviewer): add an additional column to the --list output to specify instruments/modes
This commit is contained in:
+9
-2
@@ -66,6 +66,11 @@ def sources():
|
||||
return sorted(out)
|
||||
|
||||
|
||||
def cli_value(path):
|
||||
"""Baut aus dem Pfad einen CLI-Wert, den pick() garantiert wiederfindet."""
|
||||
return "_".join(p.lower().replace(" ", "_") for p in path)
|
||||
|
||||
|
||||
def pick(needle):
|
||||
"""Sucht eine Datenquelle anhand eines Substrings im Nickname/Pfad."""
|
||||
hits = [
|
||||
@@ -82,7 +87,9 @@ def pick(needle):
|
||||
def main():
|
||||
if "--list" in sys.argv:
|
||||
for sid, path, nick in sources():
|
||||
print(f"{sid:4d} {'/'.join(path):40s} {nick}")
|
||||
print(
|
||||
f"{sid:4d} {'/'.join(path):40s} {nick:22s} {cli_value(path)}"
|
||||
)
|
||||
return
|
||||
|
||||
if "--sources" in sys.argv:
|
||||
@@ -124,7 +131,7 @@ def main():
|
||||
sys.exit(f"unexpected response ({ctype}): {png[:200]!r}")
|
||||
|
||||
stamp = meta["date"].replace(":", "").replace("-", "").replace(" ", "_")
|
||||
name = f"{stamp}_{nick.replace(' ', '')}.png"
|
||||
name = f"{stamp}_{cli_value(path)}.png"
|
||||
with open(name, "wb") as f:
|
||||
f.write(png)
|
||||
print(f"-> {name} ({len(png) / 1e6:.1f} MB)")
|
||||
|
||||
Reference in New Issue
Block a user