Instinctlol / automatic-twitch-recorder

Checks if a user on twitch is currently streaming and then records the stream via streamlink
186 stars 40 forks source link

Let the Record just start after starting atr_cmd.py #21

Closed LunarstarPony closed 3 years ago

LunarstarPony commented 5 years ago

Can i just start the Record without type any thing? Like Script That i can just record the same channel every time i start it

b7leung commented 3 years ago

For the webhooks branch at least, a quick hack to do this is to do the following:

  1. Change main.py to something like this:

    ...
    threading.Thread(target=server.serve_forever).start()
    #AtrCmd().cmdloop_with_keyboard_interrupt()
    AtrCmd().start_script()
  2. Add start_script to atr_cmd.py, like this. (replace streamer with the streamer's username)

    def cmdloop_with_keyboard_interrupt(self):
        try:
            self.cmdloop()
        except KeyboardInterrupt:
            self.do_exit('')

    def start_script(self):
        self.do_add("streamer 360p")
        self.do_start("")

if __name__ == '__main__':
    AtrCmd().cmdloop_with_keyboard_interrupt()

This doesn't work perfectly (the usage can lead to some warnings, though they seem harmless) and is not a very clean solution. So if someone else has a better solution, that would be great to know.