diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-05-03 00:41:24 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-05-03 00:41:24 +0200 |
| commit | 9bdf75cc619740246c2c413d204f26e228e75bb1 (patch) | |
| tree | e6fe089cbe8c71a541e70a8b518f671b1cab43d1 /src/lib | |
| parent | 3a715c7e0d5cbb39ffd6816899ef3050e8331882 (diff) | |
Do all writes then do all verification and report progress
for each separately (#1743)
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/copy_to_drive_job.cc | 29 | ||||
| -rw-r--r-- | src/lib/disk_writer_messages.h | 12 |
2 files changed, 30 insertions, 11 deletions
diff --git a/src/lib/copy_to_drive_job.cc b/src/lib/copy_to_drive_job.cc index 7760c072f..0fb41f856 100644 --- a/src/lib/copy_to_drive_job.cc +++ b/src/lib/copy_to_drive_job.cc @@ -70,7 +70,13 @@ CopyToDriveJob::run () throw CommunicationFailedError (); } - bool formatting = false; + enum State { + SETUP, + FORMAT, + COPY, + VERIFY + } state = SETUP; + while (true) { optional<string> s = _nanomsg.receive (10000); if (!s) { @@ -84,13 +90,22 @@ CopyToDriveJob::run () optional<string> const n = _nanomsg.receive (500); throw CopyError (m.get_value_or("Unknown"), raw_convert<int>(n.get_value_or("0"))); } else if (*s == DISK_WRITER_FORMATTING) { - sub ("Formatting drive"); + sub (_("Formatting drive")); set_progress_unknown (); - formatting = true; - } else if (*s == DISK_WRITER_PROGRESS) { - if (formatting) { - sub ("Copying DCP"); - formatting = false; + state = FORMAT; + } else if (*s == DISK_WRITER_COPY_PROGRESS) { + if (state == FORMAT) { + sub (_("Copying DCP")); + state = COPY; + } + optional<string> progress = _nanomsg.receive (500); + if (progress) { + set_progress (raw_convert<float>(*progress)); + } + } else if (*s == DISK_WRITER_VERIFY_PROGRESS) { + if (state == COPY) { + sub (_("Verifying copied files")); + state = VERIFY; } optional<string> progress = _nanomsg.receive (500); if (progress) { diff --git a/src/lib/disk_writer_messages.h b/src/lib/disk_writer_messages.h index 9d8196374..8d0306754 100644 --- a/src/lib/disk_writer_messages.h +++ b/src/lib/disk_writer_messages.h @@ -26,7 +26,7 @@ /* REQUEST TO WRITE DCP */ // Front-end sends: - + #define DISK_WRITER_WRITE "W" // DCP pathname // Internal name of the drive to write to @@ -41,13 +41,17 @@ // Error message // Error number -// the drive is being formatted +// the drive is being formatted #define DISK_WRITER_FORMATTING "F" // data is being copied, 30% done -#define DISK_WRITER_PROGRESS "P" +#define DISK_WRITER_COPY_PROGRESS "C" // 0.3\n +// data is being veriried, 60% done +#define DISK_WRITER_VERIFY_PROGRESS "V" +// 0.6\n + /* REQUEST TO QUIT */ @@ -59,7 +63,7 @@ // Front-end sends: #define DISK_WRITER_UNMOUNT "U" -// XML representation of Drive object to unmount +// XML representation of Drive object to unmount // Back-end responds: // DISK_WRITER_OK |
