Hakkin / twitchpipe

Pipe your favorite Twitch streams to the media player of your choice, or a file to save them for later. Supports low-latency playback.
MIT License
35 stars 5 forks source link

Feature request: waiting for the stream to go live #23

Closed jedai47 closed 10 months ago

jedai47 commented 1 year ago

Currently if i try to record the stream but it is offline i get the following: 'could not extract playlist: stream is offline' what about adding an option for the application to wait till the stream go live (checks every minute for exemple) and then proceed. thanks for the wonderful tool btw

Hakkin commented 1 year ago

You can do this with the record.sh script in the tools directory. You can give it multiple usernames and it will start recording when any of them go live. Note that it won't start recording already in-progress streams, only streams that start after the script was launched.

Alternately, it's really easy to just write a script that does this, something like

#!/bin/bash

USERNAME="${1}"
while :
do
  FILENAME="${USERNAME}_$(date -u '+%Y_%m_%d_%H_%M_%S_(%Z)').ts"
  twitchpipe --archive "${USERNAME}" > "${FILENAME}"
  # Remove file if empty
  if [[ ! -s "${FILENAME}" ]]
  then
    rm "${FILENAME}"
  fi
  sleep 60
done