Release Addon AVGN a sample addon to access jtv tv channels

Discussion of plugin / script development for XBMC4Xbox
Post Reply
skatulskijean
Posts: 1028
Joined: Wed Jul 04, 2012 8:01 am
Has thanked: 1 time
Been thanked: 148 times

Release Addon AVGN a sample addon to access jtv tv channels

Post by skatulskijean »

Ok here the next Release AVGN:

JTV change to pay Service
This mean you can only watch the streams without interupt when you pay money
So i have no interess to finish This Post


What is AVGN AVGN is a Channel on Jtv what holding different streams.
So it's a example to create your own JTV channel addons without the dependencies from jtv-archive addon.

We access the channels over the twitchtv api and the streams over the mobile (iphone ) api (HLS)
with the last nightly BuzZ have on my request add the HLS CODE to the smaller ffmpeg codecs so that the streaming from HLS streams can work on standart 64 MB RAM xboxes to .
So i think the
Build : https://www.dropbox.com/sh/8mcip8xsfe1z ... -32683.zip is the best for it on 64MB RAM XBOX's

Thanks again BuZZ
First a little code examples from me :

so we want to stream as example arconai_323
the webadress is : http://www.justin.tv/arconai_323

so to access the streaming content we write a little python code:

Code: Select all

import urllib2,sys
if sys.version_info >=  (2, 7):
    import json
else:
    import simplejson as json

channel='arconai_323'
url='http://api.twitch.tv/api/channels/%s/access_token' % channel
stream = json.loads(urllib2.urlopen(url).read())
token= stream['token']
sig= stream['sig']
m3u8url='http://usher.twitch.tv/api/channel/hls/%s.m3u8?token=%s&sig=%s' % (channel,token,sig)
# this is the m3u8 playable m3u8 Playlist url you can this url paste to vlc and you can watch the stream
print m3u8url

What will this do :

import urllib2,sys importiert the module urllib2 and sys from python
if sys.version_info >= (2, 7): when python version is = or > as python 2.7 import the json module from python
import json

else: when not = or > as python 2.7 import the scriptmodule.simplejson as json
import simplejson as json

we want this to holding the script compatible to the different python version as example python 2.4 on the stable xbmc4xbox build and python 2.7 on the xbmc4xbox 3.5 beta build (python 2.7)

channe='arconai_323" create a variable channel what holding the channel what you want on this example
arconai_323

stream = json.loads(urllib2.urlopen(url).read()) we create a new variable stream what open and read the twitchtv api url with the channel what we want to access over the urllib2 module and load this with the json module json
token= stream['token'] we create a variable token what parse the stream url with json and access the token
sig= stream['sig'] we create a variable sig what parse the stream variable with json and access the sig
m3u8url='http://usher.twitch.tv/api/channel/hls/ ... =%s&sig=%s' % (channel,token,sig)
the url what we want is on a clean write 'http://usher.twitch.tv/api/channel/hls/ ... en='result from the token variable'&sig='result from the sig Variable'
But we want a unversal solution so we access format Strings with the comand %s on the position on the url what we want and given add last to it % ((channel,token,sig) so that format understand on what for a position and what for a string we want on this url
print m3u8url do ouput the result from the variable m3u8 on the screen

so we want to test the script on xbmc we add to the script one import xbmc and the access to the streaming url over xbmc

Code: Select all

import urllib2,sys,xbmc
if sys.version_info >=  (2, 7):
    import json
else:
    import simplejson as json

channel='arconai_323'
url='http://api.twitch.tv/api/channels/%s/access_token' % channel
stream = json.loads(urllib2.urlopen(url).read())
token= stream['token']
sig= stream['sig']
m3u8url='http://usher.twitch.tv/api/channel/hls/%s.m3u8?token=%s&sig=%s' % (channel,token,sig)
# this is the m3u8 playable m3u8 Playlist url you can this url paste to vlc and you can watch the stream
print m3u8url
xbmc.Player().play(m3u8url)
on the stable build you want as dependencies the scriptmodule simplejson
You can this easy install over the addon4xboxinstaller / get ASddons/xbmc4xbox addon / Scriptmodules Addons (libarys)/simplejson

when you this will test on xbmc4xbox go with ftp xbmc plugins /video and create a new folder test and put the script on this as default.py
When you than go back to your xbmc4xbox on the xbox self you see on video plugins a new folder test selected click on it and your watch your stream.

more a little Later
Last edited by skatulskijean on Tue Mar 04, 2014 5:06 am, edited 1 time in total.
jet
Posts: 3
Joined: Mon Mar 03, 2014 8:57 pm
Been thanked: 1 time

Re: Release Addon AVGN a sample addon to access jtv tv chann

Post by jet »

Hi Jan,
First of all I would like to thank you for all your hard work on this site. You and the other great people here keep our old XboX Machines going. :) Just a small question about this work around to view JTV channels. I tried and am getting nowhere with viewing a channel on JTV called crime central.

The Address for it is: http://www.justin.tv/xcrimecentralxx

This is what I have derived from what you explained above. Please let me know if I am way off base here.
Downloaded and Installed build 32683
Installed the Scriptmodules Addons (library)/simplejson with addons for xbmc
Made a directory called test in my video plugin folder and
made a defauly.py file and placed it in that folder this is what it contained

Code: Select all

import urllib2,sys,xbmc
if sys.version_info >=  (2, 7):
    import json
else:
    import simplejson as json

channel=''xcrimecentralxx"
url='http://api.twitch.tv/api/channels/%s/access_token' % channel
stream = json.loads(urllib2.urlopen(url).read())
token= stream['token']
sig= stream['sig']
m3u8url='http://usher.twitch.tv/api/channel/hls/%s.m3u8?token=%s&sig=%s' % (channel,token,sig)
# this is the m3u8 playable m3u8 Playlist url you can this url paste to vlc and you can watch the stream
print m3u8url
xbmc.Player().play(m3u8url)
I think I missed something somewhere.
Thanks Again
Jet
skatulskijean
Posts: 1028
Joined: Wed Jul 04, 2012 8:01 am
Has thanked: 1 time
Been thanked: 148 times

Re: Release Addon AVGN a sample addon to access jtv tv chann

Post by skatulskijean »

jet wrote:Hi Jan,
First of all I would like to thank you for all your hard work on this site. You and the other great people here keep our old XboX Machines going. :) Just a small question about this work around to view JTV channels. I tried and am getting nowhere with viewing a channel on JTV called crime central.

The Address for it is: http://www.justin.tv/xcrimecentralxx

This is what I have derived from what you explained above. Please let me know if I am way off base here.
Downloaded and Installed build 32683
Installed the Scriptmodules Addons (library)/simplejson with addons for xbmc
Made a directory called test in my video plugin folder and
made a defauly.py file and placed it in that folder this is what it contained

Code: Select all

import urllib2,sys,xbmc
if sys.version_info >=  (2, 7):
    import json
else:
    import simplejson as json

channel=''xcrimecentralxx"
url='http://api.twitch.tv/api/channels/%s/access_token' % channel
stream = json.loads(urllib2.urlopen(url).read())
token= stream['token']
sig= stream['sig']
m3u8url='http://usher.twitch.tv/api/channel/hls/%s.m3u8?token=%s&sig=%s' % (channel,token,sig)
# this is the m3u8 playable m3u8 Playlist url you can this url paste to vlc and you can watch the stream
print m3u8url
xbmc.Player().play(m3u8url)
I think I missed something somewhere.
Thanks Again
Jet
Have not the time on moment to test it on xbmc4xbox but on mainxbmc is the channel with this code working but only 90 sec.
JTV change to pay Service
This mean you can only watch the streams without interupt when you pay money
So i have no interess to finish This Post
jet
Posts: 3
Joined: Mon Mar 03, 2014 8:57 pm
Been thanked: 1 time

Re: Release Addon AVGN a sample addon to access jtv tv chann

Post by jet »

Oh OK now I understand. Thanks for the reply.

Jet
Post Reply