jjwon0 / twitchstreamer

a wrapper script for the livestreamer program
0 stars 3 forks source link

Streams won't launch #1

Closed Poorchop closed 10 years ago

Poorchop commented 10 years ago

I can navigate through lists of the streams but streams won't launch when they are selected. I get the following error:

Traceback (most recent call last):
  File "lol.py", line 207, in <module>
    main()
  File "lol.py", line 202, in main
    subprocess.call("livestreamer " + "twitch.tv/" + chosen_stream + " best")
  File "/usr/lib64/python2.7/subprocess.py", line 524, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1308, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Steps to replicate:

In addition, when I try to select featured streams instead, I get a list of the 10 featured streams followed by this error:

Traceback (most recent call last):
  File "lol.py", line 207, in <module>
    main()
  File "lol.py", line 202, in main
    subprocess.call("livestreamer " + "twitch.tv/" + chosen_stream + " best")
UnboundLocalError: local variable 'chosen_stream' referenced before assignment
jjwon0 commented 10 years ago

Hi, thanks for finding the bug. I just pushed an initial fix for both the things that you pointed out. Let me know if it works.

Poorchop commented 10 years ago

Featured streams now work properly, but there is a new error when I try to navigate to the live Dota 2 streams:

  File "lol.py", line 210, in <module>
    main()
  File "lol.py", line 186, in main
    parser.print_streams()
  File "lol.py", line 72, in print_streams
    status = stream["channel"]["status"].encode('ascii', 'ignore')
AttributeError: 'NoneType' object has no attribute 'encode'

Right now, this seems like it's only happening only with Dota 2. I was able to navigate to and launch League of Legends, Starcraft II, Dark Souls, and Minecraft streams without any issues. When I try to view Dota streams, only 0-6 or 0-7 are listed, immediately followed by the error message. Maybe something is wrong with the twitch API.

jjwon0 commented 10 years ago

figured out the issue: one of the top streamers has no status that, when parsed as json, is a null rather than an empty string. fixed it, and it runs correctly on my system now. thanks for helping me find the bug!