#!/bin/sh urls="$XDG_DATA_HOME/cams/fullurls" tmp="$XDG_CACHE_HOME/cams" mkdir -p $tmp if [ -z "$1" ]; then lines="$(($(cat $urls | wc -l) / 10))" split -l $lines $urls $tmp/list live=$(ls $tmp/* | xargs -P 10 -I{} sh -c "youtube-dl -a {} -j --flat-playlist -i | jq -r '.display_id'") wait rm -f $tmp/* echo $live | tr ' ' '\n' | xargs -P 0 -I% mpv https://chaturbate.com/% wait else case "$1" in edit) $EDITOR $urls ;; add) echo "$2" >> $urls ;; ls) cat $urls ;; help|*) printf "Options:\n edit\n add\n ls\n" ;; esac fi