#!/bin/sh
# Checks if jellyfin server is currently serving media to any user.
# Mark Blakeney, Nov 2020.

MYTOKEN="$1"
PORT=${2:-8096}

if curl -m 10 -s "http://localhost:$PORT/sessions?api_key=$MYTOKEN" |
    grep -qw NowPlayingItem; then
    exit 254
fi

exit 0
