Skip to content

Commit

Permalink
FITS::from_url(): kB-based download progress
Browse files Browse the repository at this point in the history
  • Loading branch information
jvo203 committed Apr 12, 2019
1 parent 0260fe2 commit 81045a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fits_web_ql"
version = "4.1.12"
version = "4.1.13"
authors = ["jvo203 <[email protected]>"]
edition = "2018"

Expand Down
26 changes: 7 additions & 19 deletions src/fits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1732,32 +1732,20 @@ println!("CRITICAL ERROR cannot read from file: {:?}", err);
} else {
//then the data part
if !fits.has_data {
if fits.depth <= 1 {
//kB downloaded progress
fits.send_progress_notification(
&server,
&"downloading FITS".to_owned(),
(frame_size / 1024) as i32,
(buffer.len().min(frame_size) / 1024) as i32,
);
}
//kB downloaded progress
fits.send_progress_notification(
&server,
&"downloading FITS".to_owned(),
(fits.depth * frame_size / 1024) as i32,
((frame * frame_size + buffer.len().min(frame_size)) / 1024) as i32,
);

while buffer.len() >= frame_size && !fits.has_data {
let data: Vec<u8> = buffer.drain(0..frame_size).collect();

fits.process_cube_frame(&data, cdelt3 as f32, frame);
frame = frame + 1;

if fits.depth > 1 {
//frame-by-frame progress
fits.send_progress_notification(
&server,
&"downloading FITS".to_owned(),
total as i32,
frame as i32,
);
}

if frame == fits.depth {
//all data frames have been received
fits.has_data = true;
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2251,8 +2251,8 @@ lazy_static! {
#[cfg(feature = "jvo")]
static LOG_DIRECTORY: &'static str = "LOGS";

static SERVER_STRING: &'static str = "FITSWebQL v4.1.12";
static VERSION_STRING: &'static str = "SV2019-04-09.0";
static SERVER_STRING: &'static str = "FITSWebQL v4.1.13";
static VERSION_STRING: &'static str = "SV2019-04-12.0";
static WASM_STRING: &'static str = "WASM2019-02-08.1";

#[cfg(not(feature = "jvo"))]
Expand Down

0 comments on commit 81045a0

Please sign in to comment.