Play
The play function will allow you to do some post processing if an item should be played. The stream_id variable is poassed from the episode, list or search function an can be manipulated. For example scraping the streaming path of a specific page. You can also pass the stream_id directly to the player if you want, make sure you setup the function in the corresponding way. There is also a possibility to add a subtitle if available.
-
def Play(self, stream_name, stream_id, subtitle):
-
"""Start your code here"""
-
-
"""End your code here"""
-
return play
Receiving variables:
| Variable | Type | Description |
| stream_name | string | Contains the name of the stream |
| stream_id | string | Contains the id of the stream |
| subtitle | Boolean[ [True,False] | Returns the user setting for subtitles |
To return the path information in the correct way the frameworks expects the returned information in a specific output. There can only be returned one streaming item at once, no lists. An example of such an configuration is:
-
play = ba.CreatePlay()
-
play.SetPath(streampath)
-
-
#Optional
-
if subtitle:
-
play.SetSubtitle(subtitlepath)
-
play.SetSubtitle_type(string)
-
-
return play
Explanation of the code:
-
play = ba.CreatePlay()
An instance is created for the stream item
-
play.SetPath(streampath)
The SetPath variable will set the path to be played by the boxee player.
-
return play
Returning the play object to the framework
Optional:
-
if subtitle:
Checks if the user has enabled subtitles
-
play.SetSubtitle(subtitlepath)
Add a subtitle path to the stream, make sure boxee supports it.
-
play.SetSubtitle_type(string)
Only applicable on sami subtitles. Boxee has problems with them and when setting SetSubtitle_type to ‘sami’ the framework will automatically converts and passes the subtitle to a temporary srt subtitle file.
Static Example Flash:
-
def Play(self, stream_name, stream_id, subtitle):
-
-
play = ba.CreatePlay()
-
play.SetPath(stream_id)
-
play.SetDomain(‘youtube.com’)
-
play.SetJSactions(”)
-
-
return play
Scrape Example:
-
def Play(self, stream_name, stream_id, subtitle):
-
data = ba.FetchUrl(stream_id)
-
url_play = re.compile(‘<a class="wmv-player-holder" href="(.*?)"></a>’, re.DOTALL + re.IGNORECASE).search(data).group(1)
-
-
play = ba.CreatePlay()
-
play.SetPath(url_play)
-
-
return play
Didn't find any related posts :(
bartsidee
nl