From 1713a5c5a97c988b3812b61d5b75fc8bd9eabaf7 Mon Sep 17 00:00:00 2001 From: kevcenteno Date: Tue, 9 Dec 2014 18:52:39 -0500 Subject: [PATCH 1/6] adding routes --- Contents/Code/__init__.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index 8e8c239..cf4c94f 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -77,6 +77,7 @@ def MainMenu(): return oc ################################################################################################### +@route(PREFIX + '/livegamesmenu') def LiveGamesMenu(): title = TITLE_LIVEGAMES url = URL_LIVEGAMES % TOKEN @@ -100,6 +101,7 @@ def LiveGamesMenu(): return oc ################################################################################################### +@route(PREFIX + '/getlivegames') def GetLiveGames(url): # Set up our array to return videos = [] @@ -124,6 +126,7 @@ def GetLiveGames(url): return videos ################################################################################################### +@route(PREFIX + '/getlivegamestreams') def GetLiveGameStreams(game_id, title, isPlaying, summary): oc = ObjectContainer(title2=title, no_cache=True) @@ -152,6 +155,7 @@ def GetLiveGameStreams(game_id, title, isPlaying, summary): return oc ################################################################################################### +@route(PREFIX + '/ondemanddatesmenu') def OnDemandDatesMenu(): oc = ObjectContainer(title2='On Demand Dates', no_cache=True) @@ -178,6 +182,7 @@ def OnDemandDatesMenu(): return oc ################################################################################################### +@route(PREFIX + '/ondemandgamesmenu') def OnDemandGamesMenu(gameDate): title = 'On Demand Games For ' + gameDate url = URL_ONDEMANDGAMES % (gameDate, TOKEN) @@ -199,6 +204,7 @@ def OnDemandGamesMenu(gameDate): return oc ################################################################################################### +@route(PREFIX + '/ondemandstreammenu') def OnDemandStreamMenu(game_id, title, logo, arena, summary): serverLocation = getServerLocation() url = URL_ONDEMANDSTREAM % (game_id, TOKEN + serverLocation) @@ -253,6 +259,7 @@ def OnDemandStreamMenu(game_id, title, logo, arena, summary): return oc ################################################################################################### +@route(PREFIX + '/getondemandgames') def GetOnDemandGames(url): videos = [] @@ -270,6 +277,7 @@ def GetOnDemandGames(url): return videos ################################################################################################### +@route(PREFIX + '/getstream') def GetStream(game_id, title1, url, thumb, art, summary, include_container=False, streamType="hls"): Log("GetStream Game: " + str([game_id, title1, url, thumb, art, summary])) @@ -361,6 +369,7 @@ def PlayVideo(url): return IndirectResponse(VideoClipObject, key=url) ################################################################################################### +@route(PREFIX + '/validateprefs') def ValidatePrefs(): # When prefs get saved, update Token global TOKEN @@ -373,6 +382,7 @@ def ValidatePrefs(): message="Make sure your username and password are correct.") ################################################################################################### +@route(PREFIX + '/gettoken') def GetToken(): # Get the username and pass from the prefs user = Prefs['username'] @@ -391,6 +401,7 @@ def GetToken(): return None ################################################################################################### +@route(PREFIX + '/encodurltoken') def encodeUrlToken(url): # Encode the token param so it doesn't fail on 3rd party/web devices @@ -403,6 +414,7 @@ def encodeUrlToken(url): return encUrl ################################################################################################### +@route(PREFIX + '/formatdate') def FormatDate(theDate): # Import date and time modules from datetime import date, timedelta @@ -439,6 +451,7 @@ def FormatDate(theDate): return formatedDate ################################################################################################### +@route(PREFIX + '/getteamname') def getTeamName(teamName): # Display short or long team name @@ -457,7 +470,7 @@ def getTeamName(teamName): return teamName ################################################################################################### - +@route(PREFIX + '/populatevideoarray') def populateVideoArray(videoArr, videoObj, is_live=False): game_id = videoObj['id'] awayTeam = '' @@ -509,7 +522,7 @@ def populateVideoArray(videoArr, videoObj, is_live=False): videoArr.append([game_id, title, logo, arena, summary, isPlaying]) ################################################################################################### - +@route(PREFIX + '/getserverlocation') def getServerLocation(prependQueryParam = True): serverLocation = Prefs["serverlocation"] From 7bf2b54984413d7a3498e696e98d7fe7a9e62229 Mon Sep 17 00:00:00 2001 From: kevcenteno Date: Tue, 9 Dec 2014 21:15:55 -0500 Subject: [PATCH 2/6] fix rtmp / livestream on mac --- Contents/Code/__init__.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index cf4c94f..8b01c71 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -14,7 +14,7 @@ ICON = 'icon-default.png' LIVE_ICON = '' ONDEMAND_ICON = '' -TOKEN = '' +TOKEN = None TEAM_NAMES = 'teams.json' @@ -277,7 +277,7 @@ def GetOnDemandGames(url): return videos ################################################################################################### -@route(PREFIX + '/getstream') +@route(PREFIX + '/getstream', include_container = bool) def GetStream(game_id, title1, url, thumb, art, summary, include_container=False, streamType="hls"): Log("GetStream Game: " + str([game_id, title1, url, thumb, art, summary])) @@ -310,17 +310,16 @@ def GetStream(game_id, title1, url, thumb, art, summary, include_container=False ) elif streamType == "rtmp": - fullurl = url.split(" ") if len(fullurl) > 1: - url = fullurl[0] + rtmpurl = fullurl[0] swfurl = fullurl[1] else: - url = "" + rtmpurl = "" swfurl = "" - url = url.replace("rtmp:////", "rtmp://") + rtmpurl = rtmpurl.replace("rtmp:////", "rtmp://") swfurl = swfurl.replace("'", "").replace("swfUrl=", "") vco = VideoClipObject( @@ -334,7 +333,7 @@ def GetStream(game_id, title1, url, thumb, art, summary, include_container=False items=[ MediaObject( parts=[ - PartObject(key=RTMPVideoURL(url=url, swfurl=swfurl, live=True)) + PartObject(key=RTMPVideoURL(url=rtmpurl, swfurl=swfurl, live=True)) ], optimized_for_streaming=True ) @@ -470,7 +469,7 @@ def getTeamName(teamName): return teamName ################################################################################################### -@route(PREFIX + '/populatevideoarray') +@route(PREFIX + '/populatevideoarray', is_live = bool) def populateVideoArray(videoArr, videoObj, is_live=False): game_id = videoObj['id'] awayTeam = '' @@ -522,7 +521,7 @@ def populateVideoArray(videoArr, videoObj, is_live=False): videoArr.append([game_id, title, logo, arena, summary, isPlaying]) ################################################################################################### -@route(PREFIX + '/getserverlocation') +@route(PREFIX + '/getserverlocation', prependQueryParam = bool) def getServerLocation(prependQueryParam = True): serverLocation = Prefs["serverlocation"] From e6b96464f43a6cdfcc5ba366a54b614ec851d879 Mon Sep 17 00:00:00 2001 From: kevcenteno Date: Tue, 9 Dec 2014 21:39:20 -0500 Subject: [PATCH 3/6] version bump to .08 --- Contents/Code/__init__.py | 4 ++-- Contents/Info.plist | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index 8b01c71..dffc53a 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -7,8 +7,8 @@ KEY = 'a534012a8ee25958f374263ece97eb27' -TITLE = 'BallPlex .07' -PREFIX = '/video/ballplex07' +TITLE = 'BallPlex .08' +PREFIX = '/video/ballplex08' ART = 'art-default.jpg' ICON = 'icon-default.png' diff --git a/Contents/Info.plist b/Contents/Info.plist index 79ee045..a5f62f2 100644 --- a/Contents/Info.plist +++ b/Contents/Info.plist @@ -4,7 +4,7 @@ CFBundleIdentifier - com.plexapp.plugins.ballplex07 + com.plexapp.plugins.ballplex08 PlexClientPlatforms * From d8a187233d2d5e39c71473330d533f71d207ac62 Mon Sep 17 00:00:00 2001 From: kevcenteno Date: Tue, 9 Dec 2014 21:50:06 -0500 Subject: [PATCH 4/6] add prefs to every menu --- Contents/Code/__init__.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index dffc53a..64b2404 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -98,6 +98,10 @@ def LiveGamesMenu(): title=title )) + oc.add(PrefsObject( + title=TITLE_PREFERENCES) + ) + return oc ################################################################################################### @@ -152,6 +156,10 @@ def GetLiveGameStreams(game_id, title, isPlaying, summary): oc.add(GetStream(hlsUrl, "Regular Stream", hlsUrl, R(ICON), R(ICON), summary, False, "hls")) oc.add(GetStream(rtmpUrl, "TrueLive Stream", rtmpUrl, R(ICON), R(ICON), summary, False, "rtmp")) + oc.add(PrefsObject( + title=TITLE_PREFERENCES) + ) + return oc ################################################################################################### @@ -179,6 +187,10 @@ def OnDemandDatesMenu(): # Display the error if there was one return (ObjectContainer(header="Error", message=json["msg"])) + oc.add(PrefsObject( + title=TITLE_PREFERENCES) + ) + return oc ################################################################################################### @@ -201,6 +213,10 @@ def OnDemandGamesMenu(gameDate): summary=summary )) + oc.add(PrefsObject( + title=TITLE_PREFERENCES) + ) + return oc ################################################################################################### @@ -256,6 +272,9 @@ def OnDemandStreamMenu(game_id, title, logo, arena, summary): if awayHighlights: oc.add(GetStream(awayHighlights, awayTeam + " Highlights", awayHighlights, logo, arena, summary, False, "mp4")) + oc.add(PrefsObject( + title=TITLE_PREFERENCES) + ) return oc ################################################################################################### From 0558efa7b8d222b0439ac804a772b85fbe825a59 Mon Sep 17 00:00:00 2001 From: kevcenteno Date: Tue, 9 Dec 2014 21:55:22 -0500 Subject: [PATCH 5/6] prefs: move serverlocation up --- Contents/DefaultPrefs.json | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Contents/DefaultPrefs.json b/Contents/DefaultPrefs.json index 5332808..d021bf2 100644 --- a/Contents/DefaultPrefs.json +++ b/Contents/DefaultPrefs.json @@ -13,20 +13,6 @@ "option": "hidden", "secure": "true" }, - { - "id":"quality", - "type": "enum", - "label": "Stream Quality", - "values": ["High", "Low"], - "default": "High" - }, - { - "id": "shortnames", - "type": "enum", - "label": "Short Names", - "values": ["Off", "On"], - "default": "On" - }, { "id": "serverlocation", "type": "enum", @@ -42,5 +28,20 @@ "North America - West" ], "default": "Automatic" + }, + { + "id":"quality", + "type": "enum", + "label": "Stream Quality", + "values": ["High", "Low"], + "default": "High" + }, + { + "id": "shortnames", + "type": "enum", + "label": "Short Names", + "values": ["Off", "On"], + "default": "On" } + ] From 70285fe6ad5201fdec1926c84d8f5888160e7ad7 Mon Sep 17 00:00:00 2001 From: kevcenteno Date: Tue, 9 Dec 2014 21:58:10 -0500 Subject: [PATCH 6/6] update readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 5d78d18..c78e016 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,9 @@ Most devices will allow you to enter your BallStreams username and password from * Live streams don't work on Plex Web Client, and possibly other devices. This is due to the use of HLS streams. Please stream from the BallStreams website directly if you're using a browser! ## Release Log +#### Version .08 - Dec 9, 2014 +* Fix: TrueLive streams on latest Plex Home Theatre (tested on Mac: version 1.2.3) + #### Version .07 - Dec 9, 2014 * Server locations: You can specify which server you want to stream from via Preferences * Add preview video to non-authed main menu