bail out on missing "no image" tiles #99
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using the UTC offset feature can result in "No Image" tiles. himawaripy
will get the timestamp of the latest sattelite image, subtract or add
the offset, and assume an image exists for the newly calculated time.
This is correct most of the time, but occasionally results in a
timestamp for which there is no satellite image. In this case, the
service returns black tiles with the text "No Image".
These blank "No Image" tiles are always 2867 bytes (regardless of the
quality level). Legitimate tiles are always a different size (smaller if
they are the solid black surrounding Earth, larger if they are part of
Earth). By checking the size of each tile immediately after download and
bailing out if the tile is 2867 bytes, we can avoid downloading the
remaining tiles and stitching them together into a large series of "No
Image".
Exiting the program here must be done with
os._exit()
because thispart is multi-threaded. I'm using exit code 3 just so to have a unique
reason so that other programs can understand why himawaripy exited at
this point.
I've been using this for about a week now and it works great. It is
refreshing to constantly have satellite photos and not see the
occasional "No Image" interruption.
The "No Image" issue was previously discussed in #82 and #68.