-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from elParaguayo/issue_20_runscript
Issue 20 runscript
- Loading branch information
Showing
8 changed files
with
207 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
''' | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
''' | ||
|
||
''' This script is part of the BBC Football Scores service by elParaguayo | ||
Its purpose is to handle all non-core elements of the service. | ||
If called directly it will (eventually) present a menu of different options. | ||
Alternatively it can be called passing any of the following parameters: | ||
mode: | ||
selectleague: run the Select Leagues dialogue | ||
leaguetable: display league tables | ||
matchdetail: display additional match detail | ||
fixtures: display upcoming fixturs (WIP) | ||
results: display historic results (WIP) | ||
''' | ||
|
||
import sys | ||
|
||
# Import standard xbmc/kodi modules | ||
import xbmc | ||
import xbmcgui | ||
import xbmcaddon | ||
|
||
# Import service specific objects | ||
from resources.lib.settings import selectLeagues, toggleNotification | ||
from resources.lib.league_tables import XBMCLeagueTable | ||
from resources.lib.live_scores_detail import XBMCLiveScoresDetail | ||
from resources.lib.utils import closeAddonSettings | ||
from resources.lib.menu import FootballHelperMenu | ||
|
||
# Import PyXBMCt module. | ||
from pyxbmct.addonwindow import * | ||
|
||
try: | ||
params = dict((x.split("=") for x in sys.argv[1].lower().split(";"))) | ||
except (ValueError, AttributeError, IndexError): | ||
params = {} | ||
|
||
# If no parameters are passed then we show default menu | ||
if not params: | ||
|
||
menu = FootballHelperMenu() | ||
menu.show() | ||
|
||
|
||
# If there are parameters, let's see what we want to do... | ||
if params.get("mode") == "selectleague": | ||
|
||
selectLeagues() | ||
|
||
elif params.get("mode") == "leaguetable": | ||
|
||
# Close addon setting window (if open) | ||
closeAddonSettings() | ||
|
||
# Create an instance of the XBMC League Table | ||
xlt = XBMCLeagueTable() | ||
|
||
# and display it! | ||
xlt.start() | ||
|
||
elif params.get("mode") == "matchdetail": | ||
|
||
# Close addon setting window (if open) | ||
closeAddonSettings() | ||
|
||
# Create an instance of the XBMC League Table | ||
xlsd = XBMCLiveScoresDetail() | ||
|
||
# and display it! | ||
xlsd.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
''' | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
''' | ||
|
||
''' This script is part of the BBC Football Scores service by elParaguayo | ||
''' | ||
import xbmc | ||
|
||
# Import PyXBMCt module. | ||
from pyxbmct.addonwindow import * | ||
|
||
_A_ = xbmcaddon.Addon("service.bbclivefootballscores") | ||
_S_ = _A_.getSetting | ||
|
||
def localise(id): | ||
'''Gets localised string. | ||
Shamelessly copied from service.xbmc.versioncheck | ||
''' | ||
string = _A_.getLocalizedString(id).encode( 'utf-8', 'ignore' ) | ||
return string | ||
|
||
class FootballHelperMenu(object): | ||
|
||
def __init__(self): | ||
|
||
pass | ||
|
||
def show(self): | ||
|
||
# Set the title and menu size | ||
self.window = AddonDialogWindow("Menu") | ||
self.window.setGeometry(450,300,5,2) | ||
|
||
# ITEM 1 - LEAGUE TABLES | ||
self.ltbutton = Button("Show League Tables") | ||
self.window.placeControl(self.ltbutton, 0, 0, columnspan = 2) | ||
|
||
# ITEM 2 - MATCH DETAIL | ||
self.mdbutton = Button("Show Match Detail") | ||
self.window.placeControl(self.mdbutton, 1, 0, columnspan = 2) | ||
|
||
# CLOSE BUTTON | ||
|
||
self.clbutton = Button("Close") | ||
self.window.placeControl(self.clbutton, 4, 0, columnspan = 2) | ||
|
||
# Bind actions | ||
self.window.connect(ACTION_PREVIOUS_MENU, lambda: self.window.close()) | ||
self.window.connect(ACTION_NAV_BACK, lambda: self.window.close()) | ||
self.window.connect(self.clbutton, lambda: self.window.close()) | ||
self.window.connect(self.ltbutton, lambda: self.open("leaguetable")) | ||
self.window.connect(self.mdbutton, lambda: self.open("matchdetail")) | ||
|
||
self.window.setFocus(self.ltbutton) | ||
|
||
# Handle navigation to make user experience better | ||
self.ltbutton.controlDown(self.mdbutton) | ||
self.mdbutton.controlUp(self.ltbutton) | ||
self.mdbutton.controlDown(self.clbutton) | ||
self.clbutton.controlUp(self.mdbutton) | ||
# self.leaguelist.controlLeft(self.leaguebutton) | ||
# self.leaguelist.controlRight(self.closebutton) | ||
# self.closebutton.controlUp(self.leaguelist) | ||
# self.closebutton.controlLeft(self.leaguebutton) | ||
# self.leaguebutton.controlRight(self.closebutton) | ||
# self.leaguebutton.controlUp(self.leaguelist) | ||
|
||
# Ready to go... | ||
self.window.doModal() | ||
|
||
def open(self, mode): | ||
|
||
self.window.close() | ||
xbmc.executebuiltin("RunScript(service.bbclivefootballscores, mode={0})".format(mode)) |
Oops, something went wrong.