One question, is it possible to code a liveticker like this from my enigma2 receiver or is it a mammut project and to much work?
I can help but only with graphics. ;-) It would be cool to have a Live Score in different designs for different leagues like Premier League, Bundesliga,...
http://www.vuplus-support.org/wbb3/index...liveticker
or
https://sites.google.com/site/kashmirplu...ker-online --> only football part
For the first one the *.py code is:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re, time
from datetime import datetime
from Components.ActionMap import *
from Components.Label import Label
from Components.MenuList import MenuList
from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmap, MultiContentEntryPixmapAlphaTest
from Components.Pixmap import Pixmap
from Components.AVSwitch import AVSwitch
from Components.config import config, ConfigInteger, ConfigSelection, getConfigListEntry, ConfigText, ConfigDirectory, ConfigYesNo, configfile, ConfigSelection, ConfigSubsection, ConfigPIN, NoSave, ConfigNothing
from Components.ConfigList import ConfigListScreen
from Components.PluginComponent import plugins
from Components.Button import Button
from Screens.InputBox import InputBox
from Screens.ChoiceBox import ChoiceBox
from Screens.ChannelSelection import ChannelSelection
from Screens.InfoBar import InfoBar
from Screens.InfoBarGenerics import InfoBarSubserviceSelection, InfoBarSeek, InfoBarShowHide
from Screens.MovieSelection import MovieSelection
from Screens.MessageBox import MessageBox
from Screens.SubservicesQuickzap import SubservicesQuickzap
from Screens.Screen import Screen
from skin import parseColor
from Tools.Directories import pathExists, fileExists, SCOPE_SKIN_IMAGE, resolveFilename
from Tools.LoadPixmap import LoadPixmap
from Plugins.Plugin import PluginDescriptor
from twisted.web.client import getPage
from twisted.web.client import downloadPage
from enigma import eListboxPythonMultiContent, ePicLoad, eListbox, eTimer, gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, loadPNG, RT_WRAP, eServiceReference, getDesktop, loadJPG
def applySkinVars(skin,dict):
for key in dict.keys():
try:
skin = skin.replace('{'+key+'}',dict[key])
except Exception,e:
print e,"@key=",key
return skin
# ticker position
tickerpos_x = 20
tickerpos_y = 620
# config
config.plugins.sport1ticker = ConfigSubsection()
config.plugins.sport1ticker.tickerpos_x = ConfigInteger(tickerpos_x, (-20,100))
config.plugins.sport1ticker.tickerpos_y = ConfigInteger(tickerpos_y, (000,700))
config.plugins.sport1ticker.ansicht = ConfigSelection(default="nebeneinander", choices = [("nebeneinander",_("nebeneinander")),("untereinander",_("untereinander"))])
config.plugins.sport1ticker.select_liga = ConfigSelection(default="bl", choices = [("bl",_("1 liga")),("bl2",_("2 liga")),("dp",_("DFB Pokal")),("cl",_("Championsleague")),("uc",_("Europaleague")),("wq",_("WM Quali"))])
config.plugins.sport1ticker.farbe = ConfigSelection(default="0x00dab329", choices = [("0xCC0000",_("Rot")),("0x00dab329",_("Gelb")),("0xFFFFFF",_("Weiss")),("0x663300",_("Braun")),("0x339966",_("Olive")),("0x666633",_("Grau")),("0x00ffff",_("HellBlau")),("0xccff33",_("HellGrün")),("0xff00ff",_("Lila")),("0x006633",_("Army"))])
config.plugins.sport1ticker.farbe_neu = ConfigSelection(default="0xCC0000", choices = [("0xCC0000",_("Rot")),("0x00dab329",_("Gelb")),("0xFFFFFF",_("Weiss")),("0x663300",_("Braun")),("0x339966",_("Olive")),("0x666633",_("Grau")),("0x00ffff",_("HellBlau")),("0xccff33",_("HellGrün")),("0xff00ff",_("Lila")),("0x006633",_("Army"))])
config.plugins.sport1ticker.live_farbe = ConfigSelection(default="yellow", choices = [("red",_("Rot")),("yellow",_("Gelb")),("blue",_("Blau")),("grey",_("Grau")),("green",_("Gruen")),("darkgrey",_("Dark Grau")),("white",_("Weiss"))])
config.plugins.sport1ticker.live_spiel = ConfigSelection(default="0x339966", choices = [("0xCC0000",_("Rot")),("0x00dab329",_("Gelb")),("0xFFFFFF",_("Weiss")),("0x663300",_("Braun")),("0x339966",_("Olive")),("0x666633",_("Grau")),("0x00ffff",_("HellBlau")),("0xccff33",_("HellGrün")),("0xff00ff",_("Lila")),("0x006633",_("Army"))])
config.plugins.sport1ticker.refreshtimer = ConfigInteger(10, (10,120))
config.plugins.sport1ticker.hideTimerOnOff = ConfigSelection(default=True, choices = [(True,_("AN")),(False,_("AUS"))])
config.plugins.sport1ticker.hideTimer = ConfigInteger(5, (5,60))
config.plugins.sport1ticker.hidetabTimer = ConfigInteger(5, (5,60))
config.plugins.sport1ticker.hidetabTimerOnOff = ConfigSelection(default=True, choices = [(True,_("AN")),(False,_("AUS"))])
config.plugins.sport1ticker.hideDateOnOff = ConfigSelection(default=True, choices = [(True,_("AN")),(False,_("AUS"))])
class tickerlist(MenuList):
def __init__(self, list):
MenuList.__init__(self, list, False, eListboxPythonMultiContent)
self.l.setFont(0, gFont("Regular", 14))
self.l.setFont(1, gFont("Regular", 16))
self.l.setFont(2, gFont("Regular", 17))
self.l.setFont(3, gFont("Regular", 18))
self.l.setFont(4, gFont("Regular", 19))
self.l.setFont(5, gFont("Regular", 20))
self.l.setFont(6, gFont("Regular", 22))
self.l.setFont(7, gFont("Regular", 24))
class sport1Setup(ConfigListScreen,Screen):
if getDesktop(0).size().width() == 1280:
skin = """
<screen position="center,center" size="640,450" title="Sport1 Ticker v0.4" >
<widget name="config" position="0,0" size="640,400" scrollbarMode="showOnDemand" />
<widget name="buttonred" position="10,400" size="90,40" backgroundColor="red" valign="center" halign="center" zPosition="1" foregroundColor="white" font="Regular;18"/>
<widget name="buttongreen" position="540,400" size="90,40" backgroundColor="green" valign="center" halign="center" zPosition="1" foregroundColor="white" font="Regular;18"/>
</screen>"""
def __init__(self, session):
self.session = session
Screen.__init__(self, session)
self.list = []
self.list.append(getConfigListEntry("Ticker X Position", config.plugins.sport1ticker.tickerpos_x))
self.list.append(getConfigListEntry("Ticker Y Position", config.plugins.sport1ticker.tickerpos_y))
self.list.append(getConfigListEntry(_("Ticker ansicht:"), config.plugins.sport1ticker.ansicht))
self.list.append(getConfigListEntry(_("Bundesliga:"), config.plugins.sport1ticker.select_liga))
self.list.append(getConfigListEntry(_("Live Ticker Update Intervall in x sec."), config.plugins.sport1ticker.refreshtimer))
self.list.append(getConfigListEntry(_("Ticker Ausblenden:"), config.plugins.sport1ticker.hideTimerOnOff))
self.list.append(getConfigListEntry(_("Ticker Ausblenden nach x sec."), config.plugins.sport1ticker.hideTimer))
self.list.append(getConfigListEntry(_("Farbe der Tor Ergebnisse"), config.plugins.sport1ticker.farbe))
self.list.append(getConfigListEntry(_("Farbe der Tor Ergebnisse bei einem Tor:"), config.plugins.sport1ticker.farbe_neu))
self.list.append(getConfigListEntry(_("Farbe der Tor Ergebnisse wenn Live:"), config.plugins.sport1ticker.live_spiel))
self.list.append(getConfigListEntry(_("Farbe des Live Tickers:"), config.plugins.sport1ticker.live_farbe))
self.list.append(getConfigListEntry(_("Tabelle Ausblenden:"), config.plugins.sport1ticker.hidetabTimerOnOff))
self.list.append(getConfigListEntry(_("Tabelle Ausblenden nach x sec."), config.plugins.sport1ticker.hidetabTimer))
self.list.append(getConfigListEntry(_("Zeige Datum im Ticker:"), config.plugins.sport1ticker.hideDateOnOff))
ConfigListScreen.__init__(self, self.list)
self["buttonred"] = Label(_("cancel"))
self["buttongreen"] = Label(_("ok"))
self["setupActions"] = ActionMap(["SetupActions"],
{
"green": self.save,
"red": self.cancel,
"save": self.save,
"cancel": self.cancel,
"ok": self.save,
}, -2)
def save(self):
for x in self["config"].list:
x[1].save()
self.close(True)
def cancel(self):
self.close(False)
class Sport1Tabelle(Screen):
if getDesktop(0).size().width() == 1280:
skin = """
<screen position="center,center" size="580,500" transparent="0" flags="wfNoBorder" >
<widget name="tabelle" position="0,20" size="580,500" transparent="0" scrollbarMode="showNever" />
</screen>"""
def __init__(self, session, select_liga, gameday):
self.select_liga = select_liga
self.gameday = gameday
Screen.__init__(self, session)
self.session = session
self["actions"] = ActionMap(["OkCancelActions", "DirectionActions", "MovieSelectionActions", "SetupActions"],
{
"ok": self.exit,
"cancel": self.exit,
"showEventInfo": self.exit
}, -1)
self["tabelle"] = tickerlist([])
# hide timer interval
self.hidetabTimer_interval = int(config.plugins.sport1ticker.hidetabTimer.value) * 1000
# init timer
if config.plugins.sport1ticker.hidetabTimerOnOff:
self.hidetab = eTimer()
self.hidetab.callback.append(self.exit)
# get infos
self.onClose.append(self.__onClose)
self.onLayoutFinish.append(self.loadPage)
def loadPage(self):
url = "http://ticker.sport1.de/ticker/data/fussball/%s/2013-2014/%s/games.json" % (self.select_liga, self.gameday)
print url
getPage(url, headers={'Content-Type':'application/x-www-form-urlencoded'}).addCallback(self.loadData).addErrback(self.dataError)
def dataError(self, error):
print error
def loadData(self, data):
tab_data = re.findall('"games"
![Sad Sad](https://forum.kodi.tv/images/smilies/frown.png)
.*?),"goal":{"against"
![Sad Sad](https://forum.kodi.tv/images/smilies/frown.png)
.*?),"fore"
![Sad Sad](https://forum.kodi.tv/images/smilies/frown.png)
.*?)},"loss":.*?,"rank"
![Sad Sad](https://forum.kodi.tv/images/smilies/frown.png)
.*?),"lastrank"
![Sad Sad](https://forum.kodi.tv/images/smilies/frown.png)
.*?),"diff":.*?,"name":"(.*?)","win":.*?,"points"
![Sad Sad](https://forum.kodi.tv/images/smilies/frown.png)
.*?),', data, re.S)
if tab_data:
tab = []
for (spieltage,rein,raus,rank,lastrank,name,points) in tab_data:
diff = "%s:%s" % (raus,rein)
print rank,lastrank,name,spieltage,diff,points
tab.append(self.show_tab(rank,lastrank,name,spieltage,diff,points))
self["tabelle"].l.setList(tab)
self["tabelle"].l.setItemHeight(26)
self["tabelle"].selectionEnabled(0)
if config.plugins.sport1ticker.hidetabTimerOnOff.value:
self.hidetab.start(self.hidetabTimer_interval)
def show_tab(self,rank,lastrank,name,spieltage,diff,points):
res = [(rank,lastrank,name,spieltage,diff,points)]
up = "/usr/lib/enigma2/python/Plugins/Extensions/Sport1ticker/images/up.png"
down = "/usr/lib/enigma2/python/Plugins/Extensions/Sport1ticker/images/down.png"
gleich = "/usr/lib/enigma2/python/Plugins/Extensions/Sport1ticker/images/gleich.png"
if int(rank) < int(lastrank):
res.append(MultiContentEntryPixmapAlphaTest(pos=(13, 1), size=(24, 24), png=loadPNG(up)))
elif int(rank) > int(lastrank):
res.append(MultiContentEntryPixmapAlphaTest(pos=(13, 1), size=(24, 24), png=loadPNG(down)))
elif int(rank) == int(lastrank):
res.append(MultiContentEntryPixmapAlphaTest(pos=(13, 1), size=(24, 24), png=loadPNG(gleich)))
res.append(MultiContentEntryText(pos=(50, 0), size=(50, 26), font=7, text=rank+".", flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(100, 0), size=(50, 26), font=7, text="("+lastrank+")", flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(175, 0), size=(225, 26), font=7, text=unix_to_unicode(name), flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(410, 0), size=(50, 26), font=7, text=spieltage, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(450, 0), size=(80, 26), font=7, text=diff, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(540, 0), size=(40, 26), font=7, text=points, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
return res
def __onClose(self):
if config.plugins.sport1ticker.hidetabTimerOnOff.value:
self.hidetab.stop()
def exit(self):
self.close()
class sport1Ticker(Screen):
#if getDesktop(0).size().width() == 1280:
raw_skin = """
<screen position="{screen.position}" size="{screen.position2}" transparent="0" flags="wfNoBorder" >
<widget name="ticker_matches" position="0,0" size="{screen.position3}" transparent="0" scrollbarMode="showNever" />
<widget name="ticker_msg" position="{screen.position4}" size="{screen.position5}" zPosition="1" halign="left" valign="center" font="Regular;19" transparent="0" foregroundColor="%s" />
</screen>""" % config.plugins.sport1ticker.live_farbe.value
def __init__(self, session):
self.session = session
# init screen
tickerpos_x = config.plugins.sport1ticker.tickerpos_x.value
tickerpos_y = config.plugins.sport1ticker.tickerpos_y.value
if config.plugins.sport1ticker.ansicht.value == "nebeneinander":
screen_size_x = 1240
screen_size_y = 82
table_size_x = 1240
table_size_y = 60
msg_pos_x = 20
msg_pos_y = 60
msg_size_x = 1200
msg_size_y = 20
else:
screen_size_x = 480
screen_size_y = 250
table_size_x = 480
table_size_y = 250
msg_pos_x = 20
msg_pos_y = 180
msg_size_x = 480
msg_size_y = 20
self.dict = {'screen.position': "%i,%i"%(tickerpos_x,tickerpos_y), 'screen.position2': "%i,%i"%(screen_size_x,screen_size_y), 'screen.position3': "%i,%i"%(screen_size_x,screen_size_y), 'screen.position4': "%i,%i"%(msg_pos_x,msg_pos_y), 'screen.position5': "%i,%i"%(msg_size_x,msg_size_y),}
self.skin = applySkinVars(sport1Ticker.raw_skin,self.dict)
Screen.__init__(self, session)
self["actions"] = ActionMap(["ColorActions","OkCancelActions","DirectionActions","HelpActions","MovieSelectionActions","InputActions","InfobarActions","InfobarTeletextActions","ChannelSelectBaseActions"],
{
"ok": self.ok,
"cancel": self.exit,
"showMovies": self.loadPage,
"contextMenu": self.configScreen,
"showEventInfo": self.tabelle,
"up": self.up,
"down": self.down,
"green": self.subkanal,
"blue": self.extension,
"right": self.zapDown,
"left": self.zapUp,
"0": self.history
}, -1)
self["ticker_msg"] = Label("")
self["ticker_msg"].setText("Zur Zeit keine infos vorhanden.")
self["ticker_matches"] = tickerlist([])
# ticker interval
self.update_interval = int(config.plugins.sport1ticker.refreshtimer.value) * 1000
self.hideTimer_interval = int(config.plugins.sport1ticker.hideTimer.value) * 1000
# tricky
self.reloadgui = False
self.firststart = True
self.show_tor = False
# hide ticker timer
if config.plugins.sport1ticker.hideTimerOnOff.value:
self.hideTimer = eTimer()
self.hideTimer.callback.append(self.hideTicker)
self.hideTimer.start(self.hideTimer_interval)
# autoload loadPage
self.updateTimer = eTimer()
self.updateTimer.callback.append(self.loadPage)
# init farben
self.tor_farbe = long(config.plugins.sport1ticker.farbe.value, 16)
self.tor_farbe_neu = long(config.plugins.sport1ticker.farbe_neu.value, 16)
self.live_spiel = long(config.plugins.sport1ticker.live_spiel.value, 16)
# init game tables
self.games_data = []
self.games_data_old = []
# select liga from config
self.select_liga = config.plugins.sport1ticker.select_liga.value
# zeige datum im ticker
self.hideDateOnOff = config.plugins.sport1ticker.hideDateOnOff.value
# get infos
self.onLayoutFinish.append(self.loadPage)
self.onClose.append(self.__onClose)
def subkanal(self):
if InfoBar and InfoBar.instance:
InfoBar.subserviceSelection(InfoBar.instance)
def history(self):
if InfoBar and InfoBar.instance:
InfoBar.historyNext(InfoBar.instance)
def extension(self):
if InfoBar and InfoBar.instance:
InfoBar.showExtensionSelection(InfoBar.instance)
def zapDown(self):
if InfoBar and InfoBar.instance:
InfoBar.zapDown(InfoBar.instance)
def zapUp(self):
if InfoBar and InfoBar.instance:
InfoBar.zapUp(InfoBar.instance)
def hideTicker(self):
if self.shown:
print "[Sport1]: hide ticker."
if config.plugins.sport1ticker.hideTimerOnOff.value:
self.hideTimer.stop()
self.hide()
def loadPage(self):
# stop updateTmer
self.updateTimer.stop()
# get gameday
if self.firststart:
self.firststart = False
init_url = "http://ticker.sport1.de/ticker/data/fussball/"+self.select_liga+"/init.json"
getPage(init_url, headers={'Content-Type':'application/x-www-form-urlencoded'}).addCallback(self.get_gameday).addErrback(self.dataError)
# hole daten
print "[Sport1]: update.."
url = "http://ticker.sport1.de/ticker/data/fussball/"+self.select_liga+"/2013-2014/gameplan.json"
getPage(url, headers={'Content-Type':'application/x-www-form-urlencoded'}).addCallback(self.loadData).addErrback(self.dataError)
def dataError(self, error):
print error
def get_gameday(self, data):
check_gameday = re.findall('"gameday"
![Sad Sad](https://forum.kodi.tv/images/smilies/frown.png)
.*?),', data, re.S)
if check_gameday:
print "[Sport1]: gameday %s" % check_gameday[0]
self.gameday = check_gameday[0]
def loadData(self, data):
self.ticker_games = []
matches = re.findall('"active"
![Sad Sad](https://forum.kodi.tv/images/smilies/frown.png)
[false|true].*?),.*?"gameid"
![Sad Sad](https://forum.kodi.tv/images/smilies/frown.png)
[0-9]*),".*?date":"(.*?)".*?"tickerUrl":"(.*?)".*?"guest":{"longname":"(.*?)","result"
![Sad Sad](https://forum.kodi.tv/images/smilies/frown.png)
.*?),".*?"home":{"longname":"(.*?)","result"
![Sad Sad](https://forum.kodi.tv/images/smilies/frown.png)
.*?),"',data, re.S)
if matches:
self.games_data = []
if self.select_liga == "bl":
bundesliga = "bundesliga"
elif self.select_liga == "bl2":
bundesliga = "bundesliga2"
elif self.select_liga == "dp":
bundesliga = "dfbpokal"
elif self.select_liga == "cl":
bundesliga = "championsleague"
elif self.select_liga == "uc":
bundesliga = "europaleague"
elif self.select_liga == "wq":
bundesliga = "wmquali"
for live,id,datum,url,guest,gr,home,hr in matches:
m_regex = '.*?http://ticker.sport1.de/liveticker/fussball/'+bundesliga+'/sport1.de/#/.*?,'+self.gameday+',.*?/'
#print m_regex
if re.match(m_regex, url, re.S):
match = "%s - %s" % (home,guest)
tore = "%s - %s" % (hr,gr)
self.games_data.append((live,datum,match,tore))
if self.games_data:
self.show_tor = False
self.ticker_games.append(self.display_matches(self.games_data))
self["ticker_matches"].l.setList(self.ticker_games)
if config.plugins.sport1ticker.ansicht.value == "untereinander":
self["ticker_matches"].l.setItemHeight(180)
else:
self["ticker_matches"].l.setItemHeight(60)
self["ticker_matches"].selectionEnabled(0)
print "[Sport1]: rename data > data_old"
self.games_data_old = self.games_data
# starte updateTimer
self.updateTimer.start(self.update_interval)
def checkin(self, check):
# rebuild list games_data_old
temp_list = []
for each in self.games_data_old:
#temp_list.append(each[1:])
temp_list.append(each[2:])
(c_datum,c_status,c_match,c_tore) = check
# search in games_data_old
search = (c_match, c_tore)
if search in temp_list:
return False
else:
self.show_tor = True
return True
def display_matches(self, entry):
count = 0
res = [()]
for check in entry:
(status,datum,match,tore) = check
count += 1
tor = self.checkin(check)
print tor, datum, unix_to_unicode(match), status, tore
if self.hideDateOnOff:
# zeit formatierung
(days,month,year,uhrzeit,dump) = datum.split(' ')
(std,min,sec) = uhrzeit.split(':')
d = datetime(int(year), month_to_int(month), int(days), int(std), int(min), 0, 0)
spielbeginn_unixzeit = d.strftime('%s')
aktuelle_unixzeit = int(time.time())
# check spielbeginn/aktuelle zeit
if int(spielbeginn_unixzeit) > int(aktuelle_unixzeit):
tore = "%s.%s. %s:%s" % (days,month_to_int(month),std,min)
# fix umlaute - unix_to_unicode
match = unix_to_unicode(match)
if config.plugins.sport1ticker.ansicht.value == "nebeneinander":
# ansicht nebeneinander
if int(count) == 1:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(20, 0), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(320, 0), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(20, 0), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(320, 0), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(20, 0), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(320, 0), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 2:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(410, 0), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(720, 0), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(410, 0), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(720, 0), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(410, 0), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(720, 0), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 3:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(810, 0), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(1120, 0), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(810, 0), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(1120, 0), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(810, 0), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(1120, 0), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 4:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(20, 20), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(320, 20), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(20, 20), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(320, 20), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(20, 20), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(320, 20), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 5:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(410, 20), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(720, 20), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(410, 20), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(720, 20), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(410, 20), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(720, 20), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 6:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(810, 20), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(1120, 20), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(810, 20), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(1120, 20), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(810, 20), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(1120, 20), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 7:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(20, 40), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(320, 40), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(20, 40), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(320, 40), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(20, 40), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(320, 40), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 8:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(410, 40), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(720, 40), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(410, 40), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(720, 40), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(410, 40), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(720, 40), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 9:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(810, 40), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(1120, 40), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(810, 40), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(1120, 40), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(810, 40), size=(300, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(1120, 40), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
else:
# ansicht untereinander
if int(count) == 1:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(20, 0), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 0), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(20, 0), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 0), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(20, 0), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 0), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 2:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(20, 20), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 20), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(20, 20), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 20), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(20, 20), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 20), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 3:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(20, 40), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 40), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(20, 40), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 40), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(20, 40), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 40), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 4:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(20, 60), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 60), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(20, 60), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 60), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(20, 60), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 60), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 5:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(20, 80), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 80), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(20, 80), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 80), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(20, 80), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 80), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 6:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(20, 100), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 100), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(20, 100), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 100), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(20, 100), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 100), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 7:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(20, 120), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 120), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(20, 120), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 120), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(20, 120), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 120), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 8:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(20, 140), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 140), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(20, 140), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 140), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(20, 140), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 140), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif int(count) == 9:
if not tor and status == "false":
res.append(MultiContentEntryText(pos=(20, 160), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 160), size=(90, 20), font=2, text=tore, color=self.tor_farbe, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif not tor and status == "true":
res.append(MultiContentEntryText(pos=(20, 160), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 160), size=(90, 20), font=2, text=tore, color=self.live_spiel, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
elif tor:
res.append(MultiContentEntryText(pos=(20, 160), size=(350, 20), font=2, text=match, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
res.append(MultiContentEntryText(pos=(370, 160), size=(90, 20), font=2, text=tore, color=self.tor_farbe_neu, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER))
self.check_show()
return res
def check_show(self):
if self.show_tor:
print "[Sport1]: show ticker."
if not self.shown:
if config.plugins.sport1ticker.hideTimerOnOff.value:
self.hideTimer.start(self.hideTimer_interval)
self.show()
else:
if config.plugins.sport1ticker.hideTimerOnOff.value:
self.hideTimer.stop()
self.hideTimer.start(self.hideTimer_interval)
else:
pass
def ok(self):
if not self.shown:
print "[Sport1]: show ticker."
if config.plugins.sport1ticker.hideTimerOnOff.value:
self.hideTimer.start(self.hideTimer_interval)
self.show()
else:
print "[Sport1]: hide ticker."
if config.plugins.sport1ticker.hideTimerOnOff.value:
self.hideTimer.stop()
self.hide()
def up(self):
self.servicelist = self.session.instantiateDialog(ChannelSelection)
self.servicelist.moveUp()
self.session.execDialog(self.servicelist)
def down(self):
self.servicelist = self.session.instantiateDialog(ChannelSelection)
self.servicelist.moveDown()
self.session.execDialog(self.servicelist)
def tabelle(self):
if self.select_liga == "bl" or self.select_liga == "bl2":
self.session.open(Sport1Tabelle, self.select_liga, self.gameday)
else:
message = self.session.open(MessageBox, _("Keine Tabelle verfuegbar."), MessageBox.TYPE_INFO, timeout=5)
def configScreen(self):
self.session.openWithCallback(self.configClose,sport1Setup)
def configClose(self, result):
if result:
self.reloadgui = True
self.close(self.session, False)
def __onClose(self):
print "[Sport1]: stop timer."
self.updateTimer.stop()
if config.plugins.sport1ticker.hideTimerOnOff.value and self.reloadgui:
self.hideTimer.stop()
def exit(self):
self.close(self.session, True)
def unix_to_unicode(text):
special = {"\xc4": "Ae", "\xe4": "ae", "\xd6" : "Oe", "\xf6" : "oe", "\xdc" :"Ue", "\xfc" : "ue", "\xdf" : "ss"}
for key in special.keys():
text = text.replace(key, special[key])
return text
def month_to_int(text):
special = {"Jan": "1", "Feb": "2", "Mar" : "3", "Apr" : "4", "May" :"5", "Jun" : "6", "Jul" : "7", "Aug" : "8", "Sep" : "9", "Oct" : "10", "Nov" : "11", "Dec" : "12"}
for key in special.keys():
text = text.replace(key, special[key])
return int(text)
def main(session, **kwargs):
session.openWithCallback(check_close,sport1Ticker)
def check_close(session, result):
if not result:
print "[Sport1]: screen reload.."
session.openWithCallback(check_close,sport1Ticker)
def Plugins(**kwargs):
return [
PluginDescriptor(name="Sport1 Ticker", description="Sport1 Live Ticker", where = [PluginDescriptor.WHERE_EXTENSIONSMENU], fnc=main),
PluginDescriptor(name="Sport1 Ticker", description="Sport1 Live Ticker", where = [PluginDescriptor.WHERE_PLUGINMENU], fnc=main, icon="plugin.png")
]