Kodi Community Forum
[RELEASE] Twitch.tv - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Video Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=154)
+---- Thread: [RELEASE] Twitch.tv (/showthread.php?tid=134538)



RE: [RELEASE] Twitch.tv - RyuBlade94 - 2014-12-14

Awesome, thanks a lot! Smile
Anyways streams seems to get stuck way more often on my Raspberry PI (that's not a connection problem though) on 1.1.8 then on 1.1.1


RE: [RELEASE] Twitch.tv - oRuin - 2014-12-17

Thanks very much for a fantastic addon. It's nice to have Twitch in the living room!
I was wondering if it was at all possible to somehow change the background image to give it a bit more of a twitch feeling. I have checked the menus in MQ5 but there is no option under 'Art'
Any other way I could change the background? Maybe by editing a file?

Thanks again!


RE: [RELEASE] Twitch.tv - ray_tracer - 2014-12-20

Hi there,

While the update seems to have fixed the HTTP errors I'm getting "Error: Script failed" for some streams. Most (if not all) of the popular streams work, but smaller streams with fewer viewers most often end up with a script failure (or viewer count is simply coincidence).

My log (note that I've removed user data from the log file):

http://pastebin.com/ik5LFt9a

This problem persists across my Ubuntu and OSX machines, as well as my Raspberry running OpenElec 3.2 (I believe all of them are Frodo).


RE: [RELEASE] Twitch.tv - beebo104 - 2014-12-30

Ray_tracer,
I had the same problem, and I have spent an infuriating few days trying to figure out what was wrong. Finally tonight a friend that really has no IT background gave me the solution to fix my problem. I'm not sure it'll work for you, however what fixed mine was going into the settings of the twitch app itself, and changing the stream quality to "best possible" Now all streams play, small or large. Which makes a small amount of sense to my frustrated brain. Smaller streams don't get transcoding, so lower/higher quality options would not work with them. Maybe it will make less sense when the frustration fog clears my brain, but right now, I have all twitch streams on my tv, large streamers and small. So I'm quite happy.


RE: [RELEASE] Twitch.tv - xbmczator - 2015-01-01

Hi all and happy NY!
I have this error on all amateur streams.
About 2 weeks before NY all works fine.
Code:
21:29:00 T:2881483840  NOTICE: [xbmcswift2] Request for "/playLive/grenadines111/" matches rule for function "playLive"
21:29:01 T:2881483840   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.TypeError'>
                                            Error Contents: sequence item 2: expected string, NoneType found
                                            Traceback (most recent call last):
                                              File "/home/pi/.kodi/addons/plugin.video.twitch/default.py", line 252, in <module>
                                                PLUGIN.run()
                                              File "/home/pi/.kodi/addons/script.module.xbmcswift2/lib/xbmcswift2/plugin.py", line 332, in run
                                                items = self._dispatch(self.request.path)
                                              File "/home/pi/.kodi/addons/script.module.xbmcswift2/lib/xbmcswift2/plugin.py", line 306, in _dispatch
                                                listitems = view_func(**items)
                                              File "/home/pi/.kodi/addons/plugin.video.twitch/default.py", line 20, in wrapper
                                                return func(*args, **kwargs)
                                              File "/home/pi/.kodi/addons/plugin.video.twitch/default.py", line 201, in playLive
                                                resolver.saveHLSToPlaylist(name,videoQuality,plpath)
                                              File "/home/pi/.kodi/addons/plugin.video.twitch/twitch.py", line 236, in saveHLSToPlaylist
                                                playlist = self._saveHLSToPlaylist(data,maxQuality)
                                              File "/home/pi/.kodi/addons/plugin.video.twitch/twitch.py", line 289, in _saveHLSToPlaylist
                                                playlist = '\n'.join(playlist) + '\n'
                                            TypeError: sequence item 2: expected string, NoneType found
                                            -->End of Python script error report<--
21:29:01 T:3037794304   ERROR: Playlist Player: skipping unplayable item: 0, path [plugin://plugin.video.twitch/playLive/grenadines111/]
21:29:01 T:2881483840  NOTICE: Thread BackgroundLoader start, auto delete: false
21:29:11 T:2856318016  NOTICE: ES: Client  from 192.168.1.143 timed out
21:29:12 T:2881483840  NOTICE: Thread LanguageInvoker start, auto delete: false
21:29:13 T:2881483840  NOTICE: -->Python Interpreter Initialized<--
21:29:15 T:2881483840  NOTICE: [xbmcswift2] Request for "/playLive/versuta/" matches rule for function "playLive"
21:29:17 T:3037794304  NOTICE: DVDPlayer: Opening: /home/pi/.kodi/temp/hlsplaylist.m3u8
21:29:17 T:3037794304 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
21:29:17 T:2821715008  NOTICE: Thread CMMALRenderer start, auto delete: false
21:29:17 T:2790249536  NOTICE: Thread DVDPlayer start, auto delete: false
21:29:17 T:2790249536  NOTICE: Creating InputStream
21:29:17 T:2790249536  NOTICE: Creating Demuxer
21:29:26 T:2790249536  NOTICE: Opening stream: 1 source: 256
21:29:26 T:2790249536  NOTICE: Creating video thread
21:29:26 T:2790249536  NOTICE: Opening stream: 0 source: 256
21:29:26 T:2769286208  NOTICE: Thread OMXPlayerVideo start, auto delete: false
21:29:26 T:2790249536  NOTICE: Creating audio thread
21:29:26 T:2760897600  NOTICE: Thread OMXPlayerAudio start, auto delete: false
21:29:26 T:2790249536  NOTICE: OMXClock using audio as reference
21:29:26 T:2769286208  NOTICE: Display resolution DESKTOP : 1360x768 (1360x768) @ 60.00 - Full Screen (16)
21:29:28 T:2769286208 WARNING: CRenderManager::WaitForBuffer - timeout waiting for buffer
21:29:29 T:3037794304 WARNING: Previous line repeats 7 times.
21:29:29 T:3037794304  NOTICE: CDVDPlayer::CloseFile()
21:29:29 T:3037794304  NOTICE: DVDPlayer: waiting for threads to exit
21:29:29 T:2790249536  NOTICE: CDVDPlayer::OnExit()
21:29:29 T:2790249536  NOTICE: Closing stream player 1
21:29:29 T:2760897600  NOTICE: thread end: OMXPlayerAudio::OnExit()



RE: [RELEASE] Twitch.tv - ray_tracer - 2015-01-02

(2014-12-30, 09:44)beebo104 Wrote: Ray_tracer,
I had the same problem, and I have spent an infuriating few days trying to figure out what was wrong. Finally tonight a friend that really has no IT background gave me the solution to fix my problem. I'm not sure it'll work for you, however what fixed mine was going into the settings of the twitch app itself, and changing the stream quality to "best possible" Now all streams play, small or large. Which makes a small amount of sense to my frustrated brain. Smaller streams don't get transcoding, so lower/higher quality options would not work with them. Maybe it will make less sense when the frustration fog clears my brain, but right now, I have all twitch streams on my tv, large streamers and small. So I'm quite happy.

That could actually be the problem right there. If I'm not mistaken, the Twitch addon has had bugs with falling back on another resolution than the requested one should it not be available. Twitch updating their API might have broken that feature again.

It's a bit unfortunate that the intermediate solution is to set the video to "Best possible" since I have limited bandwidth and watching some streams that broadcast at insane bitrates pretty much prevents me from doing anything else on the internet. Better than no solution, I guess.

BTW, has anyone contacted the developer? I was just assuming he comes by here and reads the thread from time to time.


RE: [RELEASE] Twitch.tv - beebo104 - 2015-01-05

(2015-01-01, 20:40)xbmczator Wrote: Hi all and happy NY!
I have this error on all amateur streams.
About 2 weeks before NY all works fine.
I had about the same experience Worked fine then boom, smaller streamers wouldn't work. I set my In app quality to "Best Possible" Fixed the problem for me.
(2015-01-02, 00:40)ray_tracer Wrote: That could actually be the problem right there. If I'm not mistaken, the Twitch addon has had bugs with falling back on another resolution than the requested one should it not be available. Twitch updating their API might have broken that feature again.

It's a bit unfortunate that the intermediate solution is to set the video to "Best possible" since I have limited bandwidth and watching some streams that broadcast at insane bitrates pretty much prevents me from doing anything else on the internet. Better than no solution, I guess.

BTW, has anyone contacted the developer? I was just assuming he comes by here and reads the thread from time to time.
No Ray I haven't had a lot of time lately. Haven't even been able to enjoy my "fixed" streams via apps more than twice.


RE: [RELEASE] Twitch.tv - caffeinepills - 2015-01-15

I really love this plugin, but there is one thing that has always really annoyed me.

All of the streams show the offline channel logo. I really wanted to see the preview thumbnail when they are online, much like the Roku app or even the website.

Therefore if anyone wants them, I have fixed it:

Goto line 65 of converter.py in the twitch plugin folder.

You should see the following:
Code:
def convertStreamToListItem(self, stream):
        channel = stream[Keys.CHANNEL]
        videobanner = channel.get(Keys.VIDEO_BANNER, '')
        logo = channel.get(Keys.LOGO, '')
        return {'label': self.getTitleForStream(stream),
                'path': self.plugin.url_for(endpoint='playLive',
                                            name=channel[Keys.NAME]),
                'is_playable': True,
                'icon': videobanner if videobanner else logo,
        'thumbnail': videobanner if videobanner else logo
        }

Change it so it looks like this:

Code:
def convertStreamToListItem(self, stream):
        channel = stream[Keys.CHANNEL]
        preview = stream[Keys.PREVIEW]
        videobanner = preview.get('large', '')
        logo = channel.get(Keys.LOGO, '')
        return {'label': self.getTitleForStream(stream),
                'path': self.plugin.url_for(endpoint='playLive',
                                            name=channel[Keys.NAME]),
                'is_playable': True,
                'icon': videobanner if videobanner else logo,
        'thumbnail': videobanner if videobanner else logo
        }

Whalla, you now have live stream previews. You can change the 'large' to small or medium. I chose large for the better quality.

Image


RE: [RELEASE] Twitch.tv - zoydberg - 2015-01-18

(2015-01-15, 07:11)caffeinepills Wrote: I really love this plugin, but there is one thing that has always really annoyed me.

All of the streams show the offline channel logo. I really wanted to see the preview thumbnail when they are online, much like the Roku app or even the website.

Therefore if anyone wants them, I have fixed it:

Goto line 65 of converter.py in the twitch plugin folder.

You should see the following:
Code:
def convertStreamToListItem(self, stream):
        channel = stream[Keys.CHANNEL]
        videobanner = channel.get(Keys.VIDEO_BANNER, '')
        logo = channel.get(Keys.LOGO, '')
        return {'label': self.getTitleForStream(stream),
                'path': self.plugin.url_for(endpoint='playLive',
                                            name=channel[Keys.NAME]),
                'is_playable': True,
                'icon': videobanner if videobanner else logo,
        'thumbnail': videobanner if videobanner else logo
        }

Change it so it looks like this:

Code:
def convertStreamToListItem(self, stream):
        channel = stream[Keys.CHANNEL]
        preview = stream[Keys.PREVIEW]
        videobanner = preview.get('large', '')
        logo = channel.get(Keys.LOGO, '')
        return {'label': self.getTitleForStream(stream),
                'path': self.plugin.url_for(endpoint='playLive',
                                            name=channel[Keys.NAME]),
                'is_playable': True,
                'icon': videobanner if videobanner else logo,
        'thumbnail': videobanner if videobanner else logo
        }

Whalla, you now have live stream previews. You can change the 'large' to small or medium. I chose large for the better quality.

thanks for the work. in the 2nd to last line of your code i had to remove all the spaces before 'thumbnail and replace them with 2 tab's, otherwise it was giving the following error in the log 'unindent does not match any outer indentation level', this happened on my windows 7 machine but not ubuntu 14.04 machine.


RE: [RELEASE] Twitch.tv - Crowly - 2015-01-24

Some of the streamers I follow,and subscribe to, have their past broadcasts vods locked behind a subscription wall. Those will be listed when i chose past broadcasts, but are unable to play them. I suspect thats because I'm not logged in, hence Twitch doesn't know I'm a subscriber. Would be nice if it where possible to play those from Kodi, now I have to exit into the desktop and use a browser to view those vods, something i would like to avoid Smile

I see on the Github page that user authentication is under "What's next?", any idea of when this can/will be implemented?

Edit: Found the answer on Github:
Quote:This feature is on the to do list, however it seems most contributing Devs are fairly busy at the moment (myself included). Feel free to develop it if you're capable and submit a pull request.
Unless something has changed since that was posted

Maybe this can be used to save some work/koding? If anyone has some free time on their hands they don't know what to do with Smile
https://github.com/omab/python-social-auth
https://github.com/omab/python-social-auth/blob/master/social/backends/twitch.py


Edit 2:
I managed to get this to work in an ugly way since i don't know Python (but some PHP, javascript and a few other things).
First i got my access token from Twitchs API with a little php script (used this lib: https://github.com/Xxplosions/twitchtv-oauth) after having added and authorized that "app" on my twitch account, then appended ?oauth_token=YOUR_TOKEN_VALUE to the end of line 426 in twitch.py
From:
Code:
VIDEO_CHUNKS = 'https://api.twitch.tv/api/videos/{0}'

To
Code:
VIDEO_CHUNKS = 'https://api.twitch.tv/api/videos/{0}?oauth_token=YOUR_TOKEN_VALUE'
The token value is a string of 30 characters.

Of course next time this add-on gets updated this will (most likely) be overwritten. But until someone with the required Python knowledge and time is able to add this functionality, this works and is better than nothing (for me) Wink


RE: [RELEASE] Twitch.tv - eikum - 2015-01-26

Anyone got an update for past broadcast? Tried the tip over here about the tokens (https://sites.google.com/site/deezja/tools/oauth-generator)
but did not work with Liriks channel.

Any tips about how I can get it to work again?


RE: [RELEASE] Twitch.tv - Crowly - 2015-01-26

(2015-01-15, 07:11)caffeinepills Wrote: All of the streams show the offline channel logo. I really wanted to see the preview thumbnail when they are online, much like the Roku app or even the website.
This works almost perfectly, i get the preview thumbnail, but if Kodi has cached it, it shows the cached thumbnails instead.
I guess this is more of a Kodi issue than with this add-on, anyone of a way to get Kodi to refresh the preview thumbnails without manually "resetting" the userdata/Thumbnails folder and userdata/Database/Textures13.db file?

Edit:
Seems like its planed: http://kodi.wiki/view/Thumbnails/Cache#The_future
Quote:The texture cache in the future will be auto-cleaning, i.e. textures that are stale will automatically be cleaned out to save disk space. Also, the music and video artwork will be moved to the new system. This will allow the cached versions of these images to be updated whenever the original image changes (eg you replace the fanart with a different version).
In addition, the texture cache will be updated to automatically tell the image control that it needs to refresh itself. Currently if the texturecache detects that a new version of an image is available (whether it be a .dds version or an updated copy of the original image that has since changed) then all that happens is the new version gets re-cached. Thus, you only see the new version of an image once you view it a second time after any change (this allows the image to be free'd from memory and reloaded from the freshly updated version).

Edit 2:
Seems to be answering my own questions ... Wink
This script is useful Texture Cache Maintenance utility

Edit 3:
Code:
./texturecache.py purge all static-cdn.jtvnw.net
This will remove all twitch thumbs. To make sure the thumbnails gets refreshed add this as an hourly (or other time interval) cron job/scheduled task, or make it run on shutdown and perhaps reboot.


RE: [RELEASE] Twitch.tv - xioSlayer - 2015-01-27

Does anyone know how I can get this plugin working with Kodi 14.0 DSPlayer version? On the DSPlayer version it seems that when you try to view a stream, it crashes Kodi.

To make the youtube plugin work with DSPlayer, I needed to add this rule in playercorefactory.xml:

Code:
<rule name="youtube" filename=".*youtube.*" player="DVDPlayer" />

I also noticed these rules pertaining to streams.
Code:
<!-- Internet streams -->
    <rule name="streams" internetstream="true">
      <rule name="aacp/sdp" mimetypes="audio/aacp|application/sdp" player="DVDPlayer" />
      <rule name="mp2" mimetypes="application/octet-stream" filetypes="mp2" player="PAPlayer" />
    </rule>

Perhaps there is a way that they can be modified to allow twitch to work properly?

Thanks.


RE: [RELEASE] Twitch.tv - Crowly - 2015-02-04

Nice, it got updated to 1.3.0 today (need to re-add the oauth token) and skipping forward on past broadcasts is now very fast/close to instantaneous (previously it took around 17 seconds before it started to play after skipping forward). But I have only tested it with one broadcast.

Longer streams are divided into ~30 minute video chunks, so check Kodi's current playlist and start up the chuck you want to begin/resume playback on.


RE: [RELEASE] Twitch.tv - EvilTwin - 2015-02-07

Superb addon Smile

Just a minor question: is there a way to go to "past broadcasts" of streams even they are currently live? I have not figured out how.