#!/bin/sh urls="$XDG_DATA_HOME/cams/fullurls" tmp="$XDG_CACHE_HOME/cams" cookie="$XDG_DOWNLOAD_DIR/chaturbate.txt" snr=5 urlsnr="$(wc -l $urls | cut -d' ' -f1)" mkdir -p $tmp if [ -z "$1" ]; then lines="$(($urlsnr / $snr))" split -l $lines $urls $tmp/list live=$(ls $tmp/* | xargs -P $snr -I{} sh -c "youtube-dl --cookies $cookie -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