Git Product home page Git Product logo

automatic-twitch-recorder's People

Contributors

instinctlol avatar maxb2 avatar mcr42 avatar swan201 avatar throwaway700 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

automatic-twitch-recorder's Issues

TypeError: 'NoneType' object is not subscriptable

After the streamer finishes streaming this error executes. And he is stuck at "Live". Not sure if it can continue to wait and then start streaming again if the streamer decides to do so.

(Cmd) add officialandypyro best
Successfully added officialandypyro to watchlist.
(Cmd) time 10
Interval is now set to 10 seconds.
(Cmd) download_folder I:\Twitch-Recording-1
Download folder is now set to 'I:\Twitch-Recording-1' .
(Cmd) start
Daemon is started.
(Cmd) OfficialAndyPyro is live. Saving stream in best quality to I:\Twitch-Recording-1\2020-12-29 23.19.05 - OfficialAndyPyro - Good morning Tarkov.ts.
Finished watching officialandypyro
error:concurrent.futures:exception calling callback for <Future at 0x5fcb880 state=finished returned NoneType>
Traceback (most recent call last):
File "C:\Users\Moflows\AppData\Local\Programs\Python\Python38-32\lib\concurrent\futures_base.py", line 328, in _invoke_callbacks
callback(self)
File "C:\Users\Moflows\Desktop\Twitch-Record-2\daemon.py", line 136, in _watcher_callback
streamer = streamer_dict['user_info']['login']
TypeError: 'NoneType' object is not subscriptable

Daemon is already running.
(Cmd) list
Live: 'officialandypyro'
Offline:
(Cmd) exit
Daemon exited successfully
PS C:\Users\Moflows\Desktop\Twitch-Record-2> python main.py
(Cmd) start
Daemon is started.
(Cmd) add officialandypyro best
Successfully added officialandypyro to watchlist.
(Cmd) list
Live:
Offline: 'officialandypyro'


pip install -r requirements.txt
Requirement already satisfied: attrs==20.3.0 in c:\users\moflows\appdata\roaming\python\python38\site-packages (from -r requirements.txt (line 1)) (20.3.0)
Requirement already satisfied: certifi==2020.12.5 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 2)) (2020.12.5)
Requirement already satisfied: chardet==4.0.0 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 3)) (4.0.0)
Requirement already satisfied: idna==2.10 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 4)) (2.10)
Requirement already satisfied: importlib-metadata==3.3.0 in c:\users\moflows\appdata\roaming\python\python38\site-packages (from -r requirements.txt (line 5)) (3.3.0)
Requirement already satisfied: iso-639==0.4.5 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 6)) (0.4.5)
Requirement already satisfied: iso3166==1.0.1 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 7)) (1.0.1)
Requirement already satisfied: isodate==0.6.0 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 8)) (0.6.0)
Requirement already satisfied: jsonschema==3.2.0 in c:\users\moflows\appdata\roaming\python\python38\site-packages (from -r requirements.txt (line 9)) (3.2.0)
Requirement already satisfied: pathvalidate==2.3.1 in c:\users\moflows\appdata\roaming\python\python38\site-packages (from -r requirements.txt (line 10)) (2.3.1)
Requirement already satisfied: pycryptodome==3.9.9 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 11)) (3.9.9)
Requirement already satisfied: pyrsistent==0.17.3 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 12)) (0.17.3)
Requirement already satisfied: PySocks==1.7.1 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 13)) (1.7.1)
Requirement already satisfied: requests==2.25.1 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 14)) (2.25.1)
Requirement already satisfied: six==1.15.0 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 15)) (1.15.0)
Requirement already satisfied: streamlink==2.0.0 in c:\users\moflows\appdata\roaming\python\python38\site-packages (from -r requirements.txt (line 16)) (2.0.0)
Requirement already satisfied: typing-extensions==3.7.4.3 in c:\users\moflows\appdata\roaming\python\python38\site-packages (from -r requirements.txt (line 17)) (3.7.4.3)
Requirement already satisfied: urllib3==1.26.2 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 18)) (1.26.2)
Requirement already satisfied: websocket-client==0.57.0 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 19)) (0.57.0)
Requirement already satisfied: zipp==3.4.0 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 20)) (3.4.0)
Requirement already satisfied: setuptools in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from jsonschema==3.2.0->-r requirements.txt (line 9)) (50.3.2)

Starting from batch file

I was wondering if it was possible for the main.py to accept command arguments like start so I could have a batch file which invokes it and starts looking for streams so I could schedule this to start on boot?

Failed to write data

Getting a error after starting the deamon and it tries to save the Stream
(Failed to write data to file: [Errno 2] No such file or directory)

Monitor keywords/games

Would it be possible to have the script monitor a game's page and/or keywords in the title?

I'd like to record all streams of one game without having to manually startup multiple scripts for individual channels

Integrate cmd library

Integrating the cmd library is the first step to support the idea of recording multiple streams. With this library, one is able to launch multiple commands.

It should also work well with the getopts library.

At a later step, my idea is to launch 'check' commands via cmd, these will then be checked in certain time intervals by a checker singleton. If the singleton finds the stream to be recordable, it will launch a watcher, which will record the stream and notify the singleton on completion, so that it can be checked again.

Another good thing about having this checker singleton is that we will be able to easily implement a ui on top of that.

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url

Repeating an example from the documentation results in a 400 Error.

automatic-twitch-recorder git:(master) ✗ python3 atr_cmd.py
(Cmd) add forsen
Traceback (most recent call last):
  File "atr_cmd.py", line 96, in <module>
    AtrCmd().cmdloop_with_keyboard_interrupt()
  File "atr_cmd.py", line 90, in cmdloop_with_keyboard_interrupt
    self.cmdloop()
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cmd.py", line 217, in onecmd
    return func(arg)
  File "atr_cmd.py", line 20, in do_add
    self.daemon.add_streamer(line[0])
  File "/Users/bryce/projects/automatic-twitch-recorder/daemon.py", line 38, in add_streamer
    user_info = self.CLIENT.users.translate_usernames_to_ids(streamer)
  File "/usr/local/lib/python3.7/site-packages/twitch/api/users.py", line 94, in translate_usernames_to_ids
    response = self._request_get('users?login={}'.format(usernames))
  File "/usr/local/lib/python3.7/site-packages/twitch/api/base.py", line 53, in _request_get
    response.raise_for_status()
  File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.twitch.tv/kraken/users?login=forsen

(Request Function) Merge Before Vods File

currently code is deleted first interval time vods

so checking first download vods file time and first streaming file time.
and download before vods file first and merge live streaming file

Exception finished returned NoneType

Everytime a Streamer ends the stream I get an error:

 error:concurrent.futures:exception calling callback for <Future at 0x7f506088931
0 state=finished returned NoneType>
Traceback (most recent call last):
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 329, in _invoke_ca
llbacks
    callback(self)
  File "/home/user/atw/automatic-twitch-recorder/daemon.py", line 136, in _watche
r_callback
    streamer = streamer_dict['user_info']['login']
TypeError: 'NoneType' object is not subscriptable

I use python 3.2.9
Streamlink 2.0.0

After this error the streamer stays "online" in the list.

Idea: Docker

a docker would be great to use it on like unraid.

since many sreamers deactivated vod this would be great.

Feature request: Docker

Wondering if a Docker implementation has crossed your mind.

It looks like an image exists, but it uses a modified older version of ATR and eventually has errors and no longer monitors. I fumbled around trying to create a working image with the new version, but I haven't been able to get it working (hard to do when you don't know Python!).

Need to Exception Check

image

It seems to Streaming Is end, but chat is online exception occurred.

Channel is Offline But it show still Live

Handling some Exceptions

Need to handle ConnectionsErrors when requesting twitch api

Also try to think of handling / working around 'Failed to reload playlist: Unable to open URL: ...' streamlink issue

raids are recorded

whenever a streamer raids another channel it also gets recorded. That should be an optional feature imo

Stream filename errors

The method you're calling to get a valid filename get_valid_filename from utils under watcher.py does not remove back slashes and forward slashes from stream titles leading to an error in writing the file

file_name = curr_time + " - " + self.streamer + " - " + get_valid_filename(self.stream_title) + ".flv"

Feature request: subfolders.

i record multiple streamers, is it possible to put the recordings in a folder with the streamers name?

cheers.

Auth Problem?

Hey there,
got a problem with using this tool, tried to find with googling around for this issue, but somehow nothing works?
Tried it on a Raspi4 and Debian Buster Server now, ending both in this problem that they call the Authentication Error when i use it.
Using streamlink in standalone streamlink USERNAME best works fine right away.

But using this tool it throws out this:

(Cmd) add thiseguy
Successfully added thiseguy to watchlist.
(Cmd) start
Daemon is started. Will check every 30 seconds.
(Cmd) exception calling callback for <Future at 0x7f302cd20240 state=finished raised PluginError>
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugin/api/http_session.py", line 166, in request
res.raise_for_status()
File "/usr/local/lib/python3.7/dist-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 410 Client Error: Gone for url: https://api.twitch.tv/api/channels/thiseguy/access_token.json?as3=t&platform=_

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.7/concurrent/futures/_base.py", line 324, in _invoke_callbacks
callback(self)
File "/home/automatic-twitch-recorder/daemon.py", line 128, in _watcher_callback
streamer_dict = returned_watcher.result()
File "/usr/lib/python3.7/concurrent/futures/_base.py", line 425, in result
return self.__get_result()
File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/automatic-twitch-recorder/watcher.py", line 37, in watch
streams = streamlink.streams(self.streamer_dict['stream_info']['channel']['url'])
File "/usr/local/lib/python3.7/dist-packages/streamlink/api.py", line 13, in streams
return session.streams(url, **params)
File "/usr/local/lib/python3.7/dist-packages/streamlink/session.py", line 439, in streams
return plugin.streams(**params)
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugin/plugin.py", line 317, in streams
ostreams = self._get_streams()
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugins/twitch.py", line 774, in _get_streams
return self._get_hls_streams("live")
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugins/twitch.py", line 714, in _get_hls_streams
sig, token = self._access_token(stream_type)
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugins/twitch.py", line 678, in access_token
schema=access_token_schema)
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugins/twitch.py", line 308, in access_token
return self.call("/api/{0}/{1}/access_token".format(endpoint, asset), **dict(platform="
", **params))
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugins/twitch.py", line 271, in call
res = self.session.http.get(url, params=params, headers=headers)
File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugin/api/http_session.py", line 175, in request
raise err
streamlink.exceptions.PluginError: Unable to open URL: https://api.twitch.tv/api/channels/thiseguy/access_token.json (410 Client Error: Gone for url: https://api.twitch.tv/api/channels/thiseguy/access_token.json?as3=t&platform=
)

ModuleNotFoundError: No module named 'streamlink'

Traceback (most recent call last): File "atr_cmd.py", line 3, in from daemon import Daemon File "/home/lunarstarpony/stream/recorder/daemon.py", line 1, in from watcher import Watcher File "/home/lunarstarpony/stream/recorder/watcher.py", line 4, in import streamlink ModuleNotFoundError: No module named 'streamlink'
Am i doing it wrong? I already install streamlink

Repeats errors once a stream ends

Having left the script on overnight, and the 2 stream recordings seem fine, however the cmd prompt is being filled with errors of not being able to get the last piece of a stream.

https://imgur.com/zCVAOr8

I had a similar script that recorded streams and did this but stopped after a few attempts, but it no longer works so i'm trying (and liking) yours. I guess i'll look for retry attempts in the scripts and lower it, I don't know coding though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.