0

Hi I have a python script that looks for a video stream, if the stream is found it will do something.

When streamlink does NOT find a stream it displays a message (this is standard functionality) "Could not get video info - ERROR: Video unavailable".

In the documentation it says you can write to a log file but I am at a loss... this is what I call

 streams = streamlink.streams (channel_stream)

How do I complete that statement to have streamlink to log to /var/stramlink.log

Thanks in advance. h

help4bis
  • 15
  • 6

1 Answers1

0

From the documentation it looks like you can set log file settings on a streamlink session using an instance of the session:

subprocess-errorlog (bool) Log errors from subprocesses to a file located in the temp directory

subprocess-errorlog-path (str) Log errors from subprocesses to a specific file

ffmpeg-verbose (bool) Log stderr from ffmpeg to the console

ffmpeg-verbose-path (str) Specify the location of the ffmpeg stderr log file

These settings can be set something like:

streamlink.set_option('subprocess-errorlog', true)
streamlink.set_option('subprocess-errorlog-path', '/path/to/streamlink_error.log')
streamlink.set_option('ffmpeg-verbose', true)
streamlink.set_option('ffmpeg-verbose-path', '/path/to/ffmpeg_error.log')
j_b
  • 1,975
  • 3
  • 8
  • 14
  • Hi j_b, thanks so much for your answer. I have ''' streams = streamlink.streams (channel_stream) class streamlink.set_option('subprocess-errorlog-path', 'streamlink_error.log')''' But that gives me an error '''"AttributeError: module 'streamlink' has no attribute 'set_option'"''' Not sure how to actually implement it... been going around in circles :-) and can't seem to break out of it... LOL. H – help4bis Aug 04 '21 at 04:05
  • How did you get the instance of `streamlink` that you are using? The documentation indicates that it should be an instance of a Session class: `class streamlink.Streamlink(options=None) A Streamlink session is used to keep track of plugins, options and log settings.` – j_b Aug 04 '21 at 05:05
  • In the python script I call. Import streamlink and then I do streams = streamlink.streams (channel_stream) – help4bis Aug 04 '21 at 05:50