Skip to content

Commit

Permalink
Update sxfeeder (#20)
Browse files Browse the repository at this point in the history
* Update sxfeeder

* Update aiscatcher (#21)
  • Loading branch information
kx1t authored May 30, 2024
1 parent 84f6ad1 commit 400a083
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions rootfs/etc/s6-overlay/scripts/aiscatcher
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,8 @@ if [[ -n "$AIRFRAMES_STATION_ID" ]]; then
fi

# AIS-Catcher:
if chk_enabled "$AISCATCHER_SHAREDATA" && [[ -z "$AISCATCHER_FEEDER_KEY" ]]; then
aiscatcher_command+=("-X")
AISCATCHER_EXTRA_OPTIONS="$(sed -E 's/-X\s+[0-9]*\s*//g'<<< "$AISCATCHER_EXTRA_OPTIONS")" # Remove any -X from param to avoid duplication
elif [[ -n "$AISCATCHER_FEEDER_KEY" ]]; then
aiscatcher_command+=("-X $AISCATCHER_FEEDER_KEY")
if [[ -n "$AISCATCHER_FEEDER_KEY" ]] || chk_enabled "$AISCATCHER_SHAREDATA"; then
aiscatcher_command+=("-X${AISCATCHER_FEEDER_KEY:+ }$AISCATCHER_FEEDER_KEY")
AISCATCHER_EXTRA_OPTIONS="$(sed -E 's/-X\s+[0-9]*\s*//g'<<< "$AISCATCHER_EXTRA_OPTIONS")" # Remove any -X from param to avoid duplication
fi

Expand All @@ -150,11 +147,11 @@ if [[ -n "${APRSFI_FEEDER_KEY:+$APRSFI_STATION_ID}" ]]; then
fi

# BoatBeacon:
if chk_enabled "$BOATBEACON_SHAREDATA"; then
aiscatcher_command+=("-u boatbeaconapp.com 5322")
elif [[ -n "$BOATBEACON_UDP_PORT" ]]; then
if [[ -n "$BOATBEACON_UDP_PORT" ]]; then
if ! grep -q ":" <<< "$BOATBEACON_UDP_PORT"; then BOATBEACON_UDP_PORT="boatbeaconapp.com:$BOATBEACON_UDP_PORT"; fi
aiscatcher_command+=("-u ${BOATBEACON_UDP_PORT/:/ }")
elif chk_enabled "$BOATBEACON_SHAREDATA"; then
aiscatcher_command+=("-u boatbeaconapp.com 5322")
fi

# HPRadar:
Expand Down Expand Up @@ -187,15 +184,18 @@ if [[ -n "$SHIPPINGEXPLORER_UDP_PORT" ]]; then
fi

# ShipFinder:
if chk_enabled "$SHIPFINDER_SHAREDATA"; then
aiscatcher_command+=("-u ais.shipfinder.co.uk 4001")
elif [[ -n "$SHIPFINDER_UDP_PORT" ]]; then
if [[ -n "$SHIPFINDER_UDP_PORT" ]]; then
if ! grep -q ":" <<< "$SHIPFINDER_UDP_PORT"; then SHIPFINDER_UDP_PORT="ais.shipfinder.co.uk:$SHIPFINDER_UDP_PORT"; fi
aiscatcher_command+=("-u ${SHIPFINDER_UDP_PORT/:/ }")
elif chk_enabled "$SHIPFINDER_SHAREDATA"; then
aiscatcher_command+=("-u ais.shipfinder.co.uk 4001")
fi

# ShipXplorer UDP feed (can be used as an alternative for feeding with sxfeeder):
if [[ -n "$SHIPXPLORER_UDP_PORT" ]]; then
if [[ -n "${SHARING_KEY:-${SX_SHARING_KEY:-${SHIPXPLORER_SHARING_KEY}}}" ]] && [[ -n "${SERIAL_NUMBER:-${SX_SERIAL_NUMBER:-${SHIPXPLORER_SERIAL_NUMBER}}}" ]]; then
"${s6wrap[@]}" echo "WARNING: Both SHIPXPLORER_SHARING_KEY/SHIPXPLORER_SERIAL_NUMBER and SHIPXPLORER_UDP_PORT are in use. You will probably feed ShipXplorer twice with the same data. Please remove one of these from your environment!"
fi
if ! grep -q ":" <<< "$SHIPXPLORER_UDP_PORT"; then SHIPXPLORER_UDP_PORT="hub.shipxplorer.com:$SHIPXPLORER_UDP_PORT"; fi
aiscatcher_command+=("-u ${SHIPXPLORER_UDP_PORT/:/ }")
fi
Expand Down
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/scripts/sxfeeder
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ s6wrap=(s6wrap --quiet --timestamps --prepend="${APPNAME}")


if [[ -z "${SHARING_KEY:-${SX_SHARING_KEY:-${SHIPXPLORER_SHARING_KEY}}}" ]] || [[ -z "${SERIAL_NUMBER:-${SX_SERIAL_NUMBER:-${SHIPXPLORER_SERIAL_NUMBER}}}" ]]; then
"${s6wrap[@]}" --args echo "ShipXplorer sharing disabled."
if [[ -z "$SHIPXPLORER_UDP_PORT" ]]; then "${s6wrap[@]}" --args echo "ShipXplorer sharing disabled."; fi
sleep infinity
fi

Expand Down

0 comments on commit 400a083

Please sign in to comment.