summaryrefslogtreecommitdiff
path: root/plugin.video.mlbtv
diff options
context:
space:
mode:
authoreracknaphobia <eracknaphobia@hotmail.com>2017-04-04 18:30:50 -0400
committerenen92 <enen92@users.noreply.github.com>2017-04-04 23:30:50 +0100
commit589caec2fda22c104d3341eb685b9e9270b7b2bf (patch)
tree3ee3511f0bc4219449bec1a75f58ec6d0ad47223 /plugin.video.mlbtv
parentfb03a9c73debfb78ae6a3717b4677cd455a4c37b (diff)
[plugin.video.mlbtv] 2017.4.2 (#1105)
* [plugin.video.mlbtv] 2017.4.2 * [plugin.video.mlbtv] 2017.4.2
Diffstat (limited to 'plugin.video.mlbtv')
-rw-r--r--plugin.video.mlbtv/addon.xml10
-rw-r--r--plugin.video.mlbtv/changelog.txt61
-rw-r--r--plugin.video.mlbtv/main.py59
-rw-r--r--plugin.video.mlbtv/resources/language/resource.language.en_gb/strings.po24
-rw-r--r--plugin.video.mlbtv/resources/lib/globals.py27
-rw-r--r--plugin.video.mlbtv/resources/settings.xml8
6 files changed, 75 insertions, 114 deletions
diff --git a/plugin.video.mlbtv/addon.xml b/plugin.video.mlbtv/addon.xml
index 5c3463b..3c2f6bd 100644
--- a/plugin.video.mlbtv/addon.xml
+++ b/plugin.video.mlbtv/addon.xml
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.mlbtv" name="MLB.TV®" version="2017.3.7" provider-name="eracknaphobia">
+<addon id="plugin.video.mlbtv" name="MLB.TV®" version="2017.4.2" provider-name="eracknaphobia">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
<import addon="script.module.simplejson" version="3.3.0"/>
<import addon="script.module.pytz" version="2014.2" />
- <import addon="script.module.beautifulsoup4" version="4.3.1" />
- <import addon="script.module.pil" version="1.1.7"/>
+ <import addon="script.module.beautifulsoup4" version="4.3.1" />
</requires>
<extension point="xbmc.python.pluginsource" library="main.py">
<provides>video</provides>
@@ -16,9 +15,8 @@
<description lang="en_GB">Watch every out-of-market regular season game in the office or on the go. The #1 LIVE Streaming Sports Service</description>
<disclaimer lang="en_GB"></disclaimer>
<news>
-- Bumped xbmc python version
-- Converted xml strings file to po file
-- Code clean up
+- Added Proxy settings
+- Removed PIL (it was causing crashes)
</news>
<language>en</language>
<platform>all</platform>
diff --git a/plugin.video.mlbtv/changelog.txt b/plugin.video.mlbtv/changelog.txt
deleted file mode 100644
index b1fddf2..0000000
--- a/plugin.video.mlbtv/changelog.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-2017.3.7
-- Bumped xbmc python version
-- Converted xml strings file to po file
-- Code clean up
-
-2016.7.28
-- Fixed view all recap / condensed for date
-- Fixed play all highlights skipping first highlight video
-
-2016.7.13
-- Fixed error loading MLB plus games
-- Fixed error when single or no games for day (thanks bontibon)
-- Fixed issue when game is only aired nationally
-
-2016.4.29.1
-- Fixed choose stream bug
-
-2016.4.29
-- Changed Full Games selection to use the teams abbreviated name instead of Home/Away
-- Highlights option now avaiable for Live and Archive games (no MLB tv account required)
-- Play individual highlights or select Play All to watch all highlights of the selected game
-- Display recap / condensed game not available message instead of erroring out
-- Added check for invalid username/password
-
-2016.4.19
-- Free games are now highlighted green
-- Changed wording on single team subscription to include free game subscription
-- Added not authorized message when user attempts to request a stream their account is not authorized to access
-- Added blackout lift time in blackout message if game has finished
-- Added logic to catch a username or password change and perform a fresh login
-
-2016.4.12
-- Added Single Team Subscription setting
-- Fixed Full Game not obeying the stream quality setting
-
-2016.4.11
-- Fixed recap, condensed not using stream quality setting
-
-2016.4.7.2
-- Fixed Recap and Condensed switched in single game selection
-
-2016.4.7
-- Replaced Highlights option with Recap (~3 min) and Condensed (~15 min) options for archive games
-- The date menu item can now be selected in order to watch the entire days recaps or condensed clips
-- Reversed stream quality selection dialog so better streams are on top
-- Fixed blackout message not displaying bug
-- Greatly reduced the size of the plugin string
-
-2016.3.24
-- Updated stream qualities values to match newer masterfiles
-- Added "Always Ask" stream quality selection
-
-2016.3.16
-- Added Logout feature in add-on settings
-- Added Highlights (60fps supported)
-
-2016.3.7
-- Added live audio support
-
-2016.3.4
-- Beta released \ No newline at end of file
diff --git a/plugin.video.mlbtv/main.py b/plugin.video.mlbtv/main.py
index 022789d..7149b11 100644
--- a/plugin.video.mlbtv/main.py
+++ b/plugin.video.mlbtv/main.py
@@ -47,6 +47,7 @@ def todaysGames(game_day):
RECAP_PLAYLIST.clear()
EXTENDED_PLAYLIST.clear()
+
try:
itr = json_source['data']['games']['game']
if not isinstance(itr, list):
@@ -62,7 +63,8 @@ def todaysGames(game_day):
def createGameListItem(game, game_day):
- icon = getGameIcon(game['home_team_id'],game['away_team_id'])
+ #icon = getGameIcon(game['home_team_id'],game['away_team_id'])
+ icon = ICON
#http://mlb.mlb.com/mlb/images/devices/ballpark/1920x1080/2681.jpg
#B&W
#fanart = 'http://mlb.mlb.com/mlb/images/devices/ballpark/1920x1080/'+game['venue_id']+'.jpg'
@@ -179,7 +181,7 @@ def createGameListItem(game, game_day):
info = {'plot':desc,'tvshowtitle':'MLB','title':title,'originaltitle':title,'aired':game_day,'genre':LOCAL_STRING(700),'mediatype':'video'}
#Create Playlist for the days recaps and condensed
- '''
+
try:
recap_url, condensed_url = getHighlightLinks(teams_stream, stream_date)
global RECAP_PLAYLIST
@@ -193,7 +195,7 @@ def createGameListItem(game, game_day):
EXTENDED_PLAYLIST.add(condensed_url, listitem)
except:
pass
- '''
+
addStream(name,title,event_id,gid,icon,fanart,info,video_info,audio_info,teams_stream,stream_date)
@@ -633,7 +635,20 @@ def fetchStream(content_id,event_id,playback_scenario):
#Reload Cookies
cj = cookielib.LWPCookieJar(os.path.join(ADDON_PATH_PROFILE, 'cookies.lwp'))
cj.load(os.path.join(ADDON_PATH_PROFILE, 'cookies.lwp'),ignore_discard=True)
- opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
+
+ if PROXY_ENABLED != 'true':
+ opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
+ else:
+ proxy_url = 'http://'+PROXY_SERVER+':'+PROXY_PORT
+ proxy_support = urllib2.ProxyHandler({ 'http': proxy_url, 'https': proxy_url })
+ if PROXY_USER != '' and PROXY_PWD != '':
+ auth_handler = urllib2.ProxyBasicAuthHandler()
+ auth_handler.add_password(None, proxy_url, PROXY_USER, PROXY_PWD)
+ opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj), proxy_support, auth_handler)
+ else:
+ opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj), proxy_support)
+
+ urllib2.install_opener(opener)
if session_key == '':
return stream_url, media_auth
@@ -643,36 +658,8 @@ def fetchStream(content_id,event_id,playback_scenario):
ok = dialog.ok('Game Blacked Out', msg)
return stream_url, media_auth
-
- #epoch_time_now = str(int(round(time.time()*1000)))
-
- #-------------------------
- #Playback Scenario's
- #-------------------------
- '''
- HTTP_CLOUD_WIRED
- HTTP_CLOUD_WIRED_ADS
- HTTP_CLOUD_WIRED_IRDETO
- HTTP_CLOUD_WIRED_WEB
- HTTP_CLOUD_TABLET
- FMS_CLOUD
- HTTP_CLOUD_WIRED_60
- HTTP_CLOUD_WIRED_ADS_60
- HTTP_CLOUD_WIRED_IRDETO_60
- FLASH_500K_400X224
- HTTP_CLOUD_AUDIO
- AUDIO_FMS_32K
- HTTP_CLOUD_AUDIO_TS
-
- PS4 Calls
- "MF": "https://mlb-ws-mf.media.mlb.com/pubajaxws/bamrest/MediaService2_0/op-findUserVerifiedEvent/v-2.3?",
- "mfPlay": "playbackScenario={playbackScenario}&platform={platform}&contentId={contentID}&identityPointId={identityPointID}&fingerprint={fingerprint}&format=json&auth=cookie",
- "mfCatalog": "platform={platform}&subject=LIVE_EVENT_COVERAGE&format=json&eventId={eventId}&fingerprint={fingerprint}&identityPointId={identityPointId}&auth=cookie",
- '''
-
- #https://mlb-ws.mlb.com/pubajaxws/bamrest/MediaService2_0/op-findUserVerifiedEvent/v-2.3?identityPointId=31998790&fingerprint=dUVQMTF5bjRrd1N4Rnp0NlVTUk5wR1NMV0E4PXwxNDU3Mzc0NjI0MDU1fGlwdD1lbWFpbC1wYXNzd29yZA==&eventId=14-469489-2016-03-07&platform=WIN8&playbackScenario=HTTP_CLOUD_AUDIO&contentId=546192183&sessionKey=&subject=LIVE_EVENT_COVERAGE
- url = 'https://mlb-ws-mf.media.mlb.com/pubajaxws/bamrest/MediaService2_0/op-findUserVerifiedEvent/v-2.3'
- #url = 'https://mlb-ws.mlb.com/pubajaxws/bamrest/MediaService2_0/op-findUserVerifiedEvent/v-2.3'
+
+ url = 'https://mlb-ws-mf.media.mlb.com/pubajaxws/bamrest/MediaService2_0/op-findUserVerifiedEvent/v-2.3'
url = url + '?identityPointId='+identity_point_id
url = url + '&fingerprint='+fingerprint
url = url + '&contentId='+content_id
@@ -681,9 +668,7 @@ def fetchStream(content_id,event_id,playback_scenario):
url = url + '&subject=LIVE_EVENT_COVERAGE'
url = url + '&sessionKey='+urllib.quote_plus(session_key)
url = url + '&platform=PS4'
- url = url + '&format=json'
- #url = url + '&frameworkURL=https%3A%2F%2Fmlb-ws-mf.media.mlb.com&frameworkEndPoint=%2Fpubajaxws%2Fbamrest%2FMediaService2_0%2Fop-findUserVerifiedEvent%2Fv-2.3'
- #url = url + '&_='+epoch_time_now
+ url = url + '&format=json'
req = urllib2.Request(url)
req.add_header("Accept", "*/*")
req.add_header("Accept-Encoding", "deflate")
diff --git a/plugin.video.mlbtv/resources/language/resource.language.en_gb/strings.po b/plugin.video.mlbtv/resources/language/resource.language.en_gb/strings.po
index a2538c2..46d5ecf 100644
--- a/plugin.video.mlbtv/resources/language/resource.language.en_gb/strings.po
+++ b/plugin.video.mlbtv/resources/language/resource.language.en_gb/strings.po
@@ -98,4 +98,28 @@ msgstr ""
msgctxt "#700"
msgid "Sports"
+msgstr ""
+
+msgctxt "#30200"
+msgid "Proxy Settings"
+msgstr ""
+
+msgctxt "#30210"
+msgid "Enabled"
+msgstr ""
+
+msgctxt "#30220"
+msgid "Server"
+msgstr ""
+
+msgctxt "#30230"
+msgid "Port"
+msgstr ""
+
+msgctxt "#30240"
+msgid "Username"
+msgstr ""
+
+msgctxt "#30250"
+msgid "Password"
msgstr "" \ No newline at end of file
diff --git a/plugin.video.mlbtv/resources/lib/globals.py b/plugin.video.mlbtv/resources/lib/globals.py
index cd47c53..15d15a3 100644
--- a/plugin.video.mlbtv/resources/lib/globals.py
+++ b/plugin.video.mlbtv/resources/lib/globals.py
@@ -12,7 +12,7 @@ import math
from bs4 import BeautifulSoup
from datetime import date, datetime, timedelta
from urllib2 import URLError, HTTPError
-from PIL import Image
+#from PIL import Image
from cStringIO import StringIO
@@ -27,7 +27,7 @@ ADDON_PATH = xbmc.translatePath(ADDON.getAddonInfo('path'))
ADDON_PATH_PROFILE = xbmc.translatePath(ADDON.getAddonInfo('profile'))
XBMC_VERSION = float(re.findall(r'\d{2}\.\d{1}', xbmc.getInfoLabel("System.BuildVersion"))[0])
LOCAL_STRING = ADDON.getLocalizedString
-ROOTDIR = xbmcaddon.Addon(id='plugin.video.mlbtv').getAddonInfo('path')
+ROOTDIR = ADDON.getAddonInfo('path')
#Settings
settings = xbmcaddon.Addon(id='plugin.video.mlbtv')
@@ -42,7 +42,12 @@ FAV_TEAM = str(settings.getSetting(id="fav_team"))
TEAM_NAMES = settings.getSetting(id="team_names")
TIME_FORMAT = settings.getSetting(id="time_format")
SINGLE_TEAM = str(settings.getSetting(id='single_team'))
-
+#Proxy Settings
+PROXY_ENABLED = str(settings.getSetting(id='use_proxy'))
+PROXY_SERVER = str(settings.getSetting(id='proxy_server'))
+PROXY_PORT = str(settings.getSetting(id='proxy_port'))
+PROXY_USER = str(settings.getSetting(id='proxy_user'))
+PROXY_PWD = str(settings.getSetting(id='proxy_pwd'))
#Colors
SCORE_COLOR = 'FF00B7EB'
@@ -60,10 +65,10 @@ FREE = 'FF43CD80'
#Images
-ICON = ROOTDIR+"/icon.png"
-FANART = ROOTDIR+"/fanart.jpg"
-PREV_ICON = ROOTDIR+"/icon.png"
-NEXT_ICON = ROOTDIR+"/icon.png"
+ICON = os.path.join(ROOTDIR,"icon.png")
+FANART = os.path.join(ROOTDIR,"fanart.jpg")
+PREV_ICON = os.path.join(ROOTDIR,"icon.png")
+NEXT_ICON = os.path.join(ROOTDIR,"icon.png")
if SINGLE_TEAM == 'true':
MASTER_FILE_TYPE = 'master_wired.m3u8'
@@ -95,9 +100,11 @@ def find(source,start_str,end_str):
else:
return ''
+
def getGameIcon(home,away):
#Check if game image already exists
- image_path = ROOTDIR+'/resources/images/'+away+'vs'+home+'.png'
+ #image_path = ROOTDIR+'/resources/images/'+away+'vs'+home+'.png'
+ image_path = os.path.join(ROOTDIR,'resources/images/'+away+'vs'+home+'.png')
file_name = os.path.join(image_path)
if not os.path.isfile(file_name):
try:
@@ -113,14 +120,14 @@ def createGameIcon(home,away,image_path):
bg = Image.new('RGB', (500,250), (0,0,0))
#http://mlb.mlb.com/mlb/images/devices/240x240/110.png
#img_file = urllib.urlopen('http://mlb.mlb.com/mlb/images/devices/76x76/'+home+'.png ')
- img_file = urllib.urlopen('http://mlb.mlb.com/mlb/images/devices/240x240/'+home+'.png ')
+ img_file = urllib.urlopen('http://mlb.mlb.com/mlb/images/devices/240x240/'+home+'.png')
im = StringIO(img_file.read())
home_image = Image.open(im)
#bg.paste(home_image, (267,74), home_image)
bg.paste(home_image, (255,5), home_image)
#img_file = urllib.urlopen('http://mlb.mlb.com/mlb/images/devices/76x76/'+away+'.png ')
- img_file = urllib.urlopen('http://mlb.mlb.com/mlb/images/devices/240x240/'+away+'.png ')
+ img_file = urllib.urlopen('http://mlb.mlb.com/mlb/images/devices/240x240/'+away+'.png')
im = StringIO(img_file.read())
away_image = Image.open(im)
#bg.paste(away_image, (57,74), away_image)
diff --git a/plugin.video.mlbtv/resources/settings.xml b/plugin.video.mlbtv/resources/settings.xml
index 2b6512b..f579877 100644
--- a/plugin.video.mlbtv/resources/settings.xml
+++ b/plugin.video.mlbtv/resources/settings.xml
@@ -23,5 +23,13 @@
<setting id="old_username" type="text" label="" default="" visible="false"/>
<setting id="old_password" type="text" label="" default="" visible="false"/>
</category>
+ <!--Proxy-->
+ <category label='30200'>
+ <setting id='use_proxy' type='bool' label='30210' default='false'/>
+ <setting id='proxy_server' type='text' label='30220' default=''/>
+ <setting id='proxy_port' type='number' label='30230' default=''/>
+ <setting id='proxy_user' type='text' label='30240' default=''/>
+ <setting id='proxy_pwd' type='text' label='30250' option='hidden' default=''/>
+ </category>
</settings>