Bump DSN lib version, cleanup output

This commit is contained in:
Joey Hines 2026-04-05 16:18:45 -06:00
parent dc4389de4c
commit fb74c90a55
Signed by: joeyahines
GPG Key ID: E99D8FB14855100E
4 changed files with 47 additions and 216 deletions

46
Cargo.lock generated
View File

@ -753,7 +753,7 @@ dependencies = [
"reqwest 0.12.15", "reqwest 0.12.15",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.12", "thiserror 2.0.18",
"url", "url",
] ]
@ -1102,7 +1102,7 @@ dependencies = [
[[package]] [[package]]
name = "fren" name = "fren"
version = "2.8.0" version = "2.8.1"
dependencies = [ dependencies = [
"axum 0.8.1", "axum 0.8.1",
"base64 0.22.1", "base64 0.22.1",
@ -1125,7 +1125,6 @@ dependencies = [
"reqwest 0.12.15", "reqwest 0.12.15",
"rust-dsn-parser", "rust-dsn-parser",
"serde", "serde",
"serde-xml-rs",
"serde_json", "serde_json",
"sha3", "sha3",
"songbird", "songbird",
@ -1133,7 +1132,7 @@ dependencies = [
"strum 0.27.2", "strum 0.27.2",
"symphonia", "symphonia",
"tera", "tera",
"thiserror 2.0.12", "thiserror 2.0.18",
"thousands", "thousands",
"tokio", "tokio",
"tonic", "tonic",
@ -2013,7 +2012,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"windows-targets 0.52.6", "windows-targets 0.48.5",
] ]
[[package]] [[package]]
@ -2461,7 +2460,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc"
dependencies = [ dependencies = [
"memchr", "memchr",
"thiserror 2.0.12", "thiserror 2.0.18",
"ucd-trie", "ucd-trie",
] ]
@ -2816,7 +2815,7 @@ dependencies = [
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
"rustls 0.23.20", "rustls 0.23.20",
"socket2", "socket2",
"thiserror 2.0.12", "thiserror 2.0.18",
"tokio", "tokio",
"tracing", "tracing",
] ]
@ -2835,7 +2834,7 @@ dependencies = [
"rustls 0.23.20", "rustls 0.23.20",
"rustls-pki-types", "rustls-pki-types",
"slab", "slab",
"thiserror 2.0.12", "thiserror 2.0.18",
"tinyvec", "tinyvec",
"tracing", "tracing",
"web-time", "web-time",
@ -3154,10 +3153,11 @@ dependencies = [
[[package]] [[package]]
name = "rust-dsn-parser" name = "rust-dsn-parser"
version = "0.3.0" version = "1.0.0"
source = "registry+https://git.ahines.net/joeyahines/_cargo-index.git" source = "registry+https://git.ahines.net/joeyahines/_cargo-index.git"
checksum = "d807c50dc3e665478a29740bf366bdb4b75c24062bb02a43a96780614f7b7e88" checksum = "af10324ae3be2ec3e6ae6584909d9a0ac01cdca566714550f679fa58343c28f6"
dependencies = [ dependencies = [
"thiserror 2.0.18",
"xml-rs", "xml-rs",
] ]
@ -3477,18 +3477,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "serde-xml-rs"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc2215ce3e6a77550b80a1c37251b7d294febaf42e36e21b7b411e0bf54d540d"
dependencies = [
"log",
"serde",
"thiserror 2.0.12",
"xml",
]
[[package]] [[package]]
name = "serde_cow" name = "serde_cow"
version = "0.1.2" version = "0.1.2"
@ -4256,11 +4244,11 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "2.0.12" version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
dependencies = [ dependencies = [
"thiserror-impl 2.0.12", "thiserror-impl 2.0.18",
] ]
[[package]] [[package]]
@ -4276,9 +4264,9 @@ dependencies = [
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "2.0.12" version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -4776,7 +4764,7 @@ dependencies = [
"rustls 0.23.20", "rustls 0.23.20",
"rustls-pki-types", "rustls-pki-types",
"sha1", "sha1",
"thiserror 2.0.12", "thiserror 2.0.18",
"url", "url",
"utf-8", "utf-8",
] ]
@ -5210,7 +5198,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [ dependencies = [
"windows-sys 0.59.0", "windows-sys 0.48.0",
] ]
[[package]] [[package]]

View File

@ -1,6 +1,6 @@
[package] [package]
name = "fren" name = "fren"
version = "2.8.0" version = "2.8.1"
edition = "2024" edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -37,8 +37,7 @@ strum = { version = "0.27.2", features = ["derive"] }
thousands = "0.2.0" thousands = "0.2.0"
url = { version = "2.5.7", features = ["serde"] } url = { version = "2.5.7", features = ["serde"] }
convert_case = "0.10.0" convert_case = "0.10.0"
rust-dsn-parser = { version = "0.3.0", registry = "ahines"} rust-dsn-parser = { version = "1.0.0", registry = "ahines"}
serde-xml-rs = "0.8.2"
[dependencies.tokio] [dependencies.tokio]
version = "1.35.1" version = "1.35.1"

View File

@ -1,188 +1,13 @@
use crate::discord::Context; use crate::discord::Context;
use crate::error::Error; use crate::error::Error;
use poise::serenity_prelude::MessageBuilder; use poise::serenity_prelude::MessageBuilder;
use rust_dsn_parser::prelude::config::DsnConfig;
use rust_dsn_parser::prelude::status::DsnStatus;
use rust_dsn_parser::prelude::*; use rust_dsn_parser::prelude::*;
use std::collections::HashMap; use std::collections::HashMap;
use std::time::{SystemTime, UNIX_EPOCH}; use std::time::{SystemTime, UNIX_EPOCH};
use structopt::lazy_static::lazy_static;
use thousands::Separable; use thousands::Separable;
lazy_static! {
static ref NAME_MAP: HashMap<String, &'static str> = vec![
("ace", "Advanced Composition Explorer"),
("apm1", "Astrobotic Peregrine 1 Mission"),
("agm1", "Astrobotic Griffin Lander"),
("argo", "ArgoMoon"),
("atot", "Advanced Tracking and Observational Techniques"),
("bepi", "BepiColombo"),
("bios", "BioSentinel"),
("caps", "CAPSTONE"),
("cas", "Cassini"),
("cass", "Testing"),
("ch1", "Chandrayaan"),
("ch2", "Chandrayaan-2"),
("ch2l", "Chandrayaan-2 Lander"),
("ch2o", "Chandrayaan-2 Orbiter"),
("ch3", "Chandrayaan-3"),
("cgo", "Carruthers Geocorona Observatory"),
("chdr", "Chandra"),
("clu1", "Cluster 1"),
("clu2", "Cluster 2"),
("clu3", "Cluster 3"),
("clu4", "Cluster 4"),
("cue3", "CU Earth Escape Explorer"),
("cusp", "CubeSat for Solar Particles"),
("dart", "Double Asteroid Redirection Test"),
("dawn", "Dawn"),
("dif", "Deep Impact"),
("dsco", "Deep Space Climate Observatory (DSCOVR)"),
("dsn", "Testing"),
("egs", "EVN and Global Services"),
("em1", "Human Space Flight: Artemis I"),
("em2", "Human Space Flight: Artemis II"),
("em3", "Human Space Flight: Artemis III"),
("emm", "Emirates Mars Mission (Hope)"),
("em-1", "Exploration Mission-1"),
("em-2", "Exploration Mission-2"),
("em-3", "Exploration Mission-3"),
("em-4", "Exploration Mission-4"),
("em-5", "Exploration Mission-5"),
("em-6", "Exploration Mission-6"),
("em-7", "Exploration Mission-7"),
("em-8", "Exploration Mission-8"),
("em-9", "Exploration Mission-9"),
("em-10", "Exploration Mission-10"),
("equl", "EQUULEUS"),
("escb", "ESCAPADE Blue"),
("escg", "ESCAPADE Gold"),
("eurc", "Europa Clipper"),
("eus", "Exploration Upper Stage"),
("gaia", "Gaia"),
("gbra", "Ground Based Radio Astronomy"),
("go10", "GOES 10"),
("go11", "GOES 11"),
("go12", "GOES 12"),
("go13", "GOES 13"),
("go14", "GOES 14"),
("go15", "GOES 15"),
("go16", "GOES 16"),
("go17", "GOES 17"),
("grla", "GRAIL A"),
("grlb", "GRAIL B"),
("gssr", "Goldstone Solar System Radar"),
("gtl", "Geotail"),
("gvrt", "Goldstone Apple Valley Radio Telescope"),
("hcra", "Host Country Radio Astronomy"),
("hmap", "LunaH-Map"),
("hst", "Hubble Space Telescope"),
("hyb2", "Hayabusa-2"),
("ice", "ISEE-3 Reboot"),
("icps", "Interim Cryogenic Propulsion Stage"),
("imag", "IMAGE"),
("imap", "IMAP"),
("intg", "INTEGRAL"),
("jno", "Juno"),
("jnsa", "Janus A"),
("jnsb", "Janus B"),
("jwst", "James Webb Space Telescope"),
("kepl", "Kepler"),
("kplo", "Korea Pathfinder Lunar Orbiter"),
("lade", "LADEE"),
("ltb", "Lunar Trailblazer"),
("lcro", "LCROSS"),
("lfl", "Lunar Flashlight"),
("lici", "LICIACube"),
("lro", "Lunar Reconnaissance Orbiter"),
("lnd1", "Lunar Node 1"),
("ltst", "Interim Cryogenic Propulsion Stage"),
("lucy", "Lucy"),
("lunah-map", "Lunar Hydrogen MAPper"),
("m01o", "Mars Odyssey"),
("m01s", "Mars Odyssey"),
("m20", "Mars 2020 (Perseverance)"),
("map", "WMAP"),
("mcoa", "MarCO A"),
("mcob", "MarCO B"),
("mer1", "Opportunity"),
("mer2", "Spirit"),
("mex", "Mars Express"),
("mgs", "Mars Global Surveyor"),
("mlic", "Lunar IceCube"),
("mms1", "MMS 1"),
("mms2", "MMS 2"),
("mms3", "MMS 3"),
("mms4", "MMS 4"),
("mom", "Mars Orbiter Mission"),
("mro", "Mars Reconnaissance Orbiter"),
("mros", "Mars Reconnaissance Orbiter"),
("msgr", "MESSENGER"),
("msl", "Mars Science Laboratory (Curiosity)"),
("musc", "Hayabusa"),
("mvn", "MAVEN"),
("neas", "Near Earth Asteroid Scout"),
("nhpc", "New Horizons"),
("no15", "NOAA 15"),
("no16", "NOAA 16"),
("no17", "NOAA 17"),
("no18", "NOAA 18"),
("nsyt", "InSight"),
("olin", "SWARM-EX"),
("omot", "OMOTENASHI"),
("orx", "OSIRIS-REx"),
("phx", "Phoenix"),
("plc", "Akatsuki"),
("polr", "POLAR"),
("psyc", "Psyche"),
("rd1", "Red Dragon 1"),
("rfc", "Reference Frame Calibration"),
("rose", "Rosetta"),
("rp", "Resource Prospector"),
("rsp", "ExoMars Rover and Surface Platform"),
("rsts", "Resource System Time Sharing"),
("sdu", "Stardust"),
("sele", "Kaguya"),
("sgp", "Space Geodesy Program"),
("slim", "Smart Lander for Investigating Moon"),
("soho", "SOHO"),
("spil", "Beresheet"),
("spp", "Parker Solar Probe"),
("sta", "STEREO A"),
("stab", "STEREO B"),
("stb", "STEREO B"),
("stf", "Spitzer Space Telescope"),
("swfo", "Space Weather Follow On-Lagrange 1"),
("td10", "TDRS 10"),
("td11", "TDRS 11"),
("td12", "TDRS 12"),
("td13", "TDRS 13"),
("tdr1", "TDRS 1"),
("tdr3", "TDRS 3"),
("tdr4", "TDRS 4"),
("tdr5", "TDRS 5"),
("tdr6", "TDRS 6"),
("tdr7", "TDRS 7"),
("tdr8", "TDRS 8"),
("tdr9", "TDRS 9"),
("terr", "TERRA"),
("tess", "Transiting Exoplanet Survey Satellite"),
("tgo", "Trace Gas Orbiter"),
("thb", "THEMIS B"),
("thc", "THEMIS C"),
("tm", "Team Miles"),
("tmm", "Team Miles"),
("ulys", "Ulysses"),
("vex", "Venus Express"),
("vgr1", "Voyager 1"),
("vgr2", "Voyager 2"),
("vlbi", "V.L.B. Interferometry"),
("wind", "WIND"),
("xmm", "X-ray Multi-Mirror Mission (XMM-Newton)")
]
.into_iter()
.map(|(name, fren_name)| (name.to_string(), fren_name))
.collect();
}
/// Check status of the NASA DSN /// Check status of the NASA DSN
#[poise::command(prefix_command, category = "Space")] #[poise::command(prefix_command, category = "Space")]
pub async fn dsn(ctx: Context<'_>) -> Result<(), Error> { pub async fn dsn(ctx: Context<'_>) -> Result<(), Error> {
@ -206,20 +31,30 @@ pub async fn dsn(ctx: Context<'_>) -> Result<(), Error> {
.text() .text()
.await?; .await?;
let dsn_stat = DsnStatus::from_xml_string(&resp)?;
let resp = client
.get("https://eyes.nasa.gov/apps/dsn-now/config.xml")
.send()
.await?
.text()
.await?;
let dsn_config = DsnConfig::from_xml_string(&resp)?;
let mut msg_builder = MessageBuilder::new(); let mut msg_builder = MessageBuilder::new();
msg_builder.push_line("# NASA Deep Space Network Status"); msg_builder.push_line("# NASA Deep Space Network Status");
let dsn_stat = DsnResponse::from_xml_string(&resp).unwrap();
for station in &dsn_stat.stations { for station in &dsn_stat.stations {
msg_builder.push_bold_line(format!("{}:", station.friendly_name)); msg_builder.push_bold_line(format!("{}:", station.friendly_name));
for dish in &station.dishes { for dish in &station.dishes {
if let Some(target) = dish.target.first() { if let Some(target) = dish.target.first()
let name = NAME_MAP && target.upleg_range != -1.0
{
let name = dsn_config
.spacecraft_map
.get(&target.name.to_lowercase()) .get(&target.name.to_lowercase())
.map(|s| s.to_string()) .map(|s| s.friendly_name.to_string())
.unwrap_or(target.name.to_string()); .unwrap_or(target.name.to_string());
let dish_line = format!( let dish_line = format!(

View File

@ -4,6 +4,7 @@ use crate::models::gogurt_reserves::GogurtError;
use crate::models::improvements::ImprovementError; use crate::models::improvements::ImprovementError;
use crate::user; use crate::user;
use magick_rust::MagickError; use magick_rust::MagickError;
use rust_dsn_parser::DsnRespParseError;
use serde::ser::StdError; use serde::ser::StdError;
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
@ -30,6 +31,7 @@ pub enum Error {
NoRandomFound, NoRandomFound,
GogurtError(GogurtError), GogurtError(GogurtError),
ImprovementError(ImprovementError), ImprovementError(ImprovementError),
DsnError(DsnRespParseError),
} }
impl StdError for Error {} impl StdError for Error {}
@ -112,6 +114,12 @@ impl From<ImprovementError> for Error {
} }
} }
impl From<DsnRespParseError> for Error {
fn from(value: DsnRespParseError) -> Self {
Self::DsnError(value)
}
}
impl Display for Error { impl Display for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self { match self {
@ -134,6 +142,7 @@ impl Display for Error {
Error::NoRandomFound => write!(f, "No random found"), Error::NoRandomFound => write!(f, "No random found"),
Error::GogurtError(err) => write!(f, "{err}"), Error::GogurtError(err) => write!(f, "{err}"),
Error::ImprovementError(err) => write!(f, "{err}"), Error::ImprovementError(err) => write!(f, "{err}"),
Error::DsnError(err) => write!(f, "Error getting data from NASA: {err}"),
} }
} }
} }