Skip to content

Commit

Permalink
added live game changer, etc. (#47)
Browse files Browse the repository at this point in the history
Co-authored-by: tonywagner <you@example.com>
  • Loading branch information
tonywagner and tonywagner authored Jul 1, 2022
1 parent bc3a419 commit 3e2c882
Show file tree
Hide file tree
Showing 8 changed files with 1,306 additions and 156 deletions.
12 changes: 5 additions & 7 deletions 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.6.9" provider-name="eracknaphobia">
<addon id="plugin.video.mlbtv" name="MLB.TV®" version="2022.6.29" provider-name="eracknaphobia">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
<import addon="script.module.pytz" />
Expand All @@ -22,12 +22,10 @@
</description>
<disclaimer lang="en_GB">Requires an MLB.tv account</disclaimer>
<news>
- optional zip code setting to detect and label blackout streams (does not circumvent blackouts)
- tweaked skip timings, particularly for non-action pitches and overturned reviews
- option to disable video length padding (in case of proxy conflicts)
- restored 24-hour time format label, applied it to Big Inning listitem
- label regional national games
- added additional action play type in skip monitor
- live game changer based on leverage index
- streamlined blackout detection
- reduced autoplay checks
- improved monitor logging
</news>
<language>en</language>
<platform>all</platform>
Expand Down
7 changes: 7 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,18 @@

# Logout
elif mode == 400:
from resources.lib.account import Account
account = Account()
account.logout()
dialog = xbmcgui.Dialog()
dialog.notification(LOCAL_STRING(30260), LOCAL_STRING(30261), ICON, 5000, False)

# Game Changer
elif mode == 500:
from resources.lib.mlbmonitor import MLBMonitor
mlbmonitor = MLBMonitor()
mlbmonitor.change_monitor(blackout.split(','))

# play all recaps or condensed games for selected date
elif mode == 900:
playAllHighlights(stream_date)
Expand Down
16 changes: 16 additions & 0 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,19 @@ msgstr ""
msgctxt "#30416"
msgid "Disable video length padding (in case of proxy conflict)"
msgstr ""

msgctxt "#30417"
msgid "MLB.TV Game Changer"
msgstr ""

msgctxt "#30418"
msgid "Automatically switches between the highest leverage active live games."
msgstr ""

msgctxt "#30419"
msgid "Currently there are no active live games"
msgstr ""

msgctxt "#30420"
msgid "Game Changer delay (seconds)"
msgstr ""
16 changes: 4 additions & 12 deletions resources/lib/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import json
from kodi_six import xbmc, xbmcvfs, xbmcplugin, xbmcgui, xbmcaddon
import random
from collections import namedtuple, deque

if sys.version_info[0] > 2:
import http
Expand Down Expand Up @@ -51,10 +52,12 @@
ASK_TO_SKIP = str(settings.getSetting(id='ask_to_skip'))
AUTO_PLAY_FAV = str(settings.getSetting(id='auto_play_fav'))
ONLY_FREE_GAMES = str(settings.getSetting(id="only_free_games"))
GAME_CHANGER_DELAY = int(settings.getSetting(id="game_changer_delay"))

#Monitor setting
MLB_MONITOR_STARTED = settings.getSetting(id='mlb_monitor_started')
if MLB_MONITOR_STARTED != '' and not xbmc.getCondVisibility("Player.HasMedia"):
now = datetime.now()
if MLB_MONITOR_STARTED != '' and not xbmc.getCondVisibility("Player.HasMedia") and (parse(MLB_MONITOR_STARTED) + timedelta(seconds=5)) < now:
xbmc.log("MLB Monitor detection resetting due to no stream playing")
settings.setSetting(id='mlb_monitor_started', value='')

Expand Down Expand Up @@ -94,17 +97,6 @@

VERIFY = True

#Skip monitor
#These are the break events to skip
BREAK_TYPES = ['Game Advisory', 'Pitching Substitution', 'Offensive Substitution', 'Defensive Sub', 'Defensive Switch', 'Runner Placed On Base', 'Injury']
#These are the action events to keep, in addition to the last event of each at-bat, if we're skipping non-decision pitches
ACTION_TYPES = ['Wild Pitch', 'Passed Ball', 'Stolen Base', 'Caught Stealing', 'Pickoff', 'Error', 'Out', 'Balk', 'Defensive Indiff', 'Other Advance']
#Pad events at both start (-) and end (+)
EVENT_START_PADDING = -3
PITCH_END_PADDING = 3
ACTION_END_PADDING = 8
MINIMUM_BREAK_DURATION = 5

SECONDS_PER_SEGMENT = 5

def find(source,start_str,end_str):
Expand Down
289 changes: 183 additions & 106 deletions resources/lib/mlb.py

Large diffs are not rendered by default.

Loading

0 comments on commit 3e2c882

Please sign in to comment.