~mil/mepo

ref: 041d978478ae78e241802ca9d750677e101c3f5b mepo/scripts/mepo_ui_menu_dbg_queuedownloadinteractive.sh -rwxr-xr-x 1.3 KiB
041d9784Miles Alan Show progress in % complete for transfer datum on tiles while downloading 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env sh
DISPLAYNAME=" Download: custom region (interactive)"
HOTKEY=q
BOUND_LOWER=1
BOUND_UPPER=19

main() {
  ZOOM_MIN="$(
    seq $BOUND_LOWER $BOUND_UPPER |
    PROMPT="Download Zoom Min:" mepo_ui_helper_menu.sh 
  )"

  ZOOM_MAX="$(
    seq $BOUND_LOWER $BOUND_UPPER |
    PROMPT="Download Zoom Max:" mepo_ui_helper_menu.sh 
  )"

  if ! { [ -n "$ZOOM_MIN" ] && [ "$ZOOM_MIN" -gt -1 ] && [ "$ZOOM_MIN" -lt 20 ]; }; then
    echo "Invalid minimum zoom level" >&2
    exit 1
  fi

  if ! { [ -n "$ZOOM_MAX" ] && [ "$ZOOM_MAX" -gt -1 ] && [ "$ZOOM_MAX" -lt 20 ]; }; then
    echo "Invalid maximum zoom level" >&2
    exit 1
  fi

  TARGET="$(
    printf %b "bbox\n1km\n2km\n3km\n4km\n10km\n100km" |
    PROMPT="Target (bbox or #km):" mepo_ui_helper_menu.sh 
  )"

  if [ "$TARGET" = bbox ]; then
    # Bbox based downloading
    echo "
      cache_dlbbox
        $MEPO_BR_LAT
        $MEPO_TL_LON
        $MEPO_TL_LAT
        $MEPO_BR_LON
        $ZOOM_MIN
        $ZOOM_MAX 
      ;
      prefset_n download_bar 1;
    "
  else
    # Radius-based downloading
    echo "
      cache_dlradius
        $MEPO_CENTER_LAT
        $MEPO_CENTER_LON
        $ZOOM_MIN
        $ZOOM_MAX 
        $(echo "$TARGET" | tr -dc '0-9.')
      ;
      prefset_n download_bar 1;
    "
  fi
}

if [ -n "$1" ]; then "$@"; else main; fi