Re: Twitch.tv plugin (some help needed)
- From: Bastien Nocera <hadess hadess net>
- To: Mattias Bengtsson <mattias jc bengtsson gmail com>
- Cc: grilo-list gnome org
- Subject: Re: Twitch.tv plugin (some help needed)
- Date: Mon, 05 Jan 2015 10:42:30 +0100
Hey Mattias!
On Mon, 2015-01-05 at 06:25 +0100, Mattias Bengtsson wrote:
Hi all!
Tonight I tried to implement a twitch.tv plugin for grilo. This is as
far as I came: https://gist.github.com/moonlite/9ac0f454c0ca830aba1a
Some questions:
– The twitch API uses the following flow to get the video stream URI's:
1) GET https://api.twitch.tv/api/channels/:channel/access_token
2) Unpack the JSON payload and extract the sig and token fields
3) The stream is now:
http://199.9.251.155/api/channel/hls/:channel.m3u8?token=:token&sig=:sig
Is it possible to let my lua-script return a function for
retrieving the sig and token values?
Did you mean to ask how you could cache them, so you only need to query
it once? FWIW, all the HTTP fetches in the Lua sources are async, so
you'd need to queue the "actual" call.
You'd use global variables for that. grl-pluzz.lua in the
grilo-lua-sources repo on github has an example of a cache.
I'm fairly sure I'm not supposed
to find these values before I request the stream (running n HTTP-
requests whenever I load a list of streams seems bad, plus I know
from experience that the token can get outdated).
– I would like to be able to browse Twitch like this:
/Top Channels/{stream}
/Games/{game}/{stream}
That is with "sub-folders" at least three deep.
Is this possible in a Lua-plugin? I see that the Rai.tv does it, but
that's also implemented in C.
There's nothing in grilo that cares about depth levels in folders. The
plugin is the one constructing the "ID" for a folder (a box in grilo
parlance). When browsing inside that box, you're given the media ID.
Just make sure you know how to deconstruct the unique ID you've given
for that box item.
Is that clear?
– How do I ship an icon with my plugin?
Putting a .gresource file of the same name as the script in the same
directory.
And then: "source-icon" = "resource:///org/gnome/grilo/twitch.svg"
in the source itself.
HTH
Cheers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]