rster2002 / ed-journals Goto Github PK
View Code? Open in Web Editor NEWWork in progress journal parsing and utilities for Elite Dangerous written in Rust.
Home Page: https://crates.io/crates/ed-journals
License: MIT License
Work in progress journal parsing and utilities for Elite Dangerous written in Rust.
Home Page: https://crates.io/crates/ed-journals
License: MIT License
Currently all genuses and species are added, but they are not all matched with a #[serde(rename = )
Primarily for using in state, but all input should come from a specific struct so the input can be constructed and used in other places as well.
There are still a lot of unmapped or wrongly mapped entries in the commodity enum or even some missing entries.
Currently missing, but is probably the same as the rings for a star
Extend the JournalEvent to include additional information about the read, most importantly whether it's a 'live' read or it's a history read, which can be used to for example only flush state when reading live entries.
Hey, I've just started a small project where I need to watch screenshots events, and I'm glad ed-journals
exists, thanks! Everything is working as expected in my experience, I just want to bring some API suggestions (I can give a shot to implement them, if you think they are appropriate).
I see that there are already some "module shortcuts" that exist, but I think it could be brought into a way flatter structure, leading to a more discoverable API. For instance, the screenshot event content is under: ed_journals::logs::content::log_event_content::screenshot_event::ScreenshotEvent
From the most obvious, to the most contentious, my suggestions would be:
screenshot_event
and its friends are single struct modules, maybe invert visibility between struct and mods in log_event_content.rs
content
only contains LogEvent
and LogEventContent
, I'd expose the whole content of log_event_content
into content
, so that LogEventContent
and the struct it contains are togethercontent
module which would mean that everything you need when watching the logs would be directly under ed_journals::logs
, except for the two blocking
and asynchronous
modules that totally make sense to choose the reading methodI like this comment on this topic: "users of a module prefer a flat namespace, while implementers prefer hierarchical namespace"
Currently it's quite inefficient to check which species matches criteria as it means allocating a Vec for every single species that exists and going though them one by one. A possible solutions could be something like this:
lazy_static! {
static ref SPECIES_SPAWN_CONDITIONS: [(Species, Vec<SpawnCondition>); 100] = [
(Species::AleoidaArcus, vec![
SpawnCondition::ThinAtmosphere(AtmosphereType::CarbonDioxide),
SpawnCondition::MaxGravity(0.27),
SpawnCondition::MinMeanTemperature(175.0),
SpawnCondition::MaxMeanTemperature(180.0),
]),
// etc...
];
}
Which would just allocate everything once when it is first required and then keeps it allocated. This sacrifices memory usage for speed, but I think that it would be worth it.
Then to find matches you can just iterate over SPECIES_SPAWN_CONDITIONS and note down the species for the matches.
Some species entries are not yet backed by any tests and they need some journal entries to make sure they are correctly mapped.
At least not the blocking variant.
A brain dump of some options:
The specific models
is something that is left over from the start of the project when there was only the logs
module. Instead, split the models
into their own modules, so that things like ship type can be accessed through ed_journals::ship::{ShipType, ShipModule};
etc.
And keep track of scanned species locations.
Species that need color entries:
Any Cactoida in a M. K or Ae system
Any Clypeus in a O, W or Ae system
Recepta Umbrux in a O or W
Add a function for detecting where the journal directory is located taking platform into account.
Planet class entries should be fixed and should get annotations for prevent from changing it again:
Apparently not all color variants are documented on https://ed-dsn.net/en/exobiological-flora/, but they are in the data sheet.
The mission type enum is currently a bit of a mess and not really that useful. Some work needs to be put into figuring out the logic of the format/name.
Hi!
Would you consider parsing the keybindings within the scope of this project? If so, I could give it a go in a PR?
Things like landing locations and scanned exobiology locations.
Things like rare stars or very close binaries.
The current implementation is just too slow. This is probably because it creates a lot of independent allocations which just cause a lot of overhead.
Currently it mutates a lot of state which allows us to create a single state, but means that a lot of data is cloned and lots of allocations need to happen.
One idea that was initially considered is just adding every entry that was read to a single vec and perform operations on that, but that would mean that you would need to iterate over most if not all items if you want to perform some lookup or action.
Maybe a hybrid method would work where everything is added to a single vec, but state is kept through references to the vec? This would require a lot of references and probably some unsafe code.
When working without an async runtime it can be a bit awkward to manage the blocking calls of the live readers. I think that the standard library channel Receiver do it really well:
.iter()
provides the blocking API, exactly like the current live readers.try_iter()
provides an iterator that is non blocking and ends as soon as there is no more eventsAnd the great thing is that you can use both as needed. As a result, this creates easy constructions to do things like watching just new events:
let _ = receiver.try_iter().last(); // flush the events that were sent before
for ev in receiver.iter() { /* do stuff with new events */}
They also provide the method recv_timeout()
which is super helpful.
Things like landing pad size, number of the different slots, and base statistics like hull weight.
In journal Journal.2023-07-30T033612.01.log there's a line that is incorrectly formatted. Tracking an issue here for if this occurs multiple times.
{ "timestamp":"2023-07-30T01:54:58Z", "event":"| Scooping: {Status.Scooping}");", "Taxi":false, "Multicrew":false, "StarSystem":"HIP 84222", "SystemAddress":74325165260, "StarPos":[38.78125,46.62500,534.78125], "SystemAllegiance":"", "SystemEconomy":"$economy_None;", "SystemEconomy_Localised":"None", "SystemSecondEconomy":"$economy_None;", "SystemSecondEconomy_Localised":"None", "SystemGovernment":"$government_None;", "SystemGovernment_Localised":"None", "SystemSecurity":"$GAlAXY_MAP_INFO_state_anarchy;", "SystemSecurity_Localised":"Anarchy", "Population":0, "Body":"HIP 84222", "BodyID":0, "BodyType":"Star", "JumpDist":62.928, "FuelUsed":7.674855, "FuelLevel":21.480677 }
Tests do still pass on windows though so ๐คท
Or maybe another way for the library to hold a list of nebula, but the enum should be replaced.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.