Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[plugin.video.mlbtv@matrix] 2023.3.28 #4300

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion plugin.video.mlbtv/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.mlbtv" name="MLB.TV®" version="2022.9.5+matrix.1" provider-name="eracknaphobia">
<addon id="plugin.video.mlbtv" name="MLB.TV®" version="2022.10.9+matrix.1" provider-name="eracknaphobia">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.pytz" />
Expand All @@ -24,6 +24,12 @@
<news>
- auto skip: added option to skip to specific batter(s) or pitcher(s)
- fixed game changer display time bug for start time TBD games
- option to skip only commercial breaks
- tweaked idle time / specific player skipping
- added international blackout labels for postseason games
- removed unnecessary Big Inning checks
- removed non-playable WBC qualifier games from list
- added skip adjust start and end settings (recommend 7 and 5 for postseason so far)
</news>
<language>en</language>
<platform>all</platform>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,19 +281,19 @@ msgid "Skip nothing"
msgstr ""

msgctxt "#30405"
msgid "Skip breaks plus idle time"
msgid "Skip all breaks plus idle time between pitches"
msgstr ""

msgctxt "#30406"
msgid "Skip breaks, idle time, and non-action pitches"
msgid "Skip all breaks and non-action pitches"
msgstr ""

msgctxt "#30407"
msgid "Inning"
msgstr ""

msgctxt "#30408"
msgid "Skip breaks"
msgid "Skip all breaks"
msgstr ""

msgctxt "#30409"
Expand Down Expand Up @@ -352,3 +352,16 @@ msgctxt "#30422"
msgid "Select batter(s) or pitcher(s) (one at a time, click Cancel when done)"
msgstr ""

msgctxt "#30423"
msgid "Skip commercial breaks"
msgstr ""

msgctxt "#30424"
msgid "Skip adjust start (seconds)"
msgstr ""

msgctxt "#30425"
msgid "Skip adjust end (seconds)"
msgstr ""


30 changes: 18 additions & 12 deletions plugin.video.mlbtv/resources/lib/mlb.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def todays_games(game_day, start_inning='False'):
url = API_URL + '/api/v1/schedule'
# url += '?hydrate=broadcasts(all),game(content(all)),probablePitcher,linescore,team,flags'
url += '?hydrate=game(content(media(epg))),probablePitcher,linescore,team,flags,gameInfo'
url += '&sportId=1,51'
# 51 is international (i.e. World Baseball Classic) but they aren't streamed in the normal way
#url += '&sportId=1,51'
url += '&sportId=1'
url += '&date=' + game_day

headers = {
Expand Down Expand Up @@ -94,7 +96,10 @@ def todays_games(game_day, start_inning='False'):

# Big Inning and game changer only available for non-free accounts
if ONLY_FREE_GAMES != 'true':
create_big_inning_listitem(game_day)
# if the requested date is not in the past, we have games for this date, and it's a regular season date,
# then show the Big Inning listitem
if today <= game_day and len(games) > 0 and games[0]['seriesDescription'] == 'Regular Season':
create_big_inning_listitem(game_day)

# if it's today, show the game changer listitem
if today == game_day and game_changer_start is not None and game_changer_end is not None and (len(games) - len(blackouts)) > 1:
Expand Down Expand Up @@ -820,7 +825,7 @@ def stream_select(game_pk, spoiler='True', suspended='False', start_inning='Fals
# show automatic skip dialog, if possible, enabled, and we're not looking to autoplay
if skip_possible is True and ASK_TO_SKIP == 'true' and autoplay is False:
# automatic skip dialog with options to skip nothing, breaks, breaks + idle time, breaks + idle time + non-action pitches
skip_type = dialog.select(LOCAL_STRING(30403), [LOCAL_STRING(30404), LOCAL_STRING(30408), LOCAL_STRING(30405), LOCAL_STRING(30421), LOCAL_STRING(30406)])
skip_type = dialog.select(LOCAL_STRING(30403), [LOCAL_STRING(30404), LOCAL_STRING(30423), LOCAL_STRING(30408), LOCAL_STRING(30405), LOCAL_STRING(30421), LOCAL_STRING(30406)])
# cancel will exit
if skip_type == -1:
sys.exit()
Expand Down Expand Up @@ -865,7 +870,7 @@ def stream_select(game_pk, spoiler='True', suspended='False', start_inning='Fals
if (skip_type > 0 or start_inning > 0) and broadcast_start_timestamp is not None:
from .mlbmonitor import MLBMonitor
mlbmonitor = MLBMonitor()
mlbmonitor.skip_monitor(skip_type, game_pk, broadcast_start_timestamp, is_live, start_inning, start_inning_half)
mlbmonitor.skip_monitor(skip_type, game_pk, broadcast_start_timestamp, stream_url, is_live, start_inning, start_inning_half)
# otherwise exit
else:
sys.exit()
Expand Down Expand Up @@ -1172,16 +1177,17 @@ def get_airings_data(content_id=None, game_pk=None):
def get_blackout_status(game, regional_fox_games_exist):
blackout_type = 'False'
blackout_time = None
if re.match('^[0-9]{5}$', ZIP_CODE):
if 'content' in game and 'media' in game['content'] and 'epg' in game['content']['media'] and len(game['content']['media']['epg']) > 0 and 'items' in game['content']['media']['epg'][0] and len(game['content']['media']['epg'][0]['items']) > 0 and 'mediaFeedType' in game['content']['media']['epg'][0]['items'][0] and game['content']['media']['epg'][0]['items'][0]['mediaFeedType'] == 'NATIONAL':
if game['content']['media']['epg'][0]['items'][0]['callLetters'] == 'FOX':
if regional_fox_games_exist == False:
blackout_type = 'National'
else:
national_blackout = re.match('^[0-9]{5}$', ZIP_CODE)

if 'content' in game and 'media' in game['content'] and 'epg' in game['content']['media'] and len(game['content']['media']['epg']) > 0 and 'items' in game['content']['media']['epg'][0] and len(game['content']['media']['epg'][0]['items']) > 0 and 'mediaFeedType' in game['content']['media']['epg'][0]['items'][0] and game['content']['media']['epg'][0]['items'][0]['mediaFeedType'] == 'NATIONAL':
if (game['content']['media']['epg'][0]['items'][0]['callLetters'] != 'FOX') or (game['content']['media']['epg'][0]['items'][0]['callLetters'] == 'FOX' and regional_fox_games_exist == False):
if game['seriesDescription'] != 'Spring Training' and game['seriesDescription'] != 'Regular Season':
blackout_type = 'International'
elif national_blackout:
blackout_type = 'National'

if blackout_type == 'False' and game['seriesDescription'] != 'Spring Training' and (game['teams']['away']['team']['abbreviation'] in BLACKOUT_TEAMS or game['teams']['home']['team']['abbreviation'] in BLACKOUT_TEAMS):
blackout_type = 'Local'
if national_blackout and blackout_type == 'False' and game['seriesDescription'] != 'Spring Training' and (game['teams']['away']['team']['abbreviation'] in BLACKOUT_TEAMS or game['teams']['home']['team']['abbreviation'] in BLACKOUT_TEAMS):
blackout_type = 'Local'

# also calculate a blackout time for non-suspended, non-TBD games
if blackout_type != 'False' and 'resumeGameDate' not in game and 'resumedFromDate' not in game and game['status']['startTimeTBD'] is False:
Expand Down
Loading