| 1 |
|
|---|
| 2 |
|
|---|
| 3 | #######################################
|
|---|
| 4 | # Cool TV Guide by Coolman #
|
|---|
| 5 | # EPG-Plugin for Enigma2 #
|
|---|
| 6 | # Coded by Coolman (c) 2010 #
|
|---|
| 7 | # #
|
|---|
| 8 | # Version: V2.1.2 #
|
|---|
| 9 | #######################################
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 | # -*- coding: utf-8 -*-
|
|---|
| 13 | from skin import parseColor
|
|---|
| 14 | from os import environ as os_environ
|
|---|
| 15 | from Components.config import config, ConfigClock, ConfigSubsection, ConfigYesNo, ConfigSubList, ConfigDateTime, ConfigInteger, ConfigSelection, ConfigText, ConfigEnableDisable, KEY_LEFT, KEY_RIGHT, KEY_0, getConfigListEntry, ConfigNumber, ConfigSequence, ConfigBoolean
|
|---|
| 16 | from Components.Pixmap import Pixmap
|
|---|
| 17 | from Components.Button import Button
|
|---|
| 18 | from Components.ActionMap import ActionMap, NumberActionMap, HelpableActionMap
|
|---|
| 19 | from Components.AVSwitch import AVSwitch
|
|---|
| 20 | from Components.HTMLComponent import HTMLComponent
|
|---|
| 21 | from Components.GUIComponent import GUIComponent
|
|---|
| 22 | from Components.EpgList import Rect, EPGList
|
|---|
| 23 | from Components.Sources.Event import Event
|
|---|
| 24 | from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
|
|---|
| 25 | from Components.SystemInfo import SystemInfo
|
|---|
| 26 | from Components.TimerList import TimerList
|
|---|
| 27 | from Components.ConfigList import ConfigList, ConfigListScreen
|
|---|
| 28 | from Components.MenuList import MenuList
|
|---|
| 29 | from Components.UsageConfig import defaultMoviePath
|
|---|
| 30 | from Components.Label import Label
|
|---|
| 31 | from Components.Language import language
|
|---|
| 32 | from Screens.Console import Console
|
|---|
| 33 | from Plugins.Plugin import PluginDescriptor
|
|---|
| 34 | from Screens.ChoiceBox import ChoiceBox
|
|---|
| 35 | from Screens.Screen import Screen
|
|---|
| 36 | from Screens.EventView import EventViewSimple, EventViewBase
|
|---|
| 37 | from Screens.TimeDateInput import TimeDateInput
|
|---|
| 38 | from Screens.TimerEntry import TimerEntry
|
|---|
| 39 | from Screens.EpgSelection import EPGSelection
|
|---|
| 40 | from Screens.TimerEdit import TimerSanityConflict
|
|---|
| 41 | from Screens.LocationBox import MovieLocationBox
|
|---|
| 42 | from Screens.MessageBox import MessageBox
|
|---|
| 43 | from Screens.MovieSelection import getPreferredTagEditor
|
|---|
| 44 | from Screens.ChannelSelection import BouquetSelector
|
|---|
| 45 | from Tools.Directories import resolveFilename, fileExists, SCOPE_CURRENT_SKIN, SCOPE_PLUGINS, SCOPE_LANGUAGE
|
|---|
| 46 | from RecordTimer import RecordTimerEntry, parseEvent, AFTEREVENT
|
|---|
| 47 | from ServiceReference import ServiceReference
|
|---|
| 48 | from Tools.LoadPixmap import LoadPixmap
|
|---|
| 49 | from enigma import eEPGCache, eListbox, gFont, eListboxPythonMultiContent, RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_VALIGN_TOP, RT_WRAP, eRect, ePicLoad, getDesktop, eTimer, eServiceCenter, eServiceReference
|
|---|
| 50 | from time import localtime, time, strftime, mktime
|
|---|
| 51 | from Tools.Directories import *
|
|---|
| 52 | from datetime import datetime
|
|---|
| 53 | import gettext
|
|---|
| 54 |
|
|---|
| 55 | try:
|
|---|
| 56 | from Plugins.Extensions.IMDb.plugin import IMDB, IMDBEPGSelection
|
|---|
| 57 | except ImportError:
|
|---|
| 58 | IMDB = None
|
|---|
| 59 |
|
|---|
| 60 | Session = None
|
|---|
| 61 | Servicelist = None
|
|---|
| 62 | cool_bouquets = [ ]
|
|---|
| 63 | man_bouquets = None
|
|---|
| 64 | bouquetSel = None
|
|---|
| 65 | epg_bouquet = None
|
|---|
| 66 | dlg_stack = [ ]
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 | def localeInit():
|
|---|
| 70 | lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
|
|---|
| 71 | os_environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
|
|---|
| 72 | gettext.bindtextdomain("CoolTVGuide", resolveFilename(SCOPE_PLUGINS, "Extensions/CoolTVGuide/locale"))
|
|---|
| 73 |
|
|---|
| 74 | def _(txt):
|
|---|
| 75 | t = gettext.dgettext("CoolTVGuide", txt)
|
|---|
| 76 | if t == txt:
|
|---|
| 77 | print "[CoolTVGuide] fallback to default translation for", txt
|
|---|
| 78 | t = gettext.gettext(txt)
|
|---|
| 79 | return t
|
|---|
| 80 |
|
|---|
| 81 | localeInit()
|
|---|
| 82 | language.addCallback(localeInit)
|
|---|
| 83 |
|
|---|
| 84 | #################################################################################
|
|---|
| 85 | config.misc.Cool_TV_Guide=ConfigSubsection()
|
|---|
| 86 | config.misc.Cool_TV_Guide.Cool_Red = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit")), ("Search", _("Search")), ("IMDb Search", _("IMDb Search")), ("CoolSwitch", _("CoolSwitch")), ("Channel Info", _("Channel Info")), ("Timer", _("Timer")), ("QuickRec", _("QuickRec")), ("AutoTimer", _("AutoTimer")), ("Primetime", _("Primetime")), ("Bouquet +", _("Bouquet +")), ("Bouquet -", _("Bouquet -")), ("Bouquetlist", _("Bouquetlist")), ("...", _("..."))], default = "Zap")
|
|---|
| 87 | config.misc.Cool_TV_Guide.Cool_RedLong = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit")), ("Search", _("Search")), ("IMDb Search", _("IMDb Search")), ("CoolSwitch", _("CoolSwitch")), ("Channel Info", _("Channel Info")), ("Timer", _("Timer")), ("QuickRec", _("QuickRec")), ("AutoTimer", _("AutoTimer")), ("Primetime", _("Primetime")), ("Bouquet +", _("Bouquet +")), ("Bouquet -", _("Bouquet -")), ("Bouquetlist", _("Bouquetlist")), ("...", _("..."))], default = "Zap + Exit")
|
|---|
| 88 | config.misc.Cool_TV_Guide.Cool_Green = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit")), ("Search", _("Search")), ("IMDb Search", _("IMDb Search")), ("CoolSwitch", _("CoolSwitch")), ("Channel Info", _("Channel Info")), ("Timer", _("Timer")), ("QuickRec", _("QuickRec")), ("AutoTimer", _("AutoTimer")), ("Primetime", _("Primetime")), ("Bouquet +", _("Bouquet +")), ("Bouquet -", _("Bouquet -")), ("Bouquetlist", _("Bouquetlist")), ("...", _("..."))], default = "Timer")
|
|---|
| 89 | config.misc.Cool_TV_Guide.Cool_GreenLong = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit")), ("Search", _("Search")), ("IMDb Search", _("IMDb Search")), ("CoolSwitch", _("CoolSwitch")), ("Channel Info", _("Channel Info")), ("Timer", _("Timer")), ("QuickRec", _("QuickRec")), ("AutoTimer", _("AutoTimer")), ("Primetime", _("Primetime")), ("Bouquet +", _("Bouquet +")), ("Bouquet -", _("Bouquet -")), ("Bouquetlist", _("Bouquetlist")), ("...", _("..."))], default = "AutoTimer")
|
|---|
| 90 | config.misc.Cool_TV_Guide.Cool_Yellow = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit")), ("Search", _("Search")), ("IMDb Search", _("IMDb Search")), ("CoolSwitch", _("CoolSwitch")), ("Channel Info", _("Channel Info")), ("Timer", _("Timer")), ("QuickRec", _("QuickRec")), ("AutoTimer", _("AutoTimer")), ("Primetime", _("Primetime")), ("Bouquet +", _("Bouquet +")), ("Bouquet -", _("Bouquet -")), ("Bouquetlist", _("Bouquetlist")), ("...", _("..."))], default = "CoolSwitch")
|
|---|
| 91 | config.misc.Cool_TV_Guide.Cool_YellowLong = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit")), ("Search", _("Search")), ("IMDb Search", _("IMDb Search")), ("CoolSwitch", _("CoolSwitch")), ("Channel Info", _("Channel Info")), ("Timer", _("Timer")), ("QuickRec", _("QuickRec")), ("AutoTimer", _("AutoTimer")), ("Primetime", _("Primetime")), ("Bouquet +", _("Bouquet +")), ("Bouquet -", _("Bouquet -")), ("Bouquetlist", _("Bouquetlist")), ("...", _("..."))], default = "Bouquetlist")
|
|---|
| 92 | config.misc.Cool_TV_Guide.Cool_Blue = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit")), ("Search", _("Search")), ("IMDb Search", _("IMDb Search")), ("CoolSwitch", _("CoolSwitch")), ("Channel Info", _("Channel Info")), ("Timer", _("Timer")), ("QuickRec", _("QuickRec")), ("AutoTimer", _("AutoTimer")), ("Primetime", _("Primetime")), ("Bouquet +", _("Bouquet +")), ("Bouquet -", _("Bouquet -")), ("Bouquetlist", _("Bouquetlist")), ("...", _("..."))], default = "Search")
|
|---|
| 93 | config.misc.Cool_TV_Guide.Cool_BlueLong = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit")), ("Search", _("Search")), ("IMDb Search", _("IMDb Search")), ("CoolSwitch", _("CoolSwitch")), ("Channel Info", _("Channel Info")), ("Timer", _("Timer")), ("QuickRec", _("QuickRec")), ("AutoTimer", _("AutoTimer")), ("Primetime", _("Primetime")), ("Bouquet +", _("Bouquet +")), ("Bouquet -", _("Bouquet -")), ("Bouquetlist", _("Bouquetlist")), ("...", _("..."))], default = "IMDb Search")
|
|---|
| 94 | config.misc.Cool_TV_Guide.Cool_OK = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit")), ("Search", _("Search")), ("IMDb Search", _("IMDb Search")), ("CoolSwitch", _("CoolSwitch")), ("Channel Info", _("Channel Info")), ("Timer", _("Timer")), ("QuickRec", _("QuickRec")), ("AutoTimer", _("AutoTimer")), ("Primetime", _("Primetime")), ("Bouquet +", _("Bouquet +")), ("Bouquet -", _("Bouquet -")), ("Bouquetlist", _("Bouquetlist")), ("...", _("..."))], default = "Channel Info")
|
|---|
| 95 | config.misc.Cool_TV_Guide.Cool_OKLong = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit")), ("Search", _("Search")), ("IMDb Search", _("IMDb Search")), ("CoolSwitch", _("CoolSwitch")), ("Channel Info", _("Channel Info")), ("Timer", _("Timer")), ("QuickRec", _("QuickRec")), ("AutoTimer", _("AutoTimer")), ("Primetime", _("Primetime")), ("Bouquet +", _("Bouquet +")), ("Bouquet -", _("Bouquet -")), ("Bouquetlist", _("Bouquetlist")), ("...", _("..."))], default = "...")
|
|---|
| 96 | config.misc.Cool_TV_Guide.Cool_Info = ConfigSelection(choices = [("Cool Single Guide", _("Cool Single Guide")), ("Cool TV<>Multi Guide", _("Cool TV<>Multi Guide")), ("Channel Info", _("Channel Info")), ("View Single EPG", _("View Single EPG")), ("...", _("..."))], default = "Cool Single Guide")
|
|---|
| 97 | config.misc.Cool_TV_Guide.Cool_InfoLong = ConfigSelection(choices = [("Cool Single Guide", _("Cool Single Guide")), ("Cool TV<>Multi Guide", _("Cool TV<>Multi Guide")), ("Channel Info", _("Channel Info")), ("View Single EPG", _("View Single EPG")), ("...", _("..."))], default = "Cool TV<>Multi Guide")
|
|---|
| 98 | config.misc.Cool_TV_Guide.cool_BlankLine = ConfigSelection(default=" ", choices = [(" ", _(" "))])
|
|---|
| 99 |
|
|---|
| 100 | config.misc.Cool_TV_Guide.prev_time=ConfigClock(default = time())
|
|---|
| 101 |
|
|---|
| 102 | config.misc.Cool_TV_Guide.Cool3D = ConfigSelection(choices = [("No", _("No")), ("Standard", _("Standard")), ("SkinDesign", _("SkinDesign")), ("MyDesign", _("MyDesign"))], default = "No")
|
|---|
| 103 | config.misc.Cool_TV_Guide.CoolPrimetime1 = ConfigInteger(default=20, limits=(0, 23))
|
|---|
| 104 | config.misc.Cool_TV_Guide.CoolPrimetime2 = ConfigInteger(default=0, limits=(0, 59))
|
|---|
| 105 | config.misc.Cool_TV_Guide.autostart_bouquet = ConfigSelection(choices = [("No", _("No")), ("Yes", _("Yes"))], default = "No")
|
|---|
| 106 | config.misc.Cool_TV_Guide.CoolPiconON = ConfigSelection(choices = [("No", _("No")), ("Yes", _("Yes"))], default = "Yes")
|
|---|
| 107 | config.misc.Cool_TV_Guide.CoolPiconPath = ConfigSelection(choices = [("Picon", _("Picon")), ("CoolPicon", _("CoolPicon"))], default = "Picon")
|
|---|
| 108 | config.misc.Cool_TV_Guide.CoolPicoON = ConfigSelection(choices = [("No", _("No")), ("Yes", _("Yes"))], default = "Yes")
|
|---|
| 109 | config.misc.Cool_TV_Guide.CoolPicoPath = ConfigSelection(choices = [("Picon", _("Picon")), ("CoolPicon", _("CoolPicon"))], default = "Picon")
|
|---|
| 110 | config.misc.Cool_TV_Guide.channel1 = ConfigSelection(choices = [("No", _("No")), ("Yes", _("Yes"))], default = "No")
|
|---|
| 111 | config.misc.Cool_TV_Guide.coolswitch = ConfigSelection(choices = [("60", _("60")), ("30", _("30"))], default = "60")
|
|---|
| 112 | config.misc.Cool_TV_Guide.prev_time_period=ConfigInteger(default=180, limits=(60,300))
|
|---|
| 113 | config.misc.Cool_TV_Guide.Cool_Fontsize = ConfigInteger(default=18, limits=(10, 30))
|
|---|
| 114 | config.misc.Cool_TV_Guide.Cool_Left_Fontsize = ConfigInteger(default=22, limits=(10, 30))
|
|---|
| 115 | config.misc.Cool_TV_Guide.Cool_Timeline = ConfigInteger(default=20, limits=(10, 30))
|
|---|
| 116 | config.misc.Cool_TV_Guide.PiconHeight = ConfigInteger(default=60, limits=(40, 80))
|
|---|
| 117 | config.misc.Cool_TV_Guide.PiconItemHeight = ConfigInteger(default=60, limits=(40, 80))
|
|---|
| 118 | config.misc.Cool_TV_Guide.CoolPicoHeight = ConfigInteger(default=30, limits=(10, 60))
|
|---|
| 119 | config.misc.Cool_TV_Guide.CoolPicoItemHeight = ConfigInteger(default=30, limits=(10, 60))
|
|---|
| 120 | config.misc.Cool_TV_Guide.cool_left8 = ConfigInteger(default=110, limits=(50, 250))
|
|---|
| 121 | config.misc.Cool_TV_Guide.cool_left16 = ConfigInteger(default=190, limits=(10, 250))
|
|---|
| 122 | config.misc.Cool_TV_Guide.overjump = ConfigBoolean(default=False)
|
|---|
| 123 |
|
|---|
| 124 | config.misc.Cool_TV_Guide.CoolMultiSwitch = ConfigSelection(choices = [("No", _("No")), ("Yes", _("Yes"))], default = "No")
|
|---|
| 125 | #################################################################################
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 | class CoolSingleGuide(EPGSelection):
|
|---|
| 129 | def __init__(self, session, service, zapFunc=None, bouquetChangeCB=None, serviceChangeCB=None):
|
|---|
| 130 | EPGSelection.__init__(self, session, service, zapFunc, bouquetChangeCB, serviceChangeCB)
|
|---|
| 131 | skinpath = str(resolveFilename)
|
|---|
| 132 | CoolWide = getDesktop(0).size().width()
|
|---|
| 133 | if CoolWide == 720:
|
|---|
| 134 | skin = "/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSkin/CoolSingleGuide_720.xml"
|
|---|
| 135 | elif CoolWide == 1024:
|
|---|
| 136 | skin = "/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSkin/CoolSingleGuide_1024.xml"
|
|---|
| 137 | else:
|
|---|
| 138 | skin = "/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSkin/CoolSingleGuide_1280.xml"
|
|---|
| 139 |
|
|---|
| 140 | Cool = open(skin)
|
|---|
| 141 | self.skin = Cool.read()
|
|---|
| 142 | Cool.close()
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 | class SingleEPG(EPGSelection):
|
|---|
| 146 | def __init__(self, session, service, zapFunc=None, bouquetChangeCB=None, serviceChangeCB=None):
|
|---|
| 147 | EPGSelection.__init__(self, session, service, zapFunc, bouquetChangeCB, serviceChangeCB)
|
|---|
| 148 | self.skinName = "EPGSelection"
|
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 | class CoolViewSimple(Screen, EventViewBase):
|
|---|
| 152 | def __init__(self, session, Event, Ref, callback=None, similarEPGCB=None):
|
|---|
| 153 | Screen.__init__(self, session)
|
|---|
| 154 | self.skinName = "EventView"
|
|---|
| 155 | EventViewBase.__init__(self, Event, Ref, callback, similarEPGCB)
|
|---|
| 156 |
|
|---|
| 157 | self["key_blue"].setText(_("Search"))
|
|---|
| 158 | self["Coolman"] = HelpableActionMap(self, "CoolTVGuideActions",
|
|---|
| 159 | {
|
|---|
| 160 | "CoolBlue": (self.CoolSearch, _("show your Setup")),
|
|---|
| 161 | })
|
|---|
| 162 |
|
|---|
| 163 | def CoolSearch(self):
|
|---|
| 164 | try:
|
|---|
| 165 | from Plugins.Extensions.EPGSearch.EPGSearch import EPGSearch
|
|---|
| 166 | except ImportError:
|
|---|
| 167 | EPGSearch = None
|
|---|
| 168 | try:
|
|---|
| 169 | cur = CoolList.getCurrent()
|
|---|
| 170 | event = cur[0]
|
|---|
| 171 | name = event.getEventName()
|
|---|
| 172 | except:
|
|---|
| 173 | name = ''
|
|---|
| 174 | if EPGSearch is not None:
|
|---|
| 175 | self.session.open(EPGSearch, name , False)
|
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 | class CoolEPGList(EPGList):
|
|---|
| 179 | searchCoolPicon = 1
|
|---|
| 180 | searchCoolPico = 1
|
|---|
| 181 | if config.misc.Cool_TV_Guide.CoolPiconPath.value == "CoolPicon":
|
|---|
| 182 | searchCoolPicon = 2
|
|---|
| 183 | if config.misc.Cool_TV_Guide.CoolPicoPath.value == "CoolPicon":
|
|---|
| 184 | searchCoolPico = 2
|
|---|
| 185 |
|
|---|
| 186 | if searchCoolPicon == 1:
|
|---|
| 187 | searchCoolPiconPaths = ['/usr/share/enigma2/picon/',
|
|---|
| 188 | '/etc/picon/',
|
|---|
| 189 | '/media/cf/picon/',
|
|---|
| 190 | '/var/etc/picon/',
|
|---|
| 191 | '/media/usb/picon/']
|
|---|
| 192 |
|
|---|
| 193 | if searchCoolPico == 1:
|
|---|
| 194 | searchCoolPicoPaths = ['/usr/share/enigma2/picon/coolpico/',
|
|---|
| 195 | '/etc/picon/coolpico/',
|
|---|
| 196 | '/media/cf/picon/coolpico/',
|
|---|
| 197 | '/var/etc/picon/coolpico/',
|
|---|
| 198 | '/media/usb/picon/coolpico/']
|
|---|
| 199 |
|
|---|
| 200 | if searchCoolPicon == 2:
|
|---|
| 201 | searchCoolPiconPaths = ['/usr/share/enigma2/coolpicon/',
|
|---|
| 202 | '/etc/coolpicon/',
|
|---|
| 203 | '/media/cf/coolpicon/',
|
|---|
| 204 | '/var/etc/coolpicon/',
|
|---|
| 205 | '/media/usb/coolpicon/']
|
|---|
| 206 |
|
|---|
| 207 | if searchCoolPico == 2:
|
|---|
| 208 | searchCoolPicoPaths = ['/usr/share/enigma2/coolpicon/coolpico/',
|
|---|
| 209 | '/etc/coolpicon/coolpico/',
|
|---|
| 210 | '/media/cf/coolpicon/coolpico/',
|
|---|
| 211 | '/var/etc/coolpicon/coolpico/',
|
|---|
| 212 | '/media/usb/coolpicon/coolpico/']
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 | def __init__(self, selChangedCB=None, timer = None, time_epoch = 120, overjump_empty=False):
|
|---|
| 216 | self.cur_event = None
|
|---|
| 217 | self.cur_service = None
|
|---|
| 218 | self.offs = 0
|
|---|
| 219 | self.timer = timer
|
|---|
| 220 | self.onSelChanged = [ ]
|
|---|
| 221 | self.type = CoolEPGList
|
|---|
| 222 |
|
|---|
| 223 | if selChangedCB is not None:
|
|---|
| 224 | self.onSelChanged.append(selChangedCB)
|
|---|
| 225 | GUIComponent.__init__(self)
|
|---|
| 226 | self.l = eListboxPythonMultiContent()
|
|---|
| 227 | self.curr_refcool = None
|
|---|
| 228 | self.coolheight = 40
|
|---|
| 229 | self.l.setBuildFunc(self.buildEntry)
|
|---|
| 230 | self.setOverjump_Empty(overjump_empty)
|
|---|
| 231 | self.epgcache = eEPGCache.getInstance()
|
|---|
| 232 |
|
|---|
| 233 |
|
|---|
| 234 | self.SDCoolNow = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/SkinDesign/CoolNow.png')
|
|---|
| 235 | self.SDCoolBack = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/SkinDesign/CoolBack.png')
|
|---|
| 236 | self.SDCoolSelect = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/SkinDesign/CoolSelect.png')
|
|---|
| 237 | self.SDCoolRec = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/SkinDesign/CoolRec.png')
|
|---|
| 238 | self.SDCoolNowS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/SkinDesign/CoolNowS.png')
|
|---|
| 239 | self.SDCoolBackS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/SkinDesign/CoolBackS.png')
|
|---|
| 240 | self.SDCoolSelectS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/SkinDesign/CoolSelectS.png')
|
|---|
| 241 | self.SDCoolRecS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/SkinDesign/CoolRecS.png')
|
|---|
| 242 | self.SDCoolPicons = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/SkinDesign/CoolPicon.png')
|
|---|
| 243 | self.SDCoolPiconsSelect = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/SkinDesign/CoolPiconSelect.png')
|
|---|
| 244 | self.SDCoolPiconsS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/SkinDesign/CoolPiconS.png')
|
|---|
| 245 | self.SDCoolPiconsSelectS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/SkinDesign/CoolPiconSelectS.png')
|
|---|
| 246 |
|
|---|
| 247 | self.MDCoolNow = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/MyDesign/CoolNow.png')
|
|---|
| 248 | self.MDCoolBack = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/MyDesign/CoolBack.png')
|
|---|
| 249 | self.MDCoolSelect = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/MyDesign/CoolSelect.png')
|
|---|
| 250 | self.MDCoolRec = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/MyDesign/CoolRec.png')
|
|---|
| 251 | self.MDCoolNowS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/MyDesign/CoolNowS.png')
|
|---|
| 252 | self.MDCoolBackS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/MyDesign/CoolBackS.png')
|
|---|
| 253 | self.MDCoolSelectS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/MyDesign/CoolSelectS.png')
|
|---|
| 254 | self.MDCoolRecS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/MyDesign/CoolRecS.png')
|
|---|
| 255 | self.MDCoolPicons = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/MyDesign/CoolPicon.png')
|
|---|
| 256 | self.MDCoolPiconsSelect = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/MyDesign/CoolPiconSelect.png')
|
|---|
| 257 | self.MDCoolPiconsS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/MyDesign/CoolPiconS.png')
|
|---|
| 258 | self.MDCoolPiconsSelectS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/MyDesign/CoolPiconSelectS.png')
|
|---|
| 259 |
|
|---|
| 260 | self.CoolNow = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/Standard/CoolNow.png')
|
|---|
| 261 | self.CoolBack = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/Standard/CoolBack.png')
|
|---|
| 262 | self.CoolSelect = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/Standard/CoolSelect.png')
|
|---|
| 263 | self.CoolRec = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/Standard/CoolRec.png')
|
|---|
| 264 | self.CoolNowS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/Standard/CoolNowS.png')
|
|---|
| 265 | self.CoolBackS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/Standard/CoolBackS.png')
|
|---|
| 266 | self.CoolSelectS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/Standard/CoolSelectS.png')
|
|---|
| 267 | self.CoolRecS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/Standard/CoolRecS.png')
|
|---|
| 268 | self.CoolPicons = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/Standard/CoolPicon.png')
|
|---|
| 269 | self.CoolPiconsSelect = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/Standard/CoolPiconSelect.png')
|
|---|
| 270 | self.CoolPiconsS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/Standard/CoolPiconS.png')
|
|---|
| 271 | self.CoolPiconsSelectS = LoadPixmap(cached=True, path='/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/Cool3D/Standard/CoolPiconSelectS.png')
|
|---|
| 272 |
|
|---|
| 273 | self.time_base = None
|
|---|
| 274 | self.time_epoch = time_epoch
|
|---|
| 275 | self.list = None
|
|---|
| 276 | self.event_rect = None
|
|---|
| 277 | self.nowForeColor = 0xffffff
|
|---|
| 278 | self.nowForeColorSelected = 0x000000
|
|---|
| 279 | self.foreColor = 0xffffff
|
|---|
| 280 | self.foreColorSelected = 0x000000
|
|---|
| 281 | self.borderColor = 0xC0C0C0
|
|---|
| 282 | self.backColor = 0x2D455E
|
|---|
| 283 | self.backColorSelected = 0xC0C0C0
|
|---|
| 284 | self.nowBackColor = 0x00825F
|
|---|
| 285 | self.nowBackColorSelected = 0x4800FF
|
|---|
| 286 | self.foreColorService = 0xffffff
|
|---|
| 287 | self.backColorService = 0x000000
|
|---|
| 288 |
|
|---|
| 289 | def applySkin(self, desktop, screen):
|
|---|
| 290 | if self.skinAttributes is not None:
|
|---|
| 291 | attribs = [ ]
|
|---|
| 292 | for (attrib, value) in self.skinAttributes:
|
|---|
| 293 | if attrib == "EntryForegroundColor":
|
|---|
| 294 | self.foreColor = parseColor(value).argb()
|
|---|
| 295 | elif attrib == "EntryForegroundColorSelected":
|
|---|
| 296 | self.foreColorSelected = parseColor(value).argb()
|
|---|
| 297 | elif attrib == "EntryNowForegroundColorSelected":
|
|---|
| 298 | self.nowForeColorSelected = parseColor(value).argb()
|
|---|
| 299 | elif attrib == "EntryNowForegroundColor":
|
|---|
| 300 | self.nowForeColor = parseColor(value).argb()
|
|---|
| 301 | elif attrib == "EntryBorderColor":
|
|---|
| 302 | self.borderColor = parseColor(value).argb()
|
|---|
| 303 | elif attrib == "EntryBackgroundColor":
|
|---|
| 304 | self.backColor = parseColor(value).argb()
|
|---|
| 305 | elif attrib == "EntryNowBackgroundColor":
|
|---|
| 306 | self.nowBackColor = parseColor(value).argb()
|
|---|
| 307 | elif attrib == "EntryBackgroundColorSelected":
|
|---|
| 308 | self.backColorSelected = parseColor(value).argb()
|
|---|
| 309 | elif attrib == "EntryNowBackgroundColorSelected":
|
|---|
| 310 | self.nowBackColorSelected = parseColor(value).argb()
|
|---|
| 311 | elif attrib == "ServiceNameForegroundColor":
|
|---|
| 312 | self.foreColorService = parseColor(value).argb()
|
|---|
| 313 | elif attrib == "ServiceNameBackgroundColor":
|
|---|
| 314 | self.backColorService = parseColor(value).argb()
|
|---|
| 315 | else:
|
|---|
| 316 | attribs.append((attrib,value))
|
|---|
| 317 | self.skinAttributes = attribs
|
|---|
| 318 | rc = GUIComponent.applySkin(self, desktop, screen)
|
|---|
| 319 | self.setItemsPerPage()
|
|---|
| 320 | return rc
|
|---|
| 321 |
|
|---|
| 322 | def isSelectable(self, service, sname, event_list):
|
|---|
| 323 | return (event_list and len(event_list) and True) or False
|
|---|
| 324 |
|
|---|
| 325 | def setOverjump_Empty(self, overjump_empty):
|
|---|
| 326 | if overjump_empty:
|
|---|
| 327 | self.l.setSelectableFunc(self.isSelectable)
|
|---|
| 328 |
|
|---|
| 329 | def setEpoch(self, epoch):
|
|---|
| 330 | self.offs = 0
|
|---|
| 331 | self.time_epoch = epoch
|
|---|
| 332 | self.fillCoolTVGuide(None)
|
|---|
| 333 |
|
|---|
| 334 | def setEpoch2(self, epoch):
|
|---|
| 335 | self.offs = 0
|
|---|
| 336 | self.time_epoch = epoch
|
|---|
| 337 |
|
|---|
| 338 | def getEventFromId(self, service, eventid):
|
|---|
| 339 | event = None
|
|---|
| 340 | if self.epgcache is not None and eventid is not None:
|
|---|
| 341 | event = self.epgcache.lookupEventId(service.ref, eventid)
|
|---|
| 342 | return event
|
|---|
| 343 |
|
|---|
| 344 | def moveToService(self,serviceref):
|
|---|
| 345 | if serviceref is not None:
|
|---|
| 346 | for x in range(len(self.list)):
|
|---|
| 347 | if self.list[x][0] == serviceref.toString():
|
|---|
| 348 | self.instance.moveSelectionTo(x)
|
|---|
| 349 | break
|
|---|
| 350 |
|
|---|
| 351 | def getIndexFromService(self, serviceref):
|
|---|
| 352 | if serviceref is not None:
|
|---|
| 353 | for x in range(len(self.list)):
|
|---|
| 354 | if self.list[x][0] == serviceref.toString():
|
|---|
| 355 | return x
|
|---|
| 356 |
|
|---|
| 357 | def setCurrentIndex(self, index):
|
|---|
| 358 | if self.instance is not None:
|
|---|
| 359 | self.instance.moveSelectionTo(index)
|
|---|
| 360 |
|
|---|
| 361 | def getCurrent(self):
|
|---|
| 362 | if self.cur_service is None:
|
|---|
| 363 | return ( None, None )
|
|---|
| 364 | old_service = self.cur_service #(service, service_name, events)
|
|---|
| 365 | events = self.cur_service[2]
|
|---|
| 366 | refstr = self.cur_service[0]
|
|---|
| 367 | if self.cur_event is None or not events or not len(events):
|
|---|
| 368 | return ( None, ServiceReference(refstr) )
|
|---|
| 369 | event = events[self.cur_event] #(event_id, event_title, begin_time, duration)
|
|---|
| 370 | eventid = event[0]
|
|---|
| 371 | service = ServiceReference(refstr)
|
|---|
| 372 | event = self.getEventFromId(service, eventid)
|
|---|
| 373 | return ( event, service )
|
|---|
| 374 |
|
|---|
| 375 | def connectSelectionChanged(func):
|
|---|
| 376 | if not self.onSelChanged.count(func):
|
|---|
| 377 | self.onSelChanged.append(func)
|
|---|
| 378 |
|
|---|
| 379 | def disconnectSelectionChanged(func):
|
|---|
| 380 | self.onSelChanged.remove(func)
|
|---|
| 381 |
|
|---|
| 382 | def serviceChanged(self):
|
|---|
| 383 | cur_sel = self.l.getCurrentSelection()
|
|---|
| 384 | if cur_sel:
|
|---|
| 385 | self.findBestEvent()
|
|---|
| 386 |
|
|---|
| 387 | def findBestEvent(self):
|
|---|
| 388 | old_service = self.cur_service #(service, service_name, events)
|
|---|
| 389 | cur_service = self.cur_service = self.l.getCurrentSelection()
|
|---|
| 390 | last_time = 0;
|
|---|
| 391 | time_base = self.getTimeBase()
|
|---|
| 392 | if old_service and self.cur_event is not None:
|
|---|
| 393 | events = old_service[2]
|
|---|
| 394 | cur_event = events[self.cur_event] #(event_id, event_title, begin_time, duration)
|
|---|
| 395 | last_time = cur_event[2]
|
|---|
| 396 | if last_time < time_base:
|
|---|
| 397 | last_time = time_base
|
|---|
| 398 | if cur_service:
|
|---|
| 399 | self.cur_event = 0
|
|---|
| 400 | events = cur_service[2]
|
|---|
| 401 | if events and len(events):
|
|---|
| 402 | if last_time:
|
|---|
| 403 | best_diff = 0
|
|---|
| 404 | best = len(events) #set invalid
|
|---|
| 405 | idx = 0
|
|---|
| 406 | for event in events: #iterate all events
|
|---|
| 407 | ev_time = event[2]
|
|---|
| 408 | if ev_time < time_base:
|
|---|
| 409 | ev_time = time_base
|
|---|
| 410 | diff = abs(ev_time-last_time)
|
|---|
| 411 | if (best == len(events)) or (diff < best_diff):
|
|---|
| 412 | best = idx
|
|---|
| 413 | best_diff = diff
|
|---|
| 414 | idx += 1
|
|---|
| 415 | if best != len(events):
|
|---|
| 416 | self.cur_event = best
|
|---|
| 417 | else:
|
|---|
| 418 | self.cur_event = None
|
|---|
| 419 | self.selEntry(0)
|
|---|
| 420 |
|
|---|
| 421 | def selectionChanged(self):
|
|---|
| 422 | for x in self.onSelChanged:
|
|---|
| 423 | if x is not None:
|
|---|
| 424 | x()
|
|---|
| 425 |
|
|---|
| 426 | GUI_WIDGET = eListbox
|
|---|
| 427 |
|
|---|
| 428 | def setItemsPerPage(self):
|
|---|
| 429 | global Cool16
|
|---|
| 430 | ItemHeight = None
|
|---|
| 431 | Cool16 = config.misc.Cool_TV_Guide.CoolPicoItemHeight.value
|
|---|
| 432 | if not config.misc.Cool_TV_Guide.coolswitch.value == "30":
|
|---|
| 433 | self.l.setItemHeight(config.misc.Cool_TV_Guide.PiconItemHeight.value)
|
|---|
| 434 | self.coolheight = config.misc.Cool_TV_Guide.PiconItemHeight.value
|
|---|
| 435 | if config.misc.Cool_TV_Guide.coolswitch.value == "30":
|
|---|
| 436 | self.coolheight = Cool16
|
|---|
| 437 | self.l.setItemHeight(Cool16)
|
|---|
| 438 |
|
|---|
| 439 | def setServiceFontsize(self):
|
|---|
| 440 | self.l.setFont(0, gFont("Regular", config.misc.Cool_TV_Guide.Cool_Left_Fontsize.value))
|
|---|
| 441 |
|
|---|
| 442 | def setEventFontsize(self):
|
|---|
| 443 | self.l.setFont(1, gFont("Regular", config.misc.Cool_TV_Guide.Cool_Fontsize.value))
|
|---|
| 444 |
|
|---|
| 445 | def postWidgetCreate(self, instance):
|
|---|
| 446 | instance.setWrapAround(True)
|
|---|
| 447 | instance.selectionChanged.get().append(self.serviceChanged)
|
|---|
| 448 | instance.setContent(self.l)
|
|---|
| 449 | self.l.setSelectionClip(eRect(0,0,0,0), False)
|
|---|
| 450 | self.setServiceFontsize()
|
|---|
| 451 | self.setEventFontsize()
|
|---|
| 452 |
|
|---|
| 453 | def preWidgetRemove(self, instance):
|
|---|
| 454 | instance.selectionChanged.get().remove(self.serviceChanged)
|
|---|
| 455 | instance.setContent(None)
|
|---|
| 456 |
|
|---|
| 457 | def recalcEntrySize(self):
|
|---|
| 458 | esize = self.l.getItemSize()
|
|---|
| 459 | width = esize.width()
|
|---|
| 460 | height = esize.height()
|
|---|
| 461 | xpos = 0;
|
|---|
| 462 | if self.coolheight >=40:
|
|---|
| 463 | global ItemHeight
|
|---|
| 464 | w = config.misc.Cool_TV_Guide.cool_left8.value;
|
|---|
| 465 | ItemHeight = height;
|
|---|
| 466 | if self.coolheight <40:
|
|---|
| 467 | w = config.misc.Cool_TV_Guide.cool_left16.value;
|
|---|
| 468 | self.service_rect = Rect(xpos, 0, w, height)
|
|---|
| 469 | xpos += w;
|
|---|
| 470 | w = width - xpos;
|
|---|
| 471 | self.event_rect = Rect(xpos, 0, w, height)
|
|---|
| 472 |
|
|---|
| 473 | def calcEntryPosAndWidthHelper(self, stime, duration, start, end, width):
|
|---|
| 474 | xpos = (stime - start) * width / (end - start)
|
|---|
| 475 | ewidth = (stime + duration - start) * width / (end - start) + 1
|
|---|
| 476 | ewidth -= xpos;
|
|---|
| 477 | if xpos < 0:
|
|---|
| 478 | ewidth += xpos;
|
|---|
| 479 | xpos = 0;
|
|---|
| 480 | if (xpos+ewidth) > width:
|
|---|
| 481 | ewidth = width - xpos
|
|---|
| 482 | return xpos, ewidth
|
|---|
| 483 |
|
|---|
| 484 | def calcEntryPosAndWidth(self, event_rect, time_base, time_epoch, ev_start, ev_duration):
|
|---|
| 485 | xpos, width = self.calcEntryPosAndWidthHelper(ev_start, ev_duration, time_base, time_base + time_epoch * 60, event_rect.width())
|
|---|
| 486 | return xpos+event_rect.left(), width
|
|---|
| 487 |
|
|---|
| 488 | def buildEntry(self, service, service_name, events):
|
|---|
| 489 | if service == self.cur_service[0]:
|
|---|
| 490 | piconbkcolor = 0x000000
|
|---|
| 491 | else:
|
|---|
| 492 | piconbkcolor = 0x000000
|
|---|
| 493 | r1=self.service_rect
|
|---|
| 494 | r2=self.event_rect
|
|---|
| 495 | foreColor = self.foreColor
|
|---|
| 496 | foreColorSelected = self.foreColorSelected
|
|---|
| 497 | backColor = self.backColor
|
|---|
| 498 | backColorSelected = self.backColorSelected
|
|---|
| 499 | borderColor = self.borderColor
|
|---|
| 500 | backColorService = self.backColorService
|
|---|
| 501 | backColorOrig = self.backColor # normale Eventsfarbe
|
|---|
| 502 | CoolEvent = 1
|
|---|
| 503 | if config.misc.Cool_TV_Guide.Cool3D.value != "No":
|
|---|
| 504 | CoolEvent = 2
|
|---|
| 505 |
|
|---|
| 506 | if self.curr_refcool.toString() == service:
|
|---|
| 507 | # backColor = 0x516b96
|
|---|
| 508 | # backColorOrig = 0x516b96
|
|---|
| 509 | backColorService = 0x516b96
|
|---|
| 510 | res = [ None ]
|
|---|
| 511 | coolpicon = self.findCoolPicon(service, service_name)
|
|---|
| 512 | coolpico = self.findCoolPico(service, service_name)
|
|---|
| 513 | CoolCenter1 = (config.misc.Cool_TV_Guide.PiconItemHeight.value - config.misc.Cool_TV_Guide.PiconHeight.value) / 2
|
|---|
| 514 | CoolCenter2 = (config.misc.Cool_TV_Guide.CoolPicoItemHeight.value - config.misc.Cool_TV_Guide.CoolPicoHeight.value) / 2
|
|---|
| 515 |
|
|---|
| 516 | if CoolEvent == 1:
|
|---|
| 517 | if coolpicon is None and self.coolheight >=40:
|
|---|
| 518 | res.append(MultiContentEntryText(
|
|---|
| 519 | pos = (r1.left()+1,r1.top()+1),
|
|---|
| 520 | size = (r1.width()-2, r1.height()-2),
|
|---|
| 521 | font = 0, flags = RT_HALIGN_CENTER | RT_VALIGN_CENTER,
|
|---|
| 522 | text = service_name,
|
|---|
| 523 | color = self.foreColorService,
|
|---|
| 524 | border_width = 1, border_color = borderColor,
|
|---|
| 525 | backcolor = backColorService, backcolor_sel = backColorService)) #backcolor_sel= Event left select
|
|---|
| 526 |
|
|---|
| 527 | elif self.coolheight >=40:
|
|---|
| 528 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 529 | pos = (r1.left()+1,r1.top()+CoolCenter1),
|
|---|
| 530 | size = (r1.width()-2, r1.height()-2),
|
|---|
| 531 | png = LoadPixmap(coolpicon),
|
|---|
| 532 | backcolor = piconbkcolor,
|
|---|
| 533 | backcolor_sel = 0))
|
|---|
| 534 |
|
|---|
| 535 | if coolpico is None and self.coolheight <40:
|
|---|
| 536 | res.append(MultiContentEntryText(
|
|---|
| 537 | pos = (r1.left()+1,r1.top()+1),
|
|---|
| 538 | size = (r1.width()-2, r1.height()-2),
|
|---|
| 539 | font = 0, flags = RT_HALIGN_CENTER | RT_VALIGN_CENTER,
|
|---|
| 540 | text = service_name,
|
|---|
| 541 | color = self.foreColorService,
|
|---|
| 542 | border_width = 1, border_color = borderColor,
|
|---|
| 543 | backcolor = backColorService, backcolor_sel = backColorService)) #backcolor_sel= Event left select
|
|---|
| 544 |
|
|---|
| 545 | elif self.coolheight <40:
|
|---|
| 546 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 547 | pos = (r1.left()+1,r1.top()+CoolCenter2),
|
|---|
| 548 | size = (r1.width()-2, r1.height()-2),
|
|---|
| 549 | png = LoadPixmap(coolpico),
|
|---|
| 550 | backcolor = piconbkcolor,
|
|---|
| 551 | backcolor_sel = 0))
|
|---|
| 552 |
|
|---|
| 553 | if events:
|
|---|
| 554 | start = self.time_base+self.offs*self.time_epoch*60
|
|---|
| 555 | end = start + self.time_epoch * 60
|
|---|
| 556 | left = r2.left()
|
|---|
| 557 | top = r2.top()
|
|---|
| 558 | width = r2.width()
|
|---|
| 559 | height = r2.height()
|
|---|
| 560 | coolflags = RT_HALIGN_LEFT | RT_VALIGN_CENTER
|
|---|
| 561 | thepraefix = " "
|
|---|
| 562 |
|
|---|
| 563 | if self.coolheight > 30:
|
|---|
| 564 | coolflags = RT_HALIGN_CENTER | RT_VALIGN_CENTER | RT_WRAP
|
|---|
| 565 | thepraefix = ""
|
|---|
| 566 | # if service == self.cur_service[0]:
|
|---|
| 567 | # backColorSelected = self.backColorSelected
|
|---|
| 568 | now = int(time())
|
|---|
| 569 | for ev in events: #(event_id, event_title, begin_time, duration)
|
|---|
| 570 | rec=ev[2] and self.timer.isInTimer(ev[0], ev[2], ev[3], service)
|
|---|
| 571 | xpos, ewidth = self.calcEntryPosAndWidthHelper(ev[2], ev[3], start, end, width)
|
|---|
| 572 |
|
|---|
| 573 | if self.curr_refcool.toString() == service:
|
|---|
| 574 | backColorOrig = 0x516b96
|
|---|
| 575 |
|
|---|
| 576 | if ev[2] <= now and (ev[2] + ev[3]) > now:
|
|---|
| 577 | foreColor = self.nowForeColor
|
|---|
| 578 | foreColorSelected = self.nowForeColorSelected
|
|---|
| 579 | backColor = self.nowBackColor
|
|---|
| 580 | # backColorSelected = self.backColorSelected # Event Selected
|
|---|
| 581 | else:
|
|---|
| 582 | backColor = backColorOrig
|
|---|
| 583 | # backColorSelected = self.backColorSelected
|
|---|
| 584 |
|
|---|
| 585 | foreColor = self.foreColor
|
|---|
| 586 | foreColorSelected = self.foreColorSelected
|
|---|
| 587 |
|
|---|
| 588 | if rec:
|
|---|
| 589 | cooltyp = self.CoolRecRed(service, ev[2], ev[3], ev[0])
|
|---|
| 590 | if cooltyp == "record":
|
|---|
| 591 | backColor = 0xcf5353
|
|---|
| 592 | backColorSelected = 0xf7664b
|
|---|
| 593 | elif cooltyp == "justplay":
|
|---|
| 594 | backColor = 0x669466
|
|---|
| 595 | backColorSelected = 0x61a161
|
|---|
| 596 | # elif cooltyp == "nichts" and cooltyp != "record":
|
|---|
| 597 | # backColor = 0xB6FF00
|
|---|
| 598 | # backColorSelected = 0xC0FF23
|
|---|
| 599 | else:
|
|---|
| 600 | backColor = backColorOrig
|
|---|
| 601 | backColorSelected = self.backColorSelected
|
|---|
| 602 |
|
|---|
| 603 | res.append(MultiContentEntryText(
|
|---|
| 604 | pos = (left+xpos, top), size = (ewidth, height),
|
|---|
| 605 | font = 1, flags = coolflags,
|
|---|
| 606 | text = thepraefix + ev[1], color = foreColor, color_sel = foreColorSelected,
|
|---|
| 607 | backcolor = backColor, backcolor_sel = backColorSelected, border_width = 1, border_color = borderColor)) # Color select Event
|
|---|
| 608 |
|
|---|
| 609 | else:
|
|---|
| 610 | left = r2.left()
|
|---|
| 611 | top = r2.top()
|
|---|
| 612 | width = r2.width()
|
|---|
| 613 | height = r2.height()
|
|---|
| 614 | res.append(MultiContentEntryText(
|
|---|
| 615 | pos = (left, top), size = (width, height),
|
|---|
| 616 | font = 1, flags = RT_HALIGN_LEFT | RT_VALIGN_CENTER,
|
|---|
| 617 | text = " ", color = foreColor, color_sel = foreColorSelected,
|
|---|
| 618 | border_width = 1, backcolor_sel = backColorSelected, border_color = borderColor))
|
|---|
| 619 | return res
|
|---|
| 620 |
|
|---|
| 621 | #######################################################################################################################
|
|---|
| 622 |
|
|---|
| 623 | if CoolEvent == 2:
|
|---|
| 624 |
|
|---|
| 625 | if coolpicon is None and self.coolheight >=40:
|
|---|
| 626 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 627 | pos = (r1.left()+1,r1.top()+1), size = (r1.width()-2, r1.height()-2),
|
|---|
| 628 | png = self.CoolPiconsdef()))
|
|---|
| 629 |
|
|---|
| 630 | if self.curr_refcool.toString() == service:
|
|---|
| 631 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 632 | pos = (r1.left()+1,r1.top()+1), size = (r1.width()-2, r1.height()-2),
|
|---|
| 633 | png = self.CoolPiconsSelectdef()))
|
|---|
| 634 |
|
|---|
| 635 | res.append(MultiContentEntryText(
|
|---|
| 636 | pos = (r1.left()+1,r1.top()+1),
|
|---|
| 637 | size = (r1.width()-2, r1.height()-2),
|
|---|
| 638 | font = 0, flags = RT_HALIGN_CENTER | RT_VALIGN_CENTER,
|
|---|
| 639 | text = service_name,
|
|---|
| 640 | color = self.foreColorService,
|
|---|
| 641 | border_width = 1, border_color = 0x000000))
|
|---|
| 642 |
|
|---|
| 643 | elif self.coolheight >=40:
|
|---|
| 644 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 645 | pos = (r1.left()+1,r1.top()+CoolCenter1),
|
|---|
| 646 | size = (r1.width()-2, r1.height()-2),
|
|---|
| 647 | png = LoadPixmap(coolpicon),
|
|---|
| 648 | backcolor = piconbkcolor,
|
|---|
| 649 | backcolor_sel = 0))
|
|---|
| 650 |
|
|---|
| 651 | if coolpico is None and self.coolheight <40:
|
|---|
| 652 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 653 | pos = (r1.left()+1,r1.top()+1), size = (r1.width()-2, r1.height()-2),
|
|---|
| 654 | png = self.CoolPiconsSdef()))
|
|---|
| 655 |
|
|---|
| 656 | if self.curr_refcool.toString() == service:
|
|---|
| 657 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 658 | pos = (r1.left()+1,r1.top()+1), size = (r1.width()-2, r1.height()-2),
|
|---|
| 659 | png = self.CoolPiconsSelectSdef()))
|
|---|
| 660 |
|
|---|
| 661 | res.append(MultiContentEntryText(
|
|---|
| 662 | pos = (r1.left()+1,r1.top()+1),
|
|---|
| 663 | size = (r1.width()-2, r1.height()-2),
|
|---|
| 664 | font = 0, flags = RT_HALIGN_CENTER | RT_VALIGN_CENTER,
|
|---|
| 665 | text = service_name,
|
|---|
| 666 | color = self.foreColorService,
|
|---|
| 667 | border_width = 1, border_color = 0x000000))
|
|---|
| 668 |
|
|---|
| 669 | elif self.coolheight <40:
|
|---|
| 670 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 671 | pos = (r1.left()+1,r1.top()+CoolCenter2),
|
|---|
| 672 | size = (r1.width()-2, r1.height()-2),
|
|---|
| 673 | png = LoadPixmap(coolpico),
|
|---|
| 674 | backcolor = piconbkcolor,
|
|---|
| 675 | backcolor_sel = 0))
|
|---|
| 676 |
|
|---|
| 677 | if events:
|
|---|
| 678 | start = self.time_base+self.offs*self.time_epoch*60
|
|---|
| 679 | end = start + self.time_epoch * 60
|
|---|
| 680 | left = r2.left()
|
|---|
| 681 | top = r2.top()
|
|---|
| 682 | width = r2.width()
|
|---|
| 683 | height = r2.height()
|
|---|
| 684 | coolflags = RT_HALIGN_LEFT | RT_VALIGN_CENTER
|
|---|
| 685 | thepraefix = " "
|
|---|
| 686 |
|
|---|
| 687 | if self.coolheight > 30:
|
|---|
| 688 | coolflags = RT_HALIGN_CENTER | RT_VALIGN_CENTER | RT_WRAP
|
|---|
| 689 | thepraefix = ""
|
|---|
| 690 |
|
|---|
| 691 | now = int(time())
|
|---|
| 692 | for ev in events: #(event_id, event_title, begin_time, duration)
|
|---|
| 693 | rec=ev[2] and self.timer.isInTimer(ev[0], ev[2], ev[3], service)
|
|---|
| 694 | xpos, ewidth = self.calcEntryPosAndWidthHelper(ev[2], ev[3], start, end, width)
|
|---|
| 695 |
|
|---|
| 696 | if self.coolheight <40:
|
|---|
| 697 | if ev[2] <= now and (ev[2] + ev[3]) > now:
|
|---|
| 698 | foreColor = self.nowForeColor
|
|---|
| 699 | foreColorSelected = self.nowForeColorSelected
|
|---|
| 700 | backColor = self.nowBackColor
|
|---|
| 701 |
|
|---|
| 702 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 703 | pos = (left+xpos, top), size = (ewidth, height),
|
|---|
| 704 | png = self.CoolNowSdef(service, ev[2], ev[3], ev[0]),
|
|---|
| 705 | backcolor = backColor,
|
|---|
| 706 | backcolor_sel = backColorSelected))
|
|---|
| 707 |
|
|---|
| 708 | else:
|
|---|
| 709 | backColor = backColorOrig
|
|---|
| 710 | backColorSelected = self.backColorSelected
|
|---|
| 711 | foreColor = self.foreColor
|
|---|
| 712 | foreColorSelected = self.foreColorSelected
|
|---|
| 713 |
|
|---|
| 714 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 715 | pos = (left+xpos, top), size = (ewidth, height),
|
|---|
| 716 | png = self.CoolBackSdef(service, ev[2], ev[3], ev[0]),
|
|---|
| 717 | backcolor = backColor,
|
|---|
| 718 | backcolor_sel = backColorSelected))
|
|---|
| 719 |
|
|---|
| 720 | if self.curr_refcool.toString() == service:
|
|---|
| 721 |
|
|---|
| 722 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 723 | pos = (left+xpos, top), size = (ewidth, height),
|
|---|
| 724 | png = self.CoolSelectSdef(service, ev[2], ev[3], ev[0]),
|
|---|
| 725 | backcolor = backColor,
|
|---|
| 726 | backcolor_sel = backColorSelected))
|
|---|
| 727 |
|
|---|
| 728 | if rec:
|
|---|
| 729 | cooltyp = self.CoolRecRed(service, ev[2], ev[3], ev[0])
|
|---|
| 730 | if cooltyp == "record":
|
|---|
| 731 |
|
|---|
| 732 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 733 | pos = (left+xpos, top), size = (ewidth, height),
|
|---|
| 734 | png = self.CoolRecSdef(service, ev[2], ev[3], ev[0]),
|
|---|
| 735 | backcolor = backColor,
|
|---|
| 736 | backcolor_sel = backColorSelected))
|
|---|
| 737 |
|
|---|
| 738 | backColorSelected = 0x9F0000
|
|---|
| 739 | elif cooltyp == "justplay":
|
|---|
| 740 | backColor = 0x669466
|
|---|
| 741 | backColorSelected = 0x61a161
|
|---|
| 742 |
|
|---|
| 743 | else:
|
|---|
| 744 | backColor = backColorOrig
|
|---|
| 745 | backColorSelected = self.backColorSelected
|
|---|
| 746 |
|
|---|
| 747 | res.append(MultiContentEntryText(
|
|---|
| 748 | pos = (left+xpos, top), size = (ewidth, height),
|
|---|
| 749 | font = 1, flags = coolflags,
|
|---|
| 750 | text = thepraefix + ev[1], color = foreColor, color_sel = foreColorSelected,
|
|---|
| 751 | backcolor_sel = backColorSelected, border_width = 2, border_color = 0x000000)) # Color select Event
|
|---|
| 752 |
|
|---|
| 753 |
|
|---|
| 754 | elif self.coolheight >=40:
|
|---|
| 755 | if ev[2] <= now and (ev[2] + ev[3]) > now:
|
|---|
| 756 | foreColor = self.nowForeColor
|
|---|
| 757 | foreColorSelected = self.nowForeColorSelected
|
|---|
| 758 | backColor = self.nowBackColor
|
|---|
| 759 | # Gruen
|
|---|
| 760 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 761 | pos = (left+xpos, top), size = (ewidth, height),
|
|---|
| 762 | png = self.CoolNowdef(service, ev[2], ev[3], ev[0]),
|
|---|
| 763 | backcolor = backColor,
|
|---|
| 764 | backcolor_sel = backColorSelected))
|
|---|
| 765 |
|
|---|
| 766 | else:
|
|---|
| 767 | backColor = backColorOrig
|
|---|
| 768 | backColorSelected = self.backColorSelected
|
|---|
| 769 | foreColor = self.foreColor
|
|---|
| 770 | foreColorSelected = self.foreColorSelected
|
|---|
| 771 | # Schwarz
|
|---|
| 772 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 773 | pos = (left+xpos, top), size = (ewidth, height),
|
|---|
| 774 | png = self.CoolBackdef(service, ev[2], ev[3], ev[0]),
|
|---|
| 775 | backcolor = backColor,
|
|---|
| 776 | backcolor_sel = backColorSelected))
|
|---|
| 777 |
|
|---|
| 778 | if self.curr_refcool.toString() == service:
|
|---|
| 779 | # Blau
|
|---|
| 780 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 781 | pos = (left+xpos, top), size = (ewidth, height),
|
|---|
| 782 | png = self.CoolSelectdef(service, ev[2], ev[3], ev[0]),
|
|---|
| 783 | backcolor = backColor,
|
|---|
| 784 | backcolor_sel = backColorSelected))
|
|---|
| 785 |
|
|---|
| 786 | if rec:
|
|---|
| 787 | cooltyp = self.CoolRecRed(service, ev[2], ev[3], ev[0])
|
|---|
| 788 | if cooltyp == "record":
|
|---|
| 789 | # Rot
|
|---|
| 790 | res.append(MultiContentEntryPixmapAlphaTest(
|
|---|
| 791 | pos = (left+xpos, top), size = (ewidth, height),
|
|---|
| 792 | png = self.CoolRecdef(service, ev[2], ev[3], ev[0]),
|
|---|
| 793 | backcolor = backColor,
|
|---|
| 794 | backcolor_sel = backColorSelected))
|
|---|
| 795 |
|
|---|
| 796 | backColorSelected = 0x9F0000
|
|---|
| 797 | elif cooltyp == "justplay":
|
|---|
| 798 | backColor = 0x669466
|
|---|
| 799 | backColorSelected = 0x61a161
|
|---|
| 800 |
|
|---|
| 801 | else:
|
|---|
| 802 | backColor = backColorOrig
|
|---|
| 803 | backColorSelected = self.backColorSelected
|
|---|
| 804 |
|
|---|
| 805 | res.append(MultiContentEntryText(
|
|---|
| 806 | pos = (left+xpos, top), size = (ewidth, height),
|
|---|
| 807 | font = 1, flags = coolflags,
|
|---|
| 808 | text = thepraefix + ev[1], color = foreColor, color_sel = foreColorSelected,
|
|---|
| 809 | backcolor_sel = backColorSelected, border_width = 2, border_color = 0x000000)) # Color select Event
|
|---|
| 810 |
|
|---|
| 811 | else:
|
|---|
| 812 | left = r2.left()
|
|---|
| 813 | top = r2.top()
|
|---|
| 814 | width = r2.width()
|
|---|
| 815 | height = r2.height()
|
|---|
| 816 | res.append(MultiContentEntryText(
|
|---|
| 817 | pos = (left, top), size = (width, height),
|
|---|
| 818 | font = 1, flags = RT_HALIGN_LEFT | RT_VALIGN_CENTER,
|
|---|
| 819 | text = " ", color = foreColor, color_sel = foreColorSelected,
|
|---|
| 820 | border_width = 2, backcolor_sel = backColorSelected, border_color = 0x000000))
|
|---|
| 821 | return res
|
|---|
| 822 |
|
|---|
| 823 |
|
|---|
| 824 | #############################################################################################################################
|
|---|
| 825 |
|
|---|
| 826 |
|
|---|
| 827 | def findCoolPicon(self, service = None, serviceName = None):
|
|---|
| 828 | if config.misc.Cool_TV_Guide.CoolPiconON.value == "Yes":
|
|---|
| 829 | if service is not None:
|
|---|
| 830 | pos = service.rfind(':')
|
|---|
| 831 | if pos != -1:
|
|---|
| 832 | service = service[:pos].rstrip(':').replace(':','_')
|
|---|
| 833 | pngname = "/tmp/cool3dpicon/" + service + ".png"
|
|---|
| 834 | if fileExists(pngname):
|
|---|
| 835 | return pngname
|
|---|
| 836 | if serviceName is not None:
|
|---|
| 837 | pngname = "/tmp/cool3dpicon/" + serviceName + ".png"
|
|---|
| 838 | if fileExists(pngname):
|
|---|
| 839 | return pngname
|
|---|
| 840 | if service is not None:
|
|---|
| 841 | for path in self.searchCoolPiconPaths:
|
|---|
| 842 | pngname = path + service + ".png"
|
|---|
| 843 | if fileExists(pngname):
|
|---|
| 844 | return pngname
|
|---|
| 845 | if serviceName is not None:
|
|---|
| 846 | for path in self.searchCoolPiconPaths:
|
|---|
| 847 | pngname = path + serviceName + ".png"
|
|---|
| 848 | if fileExists(pngname):
|
|---|
| 849 | return pngname
|
|---|
| 850 |
|
|---|
| 851 | def findCoolPico(self, service = None, serviceName = None):
|
|---|
| 852 | if config.misc.Cool_TV_Guide.CoolPicoON.value == "Yes":
|
|---|
| 853 | if service is not None:
|
|---|
| 854 | pos = service.rfind(':')
|
|---|
| 855 | if pos != -1:
|
|---|
| 856 | service = service[:pos].rstrip(':').replace(':','_')
|
|---|
| 857 | pngname = "/tmp/cool3dpico/" + service + ".png"
|
|---|
| 858 | if fileExists(pngname):
|
|---|
| 859 | return pngname
|
|---|
| 860 | if serviceName is not None:
|
|---|
| 861 | pngname = "/tmp/cool3dpico/" + serviceName + ".png"
|
|---|
| 862 | if fileExists(pngname):
|
|---|
| 863 | return pngname
|
|---|
| 864 | if service is not None:
|
|---|
| 865 | for path in self.searchCoolPicoPaths:
|
|---|
| 866 | pngname = path + service + ".png"
|
|---|
| 867 | if fileExists(pngname):
|
|---|
| 868 | return pngname
|
|---|
| 869 | if serviceName is not None:
|
|---|
| 870 | for path in self.searchCoolPicoPaths:
|
|---|
| 871 | pngname = path + serviceName + ".png"
|
|---|
| 872 | if fileExists(pngname):
|
|---|
| 873 | return pngname
|
|---|
| 874 |
|
|---|
| 875 | def selEntry(self, dir, visible=True):
|
|---|
| 876 | cur_service = self.cur_service #(service, service_name, events)
|
|---|
| 877 | self.recalcEntrySize()
|
|---|
| 878 | valid_event = self.cur_event is not None
|
|---|
| 879 | if cur_service:
|
|---|
| 880 | update = True
|
|---|
| 881 | entries = cur_service[2]
|
|---|
| 882 | if dir == 0: #current
|
|---|
| 883 | update = False
|
|---|
| 884 | elif dir == +1: #next
|
|---|
| 885 | if valid_event and self.cur_event+1 < len(entries):
|
|---|
| 886 | self.cur_event+=1
|
|---|
| 887 | else:
|
|---|
| 888 | self.offs += 1
|
|---|
| 889 | self.fillCoolTVGuide(None) # refill
|
|---|
| 890 | return True
|
|---|
| 891 | elif dir == -1: #prev
|
|---|
| 892 | if valid_event and self.cur_event-1 >= 0:
|
|---|
| 893 | self.cur_event-=1
|
|---|
| 894 | elif self.offs > 0:
|
|---|
| 895 | self.offs -= 1
|
|---|
| 896 | self.fillCoolTVGuide(None) # refill
|
|---|
| 897 | return True
|
|---|
| 898 | elif dir == +2: #next page
|
|---|
| 899 | self.offs += 1
|
|---|
| 900 | self.fillCoolTVGuide(None) # refill
|
|---|
| 901 | return True
|
|---|
| 902 | elif dir == -2: #prev
|
|---|
| 903 | if self.offs > 0:
|
|---|
| 904 | self.offs -= 1
|
|---|
| 905 | self.fillCoolTVGuide(None) # refill
|
|---|
| 906 | return True
|
|---|
| 907 |
|
|---|
| 908 | self.l.setSelectionClip(eRect(self.service_rect.left(), self.service_rect.top(), self.service_rect.width(), self.service_rect.height()), False) # left Picon select
|
|---|
| 909 | if cur_service and valid_event:
|
|---|
| 910 | entry = entries[self.cur_event] #(event_id, event_title, begin_time, duration)
|
|---|
| 911 | time_base = self.time_base+self.offs*self.time_epoch*60
|
|---|
| 912 | xpos, width = self.calcEntryPosAndWidth(self.event_rect, time_base, self.time_epoch, entry[2], entry[3])
|
|---|
| 913 | self.l.setSelectionClip(eRect(xpos, 0, width, self.event_rect.height()), visible and update)
|
|---|
| 914 | else:
|
|---|
| 915 | self.l.setSelectionClip(eRect(self.event_rect.left(), self.event_rect.top(), self.event_rect.width(), self.event_rect.height()), False)
|
|---|
| 916 | self.selectionChanged()
|
|---|
| 917 | return False
|
|---|
| 918 |
|
|---|
| 919 | def queryEPG(self, list, buildFunc=None):
|
|---|
| 920 | if self.epgcache is not None:
|
|---|
| 921 | if buildFunc is not None:
|
|---|
| 922 | return self.epgcache.lookupEvent(list, buildFunc)
|
|---|
| 923 | else:
|
|---|
| 924 | return self.epgcache.lookupEvent(list)
|
|---|
| 925 | return [ ]
|
|---|
| 926 |
|
|---|
| 927 | def fillCoolTVGuide(self, services, stime=-1):
|
|---|
| 928 | if config.misc.Cool_TV_Guide.Cool3D.value == "SkinDesign" and self.SDCoolNow is None:
|
|---|
| 929 | config.misc.Cool_TV_Guide.Cool3D.value = "Standard"
|
|---|
| 930 | if config.misc.Cool_TV_Guide.Cool3D.value == "MyDesign" and self.MDCoolNow is None:
|
|---|
| 931 | config.misc.Cool_TV_Guide.Cool3D.value = "Standard"
|
|---|
| 932 | if config.misc.Cool_TV_Guide.Cool3D.value == "Standard" and self.CoolNow is None:
|
|---|
| 933 | config.misc.Cool_TV_Guide.Cool3D.value = "No"
|
|---|
| 934 | if services is None:
|
|---|
| 935 | time_base = self.time_base+self.offs*self.time_epoch*60
|
|---|
| 936 | test = [ (service[0], 0, time_base, self.time_epoch) for service in self.list ]
|
|---|
| 937 | else:
|
|---|
| 938 | self.cur_event = None
|
|---|
| 939 | self.cur_service = None
|
|---|
| 940 | self.time_base = int(stime)
|
|---|
| 941 | test = [ (service.ref.toString(), 0, self.time_base, self.time_epoch) for service in services ]
|
|---|
| 942 | test.insert(0, 'XRnITBD')
|
|---|
| 943 | epg_data = self.queryEPG(test)
|
|---|
| 944 | self.list = [ ]
|
|---|
| 945 | tmp_list = None
|
|---|
| 946 | service = ""
|
|---|
| 947 | sname = ""
|
|---|
| 948 | for x in epg_data:
|
|---|
| 949 | if service != x[0]:
|
|---|
| 950 | if tmp_list is not None:
|
|---|
| 951 | self.list.append((service, sname, tmp_list[0][0] is not None and tmp_list or None))
|
|---|
| 952 | service = x[0]
|
|---|
| 953 | sname = x[1]
|
|---|
| 954 | tmp_list = [ ]
|
|---|
| 955 | tmp_list.append((x[2], x[3], x[4], x[5]))
|
|---|
| 956 | if tmp_list and len(tmp_list):
|
|---|
| 957 | self.list.append((service, sname, tmp_list[0][0] is not None and tmp_list or None))
|
|---|
| 958 |
|
|---|
| 959 | self.l.setList(self.list)
|
|---|
| 960 | self.findBestEvent()
|
|---|
| 961 |
|
|---|
| 962 | def getEventRect(self):
|
|---|
| 963 | rc = self.event_rect
|
|---|
| 964 | return Rect( rc.left() + (self.instance and self.instance.position().x() or 0), rc.top(), rc.width(), rc.height() )
|
|---|
| 965 |
|
|---|
| 966 | def getTimeEpoch(self):
|
|---|
| 967 | return self.time_epoch
|
|---|
| 968 |
|
|---|
| 969 | def getTimeBase(self):
|
|---|
| 970 | return self.time_base + (self.offs * self.time_epoch * 60)
|
|---|
| 971 |
|
|---|
| 972 | def resetOffset(self):
|
|---|
| 973 | self.offs = 0
|
|---|
| 974 |
|
|---|
| 975 |
|
|---|
| 976 | def CoolPiconsdef(self):
|
|---|
| 977 | if config.misc.Cool_TV_Guide.Cool3D.value == "SkinDesign":
|
|---|
| 978 | return self.SDCoolPicons
|
|---|
| 979 | if config.misc.Cool_TV_Guide.Cool3D.value == "MyDesign":
|
|---|
| 980 | return self.MDCoolPicons
|
|---|
| 981 | if config.misc.Cool_TV_Guide.Cool3D.value == "Standard":
|
|---|
| 982 | return self.CoolPicons
|
|---|
| 983 |
|
|---|
| 984 | def CoolPiconsSelectdef(self):
|
|---|
| 985 | if config.misc.Cool_TV_Guide.Cool3D.value == "SkinDesign":
|
|---|
| 986 | return self.SDCoolPiconsSelect
|
|---|
| 987 | if config.misc.Cool_TV_Guide.Cool3D.value == "MyDesign":
|
|---|
| 988 | return self.MDCoolPiconsSelect
|
|---|
| 989 | if config.misc.Cool_TV_Guide.Cool3D.value == "Standard":
|
|---|
| 990 | return self.CoolPiconsSelect
|
|---|
| 991 |
|
|---|
| 992 | def CoolPiconsSdef(self):
|
|---|
| 993 | if config.misc.Cool_TV_Guide.Cool3D.value == "SkinDesign":
|
|---|
| 994 | return self.SDCoolPiconsS
|
|---|
| 995 | if config.misc.Cool_TV_Guide.Cool3D.value == "MyDesign":
|
|---|
| 996 | return self.MDCoolPiconsS
|
|---|
| 997 | if config.misc.Cool_TV_Guide.Cool3D.value == "Standard":
|
|---|
| 998 | return self.CoolPiconsS
|
|---|
| 999 |
|
|---|
| 1000 | def CoolPiconsSelectSdef(self):
|
|---|
| 1001 | if config.misc.Cool_TV_Guide.Cool3D.value == "SkinDesign":
|
|---|
| 1002 | return self.SDCoolPiconsSelectS
|
|---|
| 1003 | if config.misc.Cool_TV_Guide.Cool3D.value == "MyDesign":
|
|---|
| 1004 | return self.MDCoolPiconsSelectS
|
|---|
| 1005 | if config.misc.Cool_TV_Guide.Cool3D.value == "Standard":
|
|---|
| 1006 | return self.CoolPiconsSelectS
|
|---|
| 1007 |
|
|---|
| 1008 | def CoolNowdef(self, refstr, beginTime, duration, eventId):
|
|---|
| 1009 | if config.misc.Cool_TV_Guide.Cool3D.value == "SkinDesign":
|
|---|
| 1010 | return self.SDCoolNow
|
|---|
| 1011 | if config.misc.Cool_TV_Guide.Cool3D.value == "MyDesign":
|
|---|
| 1012 | return self.MDCoolNow
|
|---|
| 1013 | if config.misc.Cool_TV_Guide.Cool3D.value == "Standard":
|
|---|
| 1014 | return self.CoolNow
|
|---|
| 1015 |
|
|---|
| 1016 | def CoolBackdef(self, refstr, beginTime, duration, eventId):
|
|---|
| 1017 | if config.misc.Cool_TV_Guide.Cool3D.value == "SkinDesign":
|
|---|
| 1018 | return self.SDCoolBack
|
|---|
| 1019 | if config.misc.Cool_TV_Guide.Cool3D.value == "MyDesign":
|
|---|
| 1020 | return self.MDCoolBack
|
|---|
| 1021 | if config.misc.Cool_TV_Guide.Cool3D.value == "Standard":
|
|---|
| 1022 | return self.CoolBack
|
|---|
| 1023 |
|
|---|
| 1024 | def CoolSelectdef(self, refstr, beginTime, duration, eventId):
|
|---|
| 1025 | if config.misc.Cool_TV_Guide.Cool3D.value == "SkinDesign":
|
|---|
| 1026 | return self.SDCoolSelect
|
|---|
| 1027 | if config.misc.Cool_TV_Guide.Cool3D.value == "MyDesign":
|
|---|
| 1028 | return self.MDCoolSelect
|
|---|
| 1029 | if config.misc.Cool_TV_Guide.Cool3D.value == "Standard":
|
|---|
| 1030 | return self.CoolSelect
|
|---|
| 1031 |
|
|---|
| 1032 | def CoolRecdef(self, refstr, beginTime, duration, eventId):
|
|---|
| 1033 | if config.misc.Cool_TV_Guide.Cool3D.value == "SkinDesign":
|
|---|
| 1034 | return self.SDCoolRec
|
|---|
| 1035 | if config.misc.Cool_TV_Guide.Cool3D.value == "MyDesign":
|
|---|
| 1036 | return self.MDCoolRec
|
|---|
| 1037 | if config.misc.Cool_TV_Guide.Cool3D.value == "Standard":
|
|---|
| 1038 | return self.CoolRec
|
|---|
| 1039 |
|
|---|
| 1040 | def CoolNowSdef(self, refstr, beginTime, duration, eventId):
|
|---|
| 1041 | if config.misc.Cool_TV_Guide.Cool3D.value == "SkinDesign":
|
|---|
| 1042 | return self.SDCoolNowS
|
|---|
| 1043 | if config.misc.Cool_TV_Guide.Cool3D.value == "MyDesign":
|
|---|
| 1044 | return self.MDCoolNowS
|
|---|
| 1045 | if config.misc.Cool_TV_Guide.Cool3D.value == "Standard":
|
|---|
| 1046 | return self.CoolNowS
|
|---|
| 1047 |
|
|---|
| 1048 | def CoolBackSdef(self, refstr, beginTime, duration, eventId):
|
|---|
| 1049 | if config.misc.Cool_TV_Guide.Cool3D.value == "SkinDesign":
|
|---|
| 1050 | return self.SDCoolBackS
|
|---|
| 1051 | if config.misc.Cool_TV_Guide.Cool3D.value == "MyDesign":
|
|---|
| 1052 | return self.MDCoolBackS
|
|---|
| 1053 | if config.misc.Cool_TV_Guide.Cool3D.value == "Standard":
|
|---|
| 1054 | return self.CoolBackS
|
|---|
| 1055 |
|
|---|
| 1056 | def CoolSelectSdef(self, refstr, beginTime, duration, eventId):
|
|---|
| 1057 | if config.misc.Cool_TV_Guide.Cool3D.value == "SkinDesign":
|
|---|
| 1058 | return self.SDCoolSelectS
|
|---|
| 1059 | if config.misc.Cool_TV_Guide.Cool3D.value == "MyDesign":
|
|---|
| 1060 | return self.MDCoolSelectS
|
|---|
| 1061 | if config.misc.Cool_TV_Guide.Cool3D.value == "Standard":
|
|---|
| 1062 | return self.CoolSelectS
|
|---|
| 1063 |
|
|---|
| 1064 | def CoolRecSdef(self, refstr, beginTime, duration, eventId):
|
|---|
| 1065 | if config.misc.Cool_TV_Guide.Cool3D.value == "SkinDesign":
|
|---|
| 1066 | return self.SDCoolRecS
|
|---|
| 1067 | if config.misc.Cool_TV_Guide.Cool3D.value == "MyDesign":
|
|---|
| 1068 | return self.MDCoolRecS
|
|---|
| 1069 | if config.misc.Cool_TV_Guide.Cool3D.value == "Standard":
|
|---|
| 1070 | return self.CoolRecS
|
|---|
| 1071 |
|
|---|
| 1072 | def CoolRecRed(self, refstr, beginTime, duration, eventId):
|
|---|
| 1073 | pre_clock = 1
|
|---|
| 1074 | post_clock = 2
|
|---|
| 1075 | clock_type = 0
|
|---|
| 1076 | endTime = beginTime + duration
|
|---|
| 1077 | for x in self.timer.timer_list:
|
|---|
| 1078 | if x.service_ref.ref.toString() == refstr:
|
|---|
| 1079 | if x.eit == eventId:
|
|---|
| 1080 | return "record"
|
|---|
| 1081 | beg = x.begin
|
|---|
| 1082 | end = x.end
|
|---|
| 1083 | if beginTime > beg and beginTime < end and endTime > end:
|
|---|
| 1084 | clock_type |= pre_clock
|
|---|
| 1085 | elif beginTime < beg and endTime > beg and endTime < end:
|
|---|
| 1086 | clock_type |= post_clock
|
|---|
| 1087 | if clock_type == 0:
|
|---|
| 1088 | return "record"
|
|---|
| 1089 | elif clock_type == pre_clock:
|
|---|
| 1090 | return "nichts"
|
|---|
| 1091 | elif clock_type == post_clock:
|
|---|
| 1092 | return "nichts"
|
|---|
| 1093 | else:
|
|---|
| 1094 | return "nichts"
|
|---|
| 1095 |
|
|---|
| 1096 |
|
|---|
| 1097 | class TimelineText(HTMLComponent, GUIComponent):
|
|---|
| 1098 | def __init__(self):
|
|---|
| 1099 | GUIComponent.__init__(self)
|
|---|
| 1100 | self.l = eListboxPythonMultiContent()
|
|---|
| 1101 | self.l.setSelectionClip(eRect(0,0,0,0))
|
|---|
| 1102 | self.l.setItemHeight(25);
|
|---|
| 1103 | self.l.setFont(0, gFont("Regular", config.misc.Cool_TV_Guide.Cool_Timeline.value))
|
|---|
| 1104 |
|
|---|
| 1105 | GUI_WIDGET = eListbox
|
|---|
| 1106 |
|
|---|
| 1107 | def postWidgetCreate(self, instance):
|
|---|
| 1108 | instance.setContent(self.l)
|
|---|
| 1109 |
|
|---|
| 1110 | def setEntries(self, entries):
|
|---|
| 1111 | res = [ None ]
|
|---|
| 1112 |
|
|---|
| 1113 | for x in entries:
|
|---|
| 1114 | tm = x[0]
|
|---|
| 1115 | xpos = x[1]
|
|---|
| 1116 | str = strftime("%H:%M", localtime(tm))
|
|---|
| 1117 | res.append((eListboxPythonMultiContent.TYPE_TEXT, xpos-30, 0, 60, 25, 0, RT_HALIGN_CENTER|RT_VALIGN_CENTER, str))
|
|---|
| 1118 | self.l.setList([res])
|
|---|
| 1119 |
|
|---|
| 1120 |
|
|---|
| 1121 | class CoolTVGuide(Screen, ConfigListScreen):
|
|---|
| 1122 | EMPTY = 0
|
|---|
| 1123 | ADD_TIMER = 1
|
|---|
| 1124 | REMOVE_TIMER = 2
|
|---|
| 1125 | ZAP = 1
|
|---|
| 1126 |
|
|---|
| 1127 | def __init__(self, session, services, zapFunc=None, bouquetChangeCB=None, bouquetname=""):
|
|---|
| 1128 | Screen.__init__(self, session)
|
|---|
| 1129 | CoolWide = getDesktop(0).size().width()
|
|---|
| 1130 | skinpath = str(resolveFilename)
|
|---|
| 1131 |
|
|---|
| 1132 | if config.misc.Cool_TV_Guide.CoolMultiSwitch.value == "No":
|
|---|
| 1133 | self.skinName = "CoolTVGuide"
|
|---|
| 1134 | if CoolWide == 720:
|
|---|
| 1135 | skin = "/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSkin/CoolTVGuide_720.xml"
|
|---|
| 1136 |
|
|---|
| 1137 | elif CoolWide == 1024:
|
|---|
| 1138 | skin = "/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSkin/CoolTVGuide_1024.xml"
|
|---|
| 1139 |
|
|---|
| 1140 | else:
|
|---|
| 1141 | skin = "/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSkin/CoolTVGuide_1280.xml"
|
|---|
| 1142 |
|
|---|
| 1143 | elif config.misc.Cool_TV_Guide.CoolMultiSwitch.value == "Yes":
|
|---|
| 1144 | self.skinName = "CoolMultiGuide"
|
|---|
| 1145 | if CoolWide == 720:
|
|---|
| 1146 | skin = "/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSkin/CoolMultiGuide_720.xml"
|
|---|
| 1147 | elif CoolWide == 1024:
|
|---|
| 1148 | skin = "/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSkin/CoolMultiGuide_1024.xml"
|
|---|
| 1149 | else:
|
|---|
| 1150 | skin = "/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSkin/CoolMultiGuide_1280.xml"
|
|---|
| 1151 |
|
|---|
| 1152 | Cool = open(skin)
|
|---|
| 1153 | self.skin = Cool.read()
|
|---|
| 1154 | Cool.close()
|
|---|
| 1155 | self.bouquetChangeCB = bouquetChangeCB
|
|---|
| 1156 | now = time()
|
|---|
| 1157 | tmp = now % 900
|
|---|
| 1158 | self.ask_time = now - tmp
|
|---|
| 1159 | self.closeRecursive = False
|
|---|
| 1160 | self["key_red"] = Button("")
|
|---|
| 1161 | self["key_green"] = Button("")
|
|---|
| 1162 | self["key_yellow"] = Button("")
|
|---|
| 1163 | self["key_blue"] = Button("")
|
|---|
| 1164 | self.key_red_choice = self.EMPTY
|
|---|
| 1165 | self.key_green_choice = self.EMPTY
|
|---|
| 1166 | self.key_yellow_choice = self.EMPTY
|
|---|
| 1167 | self.key_blue_choice = self.EMPTY
|
|---|
| 1168 | self["timeline_text"] = TimelineText()
|
|---|
| 1169 | self["Event"] = Event()
|
|---|
| 1170 | self.time_lines = [ ]
|
|---|
| 1171 | for x in (0,1,2,3,4,5):
|
|---|
| 1172 | pm = Pixmap()
|
|---|
| 1173 | self.time_lines.append(pm)
|
|---|
| 1174 | self["timeline%d"%(x)] = pm
|
|---|
| 1175 | self["timeline_now"] = Pixmap()
|
|---|
| 1176 | self.services = services
|
|---|
| 1177 | self.zapFunc = zapFunc
|
|---|
| 1178 | if bouquetname != "":
|
|---|
| 1179 | Screen.setTitle(self, bouquetname)
|
|---|
| 1180 | global CoolList
|
|---|
| 1181 | self["list"] = CoolEPGList(selChangedCB = self.onSelectionChanged, timer = self.session.nav.RecordTimer,
|
|---|
| 1182 | time_epoch = config.misc.Cool_TV_Guide.prev_time_period.value,
|
|---|
| 1183 | overjump_empty = config.misc.Cool_TV_Guide.overjump.value)
|
|---|
| 1184 |
|
|---|
| 1185 | CoolList = self["list"]
|
|---|
| 1186 | self["Coolman"] = HelpableActionMap(self, "CoolTVGuideActions",
|
|---|
| 1187 | {
|
|---|
| 1188 | "CoolMenu": (self.showSetup, _("show your Setup")),
|
|---|
| 1189 | "CoolTime": (self.enterDateTime, _("show Date Time")),
|
|---|
| 1190 | "CoolRed": self.CoolRed,
|
|---|
| 1191 | "CoolRedLong": self.CoolRedLong,
|
|---|
| 1192 | "CoolGreen": self.CoolGreen,
|
|---|
| 1193 | "CoolGreenLong": self.CoolGreenLong,
|
|---|
| 1194 | "CoolYellow": self.CoolYellow,
|
|---|
| 1195 | "CoolYellowLong": self.CoolYellowLong,
|
|---|
| 1196 | "CoolBlue": self.CoolBlue,
|
|---|
| 1197 | "CoolBlueLong": self.CoolBlueLong,
|
|---|
| 1198 | "CoolOK": self.CoolOK,
|
|---|
| 1199 | "CoolOKLong": self.CoolOKLong,
|
|---|
| 1200 | "CoolInfo": self.CoolInfo,
|
|---|
| 1201 | "CoolInfoLong": self.CoolInfoLong,
|
|---|
| 1202 | "CoolRecord": (self.CoolRecord, _("Record")),
|
|---|
| 1203 | })
|
|---|
| 1204 |
|
|---|
| 1205 | self["actions"] = ActionMap(["EPGSelectActions", "OkCancelActions", "HelpActions"],
|
|---|
| 1206 | {
|
|---|
| 1207 | "cancel": self.CoolClose,
|
|---|
| 1208 | "displayHelp": self.myhelp,
|
|---|
| 1209 | "nextBouquet": self.nextBouquet,
|
|---|
| 1210 | "prevBouquet": self.prevBouquet,
|
|---|
| 1211 | "prevService": self.prevPressed,
|
|---|
| 1212 | "nextService": self.nextPressed,
|
|---|
| 1213 | })
|
|---|
| 1214 | self["actions"].csel = self
|
|---|
| 1215 |
|
|---|
| 1216 | self["input_actions"] = ActionMap(["InputActions"],
|
|---|
| 1217 | {
|
|---|
| 1218 | "left": self.leftPressed,
|
|---|
| 1219 | "right": self.rightPressed,
|
|---|
| 1220 | "1": self.key1,
|
|---|
| 1221 | "2": self.key2,
|
|---|
| 1222 | "3": self.key3,
|
|---|
| 1223 | "4": self.key4,
|
|---|
| 1224 | "5": self.key5,
|
|---|
| 1225 | "6": self.key6,
|
|---|
| 1226 | "7": self.key7,
|
|---|
| 1227 | "8": self.key8,
|
|---|
| 1228 | "9": self.key9,
|
|---|
| 1229 | "0": self.key0,
|
|---|
| 1230 | },-1)
|
|---|
| 1231 |
|
|---|
| 1232 | self["key_red"].setText(config.misc.Cool_TV_Guide.Cool_Red.value)
|
|---|
| 1233 | self["key_green"].setText(config.misc.Cool_TV_Guide.Cool_Green.value)
|
|---|
| 1234 | self["key_yellow"].setText(config.misc.Cool_TV_Guide.Cool_Yellow.value)
|
|---|
| 1235 | self["key_blue"].setText(config.misc.Cool_TV_Guide.Cool_Blue.value)
|
|---|
| 1236 | self.updateTimelineTimer = eTimer()
|
|---|
| 1237 | self.updateTimelineTimer.callback.append(self.moveTimeLines)
|
|---|
| 1238 | self.updateTimelineTimer.start(60*1000)
|
|---|
| 1239 | self.onLayoutFinish.append(self.onCreate)
|
|---|
| 1240 | self["date"] = Label()
|
|---|
| 1241 |
|
|---|
| 1242 |
|
|---|
| 1243 | def OpenCoolSingleGuide(self):
|
|---|
| 1244 | cur = self["list"].getCurrent()
|
|---|
| 1245 | event = cur[0]
|
|---|
| 1246 | serviceref = cur[1]
|
|---|
| 1247 | refstr = serviceref.ref.toString()
|
|---|
| 1248 | if event is not None:
|
|---|
| 1249 | self.session.open(CoolSingleGuide, refstr)
|
|---|
| 1250 |
|
|---|
| 1251 | def OpenSingleEPG(self):
|
|---|
| 1252 | cur = self["list"].getCurrent()
|
|---|
| 1253 | event = cur[0]
|
|---|
| 1254 | serviceref = cur[1]
|
|---|
| 1255 | refstr = serviceref.ref.toString()
|
|---|
| 1256 | eventid = event.getEventId()
|
|---|
| 1257 | if event is not None:
|
|---|
| 1258 | self.session.open(EPGSelection, refstr, eventid)
|
|---|
| 1259 |
|
|---|
| 1260 | def CoolAutoTimer(self):
|
|---|
| 1261 | cur = self["list"].getCurrent()
|
|---|
| 1262 | event = cur[0]
|
|---|
| 1263 | if not event: return
|
|---|
| 1264 | serviceref = cur[1]
|
|---|
| 1265 | try:
|
|---|
| 1266 | from Plugins.Extensions.AutoTimer.AutoTimerEditor import addAutotimerFromEvent
|
|---|
| 1267 | addAutotimerFromEvent(self.session, evt = event, service = serviceref)
|
|---|
| 1268 | except:
|
|---|
| 1269 | self.session.open(MessageBox, _("No AutoTimer seems to be installed. Please install it for this functionality."), MessageBox.TYPE_ERROR)
|
|---|
| 1270 |
|
|---|
| 1271 | def CoolRecord(self):
|
|---|
| 1272 | cur = self["list"].getCurrent()
|
|---|
| 1273 | event = cur[0]
|
|---|
| 1274 | serviceref = cur[1]
|
|---|
| 1275 | if event is None:
|
|---|
| 1276 | return
|
|---|
| 1277 | eventid = event.getEventId()
|
|---|
| 1278 | refstr = serviceref.ref.toString()
|
|---|
| 1279 | for timer in self.session.nav.RecordTimer.timer_list:
|
|---|
| 1280 | if timer.eit == eventid and timer.service_ref.ref.toString() == refstr:
|
|---|
| 1281 | self.removeTimer(timer)
|
|---|
| 1282 | self["list"].fillCoolTVGuide(None)
|
|---|
| 1283 | break
|
|---|
| 1284 | else:
|
|---|
| 1285 | newEntry = RecordTimerEntry(serviceref, checkOldTimers = True, *parseEvent(event))
|
|---|
| 1286 | self.session.openWithCallback(self.finishedAdd, CoolTimerEntry, newEntry)
|
|---|
| 1287 |
|
|---|
| 1288 | def CoolSearch(self):
|
|---|
| 1289 | try:
|
|---|
| 1290 | from Plugins.Extensions.EPGSearch.EPGSearch import EPGSearch
|
|---|
| 1291 | except ImportError:
|
|---|
| 1292 | EPGSearch = None
|
|---|
| 1293 | try:
|
|---|
| 1294 | from Bp.extra_epg import epgsearch
|
|---|
| 1295 | except ImportError:
|
|---|
| 1296 | epgsearch = None
|
|---|
| 1297 | try:
|
|---|
| 1298 | cur = self["list"].getCurrent()
|
|---|
| 1299 | event = cur[0]
|
|---|
| 1300 | name = event.getEventName()
|
|---|
| 1301 | except:
|
|---|
| 1302 | name = ''
|
|---|
| 1303 | if EPGSearch is not None:
|
|---|
| 1304 | self.session.open(EPGSearch, name , False)
|
|---|
| 1305 | if epgsearch is not None and EPGSearch is None:
|
|---|
| 1306 | self.session.open(epgsearch, cur)
|
|---|
| 1307 |
|
|---|
| 1308 | def IMDbSearch(self):
|
|---|
| 1309 | try:
|
|---|
| 1310 | cur = self["list"].getCurrent()
|
|---|
| 1311 | event = cur[0]
|
|---|
| 1312 | name = event.getEventName()
|
|---|
| 1313 | except:
|
|---|
| 1314 | name = ''
|
|---|
| 1315 | if IMDB is not None:
|
|---|
| 1316 | self.session.open(IMDB, name, False)
|
|---|
| 1317 |
|
|---|
| 1318 | def prevPressed(self):
|
|---|
| 1319 | coolhilf = config.misc.Cool_TV_Guide.prev_time_period.value
|
|---|
| 1320 | if coolhilf == 60:
|
|---|
| 1321 | cooltime = self["list"].getTimeBase() - 90000
|
|---|
| 1322 | self["list"].resetOffset()
|
|---|
| 1323 | self["list"].fillCoolTVGuide(self.services, cooltime)
|
|---|
| 1324 | self.updEvent(+2)
|
|---|
| 1325 | if coolhilf == 120:
|
|---|
| 1326 | cooltime = self["list"].getTimeBase() - 93600
|
|---|
| 1327 | self["list"].resetOffset()
|
|---|
| 1328 | self["list"].fillCoolTVGuide(self.services, cooltime)
|
|---|
| 1329 | self.updEvent(+2)
|
|---|
| 1330 | if coolhilf == 180:
|
|---|
| 1331 | cooltime = self["list"].getTimeBase() - 97200
|
|---|
| 1332 | self["list"].resetOffset()
|
|---|
| 1333 | self["list"].fillCoolTVGuide(self.services, cooltime)
|
|---|
| 1334 | self.updEvent(+2)
|
|---|
| 1335 | if coolhilf == 240:
|
|---|
| 1336 | cooltime = self["list"].getTimeBase() - 100800
|
|---|
| 1337 | self["list"].resetOffset()
|
|---|
| 1338 | self["list"].fillCoolTVGuide(self.services, cooltime)
|
|---|
| 1339 | self.updEvent(+2)
|
|---|
| 1340 | if coolhilf == 300:
|
|---|
| 1341 | cooltime = self["list"].getTimeBase() - 104400
|
|---|
| 1342 | self["list"].resetOffset()
|
|---|
| 1343 | self["list"].fillCoolTVGuide(self.services, cooltime)
|
|---|
| 1344 | self.updEvent(+2)
|
|---|
| 1345 |
|
|---|
| 1346 | def nextPressed(self):
|
|---|
| 1347 | coolhilf = config.misc.Cool_TV_Guide.prev_time_period.value
|
|---|
| 1348 | if coolhilf == 60:
|
|---|
| 1349 | cooltime = self["list"].getTimeBase() + 82800
|
|---|
| 1350 | self["list"].resetOffset()
|
|---|
| 1351 | self["list"].fillCoolTVGuide(self.services, cooltime)
|
|---|
| 1352 | self.updEvent(+2)
|
|---|
| 1353 | if coolhilf == 120:
|
|---|
| 1354 | cooltime = self["list"].getTimeBase() + 79200
|
|---|
| 1355 | self["list"].resetOffset()
|
|---|
| 1356 | self["list"].fillCoolTVGuide(self.services, cooltime)
|
|---|
| 1357 | self.updEvent(+2)
|
|---|
| 1358 | if coolhilf == 180:
|
|---|
| 1359 | cooltime = self["list"].getTimeBase() + 75600
|
|---|
| 1360 | self["list"].resetOffset()
|
|---|
| 1361 | self["list"].fillCoolTVGuide(self.services, cooltime)
|
|---|
| 1362 | self.updEvent(+2)
|
|---|
| 1363 | if coolhilf == 240:
|
|---|
| 1364 | cooltime = self["list"].getTimeBase() + 72000
|
|---|
| 1365 | self["list"].resetOffset()
|
|---|
| 1366 | self["list"].fillCoolTVGuide(self.services, cooltime)
|
|---|
| 1367 | self.updEvent(+2)
|
|---|
| 1368 | if coolhilf == 300:
|
|---|
| 1369 | cooltime = self["list"].getTimeBase() + 68400
|
|---|
| 1370 | self["list"].resetOffset()
|
|---|
| 1371 | self["list"].fillCoolTVGuide(self.services, cooltime)
|
|---|
| 1372 | self.updEvent(+2)
|
|---|
| 1373 |
|
|---|
| 1374 | def leftPressed(self):
|
|---|
| 1375 | self.updEvent(-1)
|
|---|
| 1376 |
|
|---|
| 1377 | def rightPressed(self):
|
|---|
| 1378 | self.updEvent(+1)
|
|---|
| 1379 |
|
|---|
| 1380 | def updEvent(self, dir, visible=True):
|
|---|
| 1381 | ret = self["list"].selEntry(dir, visible)
|
|---|
| 1382 | if ret:
|
|---|
| 1383 | self.moveTimeLines(True)
|
|---|
| 1384 |
|
|---|
| 1385 | def myhelp(self):
|
|---|
| 1386 | self.session.open(CoolTVGuideHelp, "/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/help.jpg")
|
|---|
| 1387 |
|
|---|
| 1388 | def key1(self):
|
|---|
| 1389 | hilf = config.misc.Cool_TV_Guide.prev_time_period.value
|
|---|
| 1390 | if hilf > 60:
|
|---|
| 1391 | hilf = hilf - 60
|
|---|
| 1392 | self["list"].setEpoch(hilf)
|
|---|
| 1393 | config.misc.Cool_TV_Guide.prev_time_period.value = hilf
|
|---|
| 1394 | self.moveTimeLines()
|
|---|
| 1395 |
|
|---|
| 1396 | def key2(self):
|
|---|
| 1397 | self["list"].instance.moveSelection(self["list"].instance.pageUp)
|
|---|
| 1398 |
|
|---|
| 1399 | def key3(self):
|
|---|
| 1400 | hilf = config.misc.Cool_TV_Guide.prev_time_period.value
|
|---|
| 1401 | if hilf < 300:
|
|---|
| 1402 | hilf = hilf + 60
|
|---|
| 1403 | self["list"].setEpoch(hilf)
|
|---|
| 1404 | config.misc.Cool_TV_Guide.prev_time_period.value = hilf
|
|---|
| 1405 | self.moveTimeLines()
|
|---|
| 1406 |
|
|---|
| 1407 | def key4(self):
|
|---|
| 1408 | self.updEvent(-2)
|
|---|
| 1409 |
|
|---|
| 1410 | def key5(self):
|
|---|
| 1411 | # self.updEvent()
|
|---|
| 1412 | # self["list"].instance.moveSelectionTo(0)
|
|---|
| 1413 | now = time()
|
|---|
| 1414 | tmp = now % 900
|
|---|
| 1415 | cooltime = now - tmp
|
|---|
| 1416 | self["list"].resetOffset()
|
|---|
| 1417 | self["list"].fillCoolTVGuide(self.services, cooltime)
|
|---|
| 1418 | self.moveTimeLines(True)
|
|---|
| 1419 |
|
|---|
| 1420 | def key6(self):
|
|---|
| 1421 | self.updEvent(+2)
|
|---|
| 1422 |
|
|---|
| 1423 | def key7(self):
|
|---|
| 1424 | Coolman = config.misc.Cool_TV_Guide.PiconItemHeight.value
|
|---|
| 1425 | if self["list"].coolheight >40:
|
|---|
| 1426 | Coolman = self["list"].coolheight
|
|---|
| 1427 | if self["list"].coolheight == Cool16:
|
|---|
| 1428 | self["list"].coolheight = Coolman
|
|---|
| 1429 | else:
|
|---|
| 1430 | self["list"].coolheight = Cool16
|
|---|
| 1431 | self["list"].l.setItemHeight(int(self["list"].coolheight))
|
|---|
| 1432 | self["list"].fillCoolTVGuide(None)
|
|---|
| 1433 | self.moveTimeLines()
|
|---|
| 1434 |
|
|---|
| 1435 | def key8(self):
|
|---|
| 1436 | self["list"].instance.moveSelection(self["list"].instance.pageDown)
|
|---|
| 1437 |
|
|---|
| 1438 | def key9(self):
|
|---|
| 1439 | cooltime = localtime(self["list"].getTimeBase())
|
|---|
| 1440 | hilf = (cooltime[0], cooltime[1], cooltime[2], config.misc.Cool_TV_Guide.CoolPrimetime1.value, config.misc.Cool_TV_Guide.CoolPrimetime2.value,0, cooltime[6], cooltime[7], cooltime[8])
|
|---|
| 1441 | cooltime = mktime(hilf)
|
|---|
| 1442 | self["list"].resetOffset()
|
|---|
| 1443 | self["list"].fillCoolTVGuide(self.services, cooltime)
|
|---|
| 1444 | self.moveTimeLines(True)
|
|---|
| 1445 |
|
|---|
| 1446 | def key0(self):
|
|---|
| 1447 | self["list"].setEpoch2(180)
|
|---|
| 1448 | config.misc.Cool_TV_Guide.prev_time_period.value = 180
|
|---|
| 1449 | self["list"].instance.moveSelectionTo(0)
|
|---|
| 1450 | now = time()
|
|---|
| 1451 | tmp = now % 900
|
|---|
| 1452 | cooltime = now - tmp
|
|---|
| 1453 | self["list"].resetOffset()
|
|---|
| 1454 | self["list"].fillCoolTVGuide(self.services, cooltime)
|
|---|
| 1455 | self.moveTimeLines(True)
|
|---|
| 1456 |
|
|---|
| 1457 | def CoolMultiGuide(self):
|
|---|
| 1458 | if config.misc.Cool_TV_Guide.CoolMultiSwitch.value == "No":
|
|---|
| 1459 | config.misc.Cool_TV_Guide.CoolMultiSwitch.value = "Yes"
|
|---|
| 1460 | elif config.misc.Cool_TV_Guide.CoolMultiSwitch.value == "Yes":
|
|---|
| 1461 | config.misc.Cool_TV_Guide.CoolMultiSwitch.value = "No"
|
|---|
| 1462 | self.CoolClose()
|
|---|
| 1463 |
|
|---|
| 1464 | def CoolRed(self):
|
|---|
| 1465 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Zap":
|
|---|
| 1466 | self.zapTo()
|
|---|
| 1467 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Zap + Exit":
|
|---|
| 1468 | self.zap()
|
|---|
| 1469 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Search":
|
|---|
| 1470 | self.CoolSearch()
|
|---|
| 1471 | if config.misc.Cool_TV_Guide.Cool_Red.value == "IMDb Search":
|
|---|
| 1472 | self.IMDbSearch()
|
|---|
| 1473 | if config.misc.Cool_TV_Guide.Cool_Red.value == "CoolSwitch":
|
|---|
| 1474 | self.key7()
|
|---|
| 1475 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Channel Info":
|
|---|
| 1476 | self.infoKeyPressed()
|
|---|
| 1477 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Timer":
|
|---|
| 1478 | self.timerAdd()
|
|---|
| 1479 | if config.misc.Cool_TV_Guide.Cool_Red.value == "QuickRec":
|
|---|
| 1480 | self.CoolRecord()
|
|---|
| 1481 | if config.misc.Cool_TV_Guide.Cool_Red.value == "AutoTimer":
|
|---|
| 1482 | self.CoolAutoTimer()
|
|---|
| 1483 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Primetime":
|
|---|
| 1484 | self.key9()
|
|---|
| 1485 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Bouquet +":
|
|---|
| 1486 | self.nextBouquet()
|
|---|
| 1487 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Bouquet -":
|
|---|
| 1488 | self.prevBouquet()
|
|---|
| 1489 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Bouquetlist":
|
|---|
| 1490 | self.CoolBouquetlist()
|
|---|
| 1491 |
|
|---|
| 1492 | def CoolRedLong(self):
|
|---|
| 1493 | if config.misc.Cool_TV_Guide.Cool_RedLong.value == "Zap":
|
|---|
| 1494 | self.zapTo()
|
|---|
| 1495 | if config.misc.Cool_TV_Guide.Cool_RedLong.value == "Zap + Exit":
|
|---|
| 1496 | self.zap()
|
|---|
| 1497 | if config.misc.Cool_TV_Guide.Cool_RedLong.value == "Search":
|
|---|
| 1498 | self.CoolSearch()
|
|---|
| 1499 | if config.misc.Cool_TV_Guide.Cool_RedLong.value == "IMDb Search":
|
|---|
| 1500 | self.IMDbSearch()
|
|---|
| 1501 | if config.misc.Cool_TV_Guide.Cool_RedLong.value == "CoolSwitch":
|
|---|
| 1502 | self.key7()
|
|---|
| 1503 | if config.misc.Cool_TV_Guide.Cool_RedLong.value == "Channel Info":
|
|---|
| 1504 | self.infoKeyPressed()
|
|---|
| 1505 | if config.misc.Cool_TV_Guide.Cool_RedLong.value == "Timer":
|
|---|
| 1506 | self.timerAdd()
|
|---|
| 1507 | if config.misc.Cool_TV_Guide.Cool_RedLong.value == "QuickRec":
|
|---|
| 1508 | self.CoolRecord()
|
|---|
| 1509 | if config.misc.Cool_TV_Guide.Cool_RedLong.value == "AutoTimer":
|
|---|
| 1510 | self.CoolAutoTimer()
|
|---|
| 1511 | if config.misc.Cool_TV_Guide.Cool_RedLong.value == "Primetime":
|
|---|
| 1512 | self.key9()
|
|---|
| 1513 | if config.misc.Cool_TV_Guide.Cool_RedLong.value == "Bouquet +":
|
|---|
| 1514 | self.nextBouquet()
|
|---|
| 1515 | if config.misc.Cool_TV_Guide.Cool_RedLong.value == "Bouquet -":
|
|---|
| 1516 | self.prevBouquet()
|
|---|
| 1517 | if config.misc.Cool_TV_Guide.Cool_RedLong.value == "Bouquetlist":
|
|---|
| 1518 | self.CoolBouquetlist()
|
|---|
| 1519 |
|
|---|
| 1520 | def CoolGreen(self):
|
|---|
| 1521 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Zap":
|
|---|
| 1522 | self.zapTo()
|
|---|
| 1523 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Zap + Exit":
|
|---|
| 1524 | self.zap()
|
|---|
| 1525 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Search":
|
|---|
| 1526 | self.CoolSearch()
|
|---|
| 1527 | if config.misc.Cool_TV_Guide.Cool_Green.value == "IMDb Search":
|
|---|
| 1528 | self.IMDbSearch()
|
|---|
| 1529 | if config.misc.Cool_TV_Guide.Cool_Green.value == "CoolSwitch":
|
|---|
| 1530 | self.key7()
|
|---|
| 1531 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Channel Info":
|
|---|
| 1532 | self.infoKeyPressed()
|
|---|
| 1533 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Timer":
|
|---|
| 1534 | self.timerAdd()
|
|---|
| 1535 | if config.misc.Cool_TV_Guide.Cool_Green.value == "QuickRec":
|
|---|
| 1536 | self.CoolRecord()
|
|---|
| 1537 | if config.misc.Cool_TV_Guide.Cool_Green.value == "AutoTimer":
|
|---|
| 1538 | self.CoolAutoTimer()
|
|---|
| 1539 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Primetime":
|
|---|
| 1540 | self.key9()
|
|---|
| 1541 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Bouquet +":
|
|---|
| 1542 | self.nextBouquet()
|
|---|
| 1543 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Bouquet -":
|
|---|
| 1544 | self.prevBouquet()
|
|---|
| 1545 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Bouquetlist":
|
|---|
| 1546 | self.CoolBouquetlist()
|
|---|
| 1547 |
|
|---|
| 1548 | def CoolGreenLong(self):
|
|---|
| 1549 | if config.misc.Cool_TV_Guide.Cool_GreenLong.value == "Zap":
|
|---|
| 1550 | self.zapTo()
|
|---|
| 1551 | if config.misc.Cool_TV_Guide.Cool_GreenLong.value == "Zap + Exit":
|
|---|
| 1552 | self.zap()
|
|---|
| 1553 | if config.misc.Cool_TV_Guide.Cool_GreenLong.value == "Search":
|
|---|
| 1554 | self.CoolSearch()
|
|---|
| 1555 | if config.misc.Cool_TV_Guide.Cool_GreenLong.value == "IMDb Search":
|
|---|
| 1556 | self.IMDbSearch()
|
|---|
| 1557 | if config.misc.Cool_TV_Guide.Cool_GreenLong.value == "CoolSwitch":
|
|---|
| 1558 | self.key7()
|
|---|
| 1559 | if config.misc.Cool_TV_Guide.Cool_GreenLong.value == "Channel Info":
|
|---|
| 1560 | self.infoKeyPressed()
|
|---|
| 1561 | if config.misc.Cool_TV_Guide.Cool_GreenLong.value == "Timer":
|
|---|
| 1562 | self.timerAdd()
|
|---|
| 1563 | if config.misc.Cool_TV_Guide.Cool_GreenLong.value == "QuickRec":
|
|---|
| 1564 | self.CoolRecord()
|
|---|
| 1565 | if config.misc.Cool_TV_Guide.Cool_GreenLong.value == "AutoTimer":
|
|---|
| 1566 | self.CoolAutoTimer()
|
|---|
| 1567 | if config.misc.Cool_TV_Guide.Cool_GreenLong.value == "Primetime":
|
|---|
| 1568 | self.key9()
|
|---|
| 1569 | if config.misc.Cool_TV_Guide.Cool_GreenLong.value == "Bouquet +":
|
|---|
| 1570 | self.nextBouquet()
|
|---|
| 1571 | if config.misc.Cool_TV_Guide.Cool_GreenLong.value == "Bouquet -":
|
|---|
| 1572 | self.prevBouquet()
|
|---|
| 1573 | if config.misc.Cool_TV_Guide.Cool_GreenLong.value == "Bouquetlist":
|
|---|
| 1574 | self.CoolBouquetlist()
|
|---|
| 1575 |
|
|---|
| 1576 | def CoolYellow(self):
|
|---|
| 1577 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Zap":
|
|---|
| 1578 | self.zapTo()
|
|---|
| 1579 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Zap + Exit":
|
|---|
| 1580 | self.zap()
|
|---|
| 1581 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Search":
|
|---|
| 1582 | self.CoolSearch()
|
|---|
| 1583 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "IMDb Search":
|
|---|
| 1584 | self.IMDbSearch()
|
|---|
| 1585 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "CoolSwitch":
|
|---|
| 1586 | self.key7()
|
|---|
| 1587 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Channel Info":
|
|---|
| 1588 | self.infoKeyPressed()
|
|---|
| 1589 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Timer":
|
|---|
| 1590 | self.timerAdd()
|
|---|
| 1591 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "QuickRec":
|
|---|
| 1592 | self.CoolRecord()
|
|---|
| 1593 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "AutoTimer":
|
|---|
| 1594 | self.CoolAutoTimer()
|
|---|
| 1595 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Primetime":
|
|---|
| 1596 | self.key9()
|
|---|
| 1597 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Bouquet +":
|
|---|
| 1598 | self.nextBouquet()
|
|---|
| 1599 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Bouquet -":
|
|---|
| 1600 | self.prevBouquet()
|
|---|
| 1601 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Bouquetlist":
|
|---|
| 1602 | self.CoolBouquetlist()
|
|---|
| 1603 |
|
|---|
| 1604 | def CoolYellowLong(self):
|
|---|
| 1605 | if config.misc.Cool_TV_Guide.Cool_YellowLong.value == "Zap":
|
|---|
| 1606 | self.zapTo()
|
|---|
| 1607 | if config.misc.Cool_TV_Guide.Cool_YellowLong.value == "Zap + Exit":
|
|---|
| 1608 | self.zap()
|
|---|
| 1609 | if config.misc.Cool_TV_Guide.Cool_YellowLong.value == "Search":
|
|---|
| 1610 | self.CoolSearch()
|
|---|
| 1611 | if config.misc.Cool_TV_Guide.Cool_YellowLong.value == "IMDb Search":
|
|---|
| 1612 | self.IMDbSearch()
|
|---|
| 1613 | if config.misc.Cool_TV_Guide.Cool_YellowLong.value == "CoolSwitch":
|
|---|
| 1614 | self.key7()
|
|---|
| 1615 | if config.misc.Cool_TV_Guide.Cool_YellowLong.value == "Channel Info":
|
|---|
| 1616 | self.infoKeyPressed()
|
|---|
| 1617 | if config.misc.Cool_TV_Guide.Cool_YellowLong.value == "Timer":
|
|---|
| 1618 | self.timerAdd()
|
|---|
| 1619 | if config.misc.Cool_TV_Guide.Cool_YellowLong.value == "QuickRec":
|
|---|
| 1620 | self.CoolRecord()
|
|---|
| 1621 | if config.misc.Cool_TV_Guide.Cool_YellowLong.value == "AutoTimer":
|
|---|
| 1622 | self.CoolAutoTimer()
|
|---|
| 1623 | if config.misc.Cool_TV_Guide.Cool_YellowLong.value == "Primetime":
|
|---|
| 1624 | self.key9()
|
|---|
| 1625 | if config.misc.Cool_TV_Guide.Cool_YellowLong.value == "Bouquet +":
|
|---|
| 1626 | self.nextBouquet()
|
|---|
| 1627 | if config.misc.Cool_TV_Guide.Cool_YellowLong.value == "Bouquet -":
|
|---|
| 1628 | self.prevBouquet()
|
|---|
| 1629 | if config.misc.Cool_TV_Guide.Cool_YellowLong.value == "Bouquetlist":
|
|---|
| 1630 | self.CoolBouquetlist()
|
|---|
| 1631 |
|
|---|
| 1632 | def CoolBlue(self):
|
|---|
| 1633 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Zap":
|
|---|
| 1634 | self.zapTo()
|
|---|
| 1635 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Zap + Exit":
|
|---|
| 1636 | self.zap()
|
|---|
| 1637 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Search":
|
|---|
| 1638 | self.CoolSearch()
|
|---|
| 1639 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "IMDb Search":
|
|---|
| 1640 | self.IMDbSearch()
|
|---|
| 1641 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "CoolSwitch":
|
|---|
| 1642 | self.key7()
|
|---|
| 1643 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Channel Info":
|
|---|
| 1644 | self.infoKeyPressed()
|
|---|
| 1645 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Timer":
|
|---|
| 1646 | self.timerAdd()
|
|---|
| 1647 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "QuickRec":
|
|---|
| 1648 | self.CoolRecord()
|
|---|
| 1649 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "AutoTimer":
|
|---|
| 1650 | self.CoolAutoTimer()
|
|---|
| 1651 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Primetime":
|
|---|
| 1652 | self.key9()
|
|---|
| 1653 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Bouquet +":
|
|---|
| 1654 | self.nextBouquet()
|
|---|
| 1655 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Bouquet -":
|
|---|
| 1656 | self.prevBouquet()
|
|---|
| 1657 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Bouquetlist":
|
|---|
| 1658 | self.CoolBouquetlist()
|
|---|
| 1659 |
|
|---|
| 1660 | def CoolBlueLong(self):
|
|---|
| 1661 | if config.misc.Cool_TV_Guide.Cool_BlueLong.value == "Zap":
|
|---|
| 1662 | self.zapTo()
|
|---|
| 1663 | if config.misc.Cool_TV_Guide.Cool_BlueLong.value == "Zap + Exit":
|
|---|
| 1664 | self.zap()
|
|---|
| 1665 | if config.misc.Cool_TV_Guide.Cool_BlueLong.value == "Search":
|
|---|
| 1666 | self.CoolSearch()
|
|---|
| 1667 | if config.misc.Cool_TV_Guide.Cool_BlueLong.value == "IMDb Search":
|
|---|
| 1668 | self.IMDbSearch()
|
|---|
| 1669 | if config.misc.Cool_TV_Guide.Cool_BlueLong.value == "CoolSwitch":
|
|---|
| 1670 | self.key7()
|
|---|
| 1671 | if config.misc.Cool_TV_Guide.Cool_BlueLong.value == "Channel Info":
|
|---|
| 1672 | self.infoKeyPressed()
|
|---|
| 1673 | if config.misc.Cool_TV_Guide.Cool_BlueLong.value == "Timer":
|
|---|
| 1674 | self.timerAdd()
|
|---|
| 1675 | if config.misc.Cool_TV_Guide.Cool_BlueLong.value == "QuickRec":
|
|---|
| 1676 | self.CoolRecord()
|
|---|
| 1677 | if config.misc.Cool_TV_Guide.Cool_BlueLong.value == "AutoTimer":
|
|---|
| 1678 | self.CoolAutoTimer()
|
|---|
| 1679 | if config.misc.Cool_TV_Guide.Cool_BlueLong.value == "Primetime":
|
|---|
| 1680 | self.key9()
|
|---|
| 1681 | if config.misc.Cool_TV_Guide.Cool_BlueLong.value == "Bouquet +":
|
|---|
| 1682 | self.nextBouquet()
|
|---|
| 1683 | if config.misc.Cool_TV_Guide.Cool_BlueLong.value == "Bouquet -":
|
|---|
| 1684 | self.prevBouquet()
|
|---|
| 1685 | if config.misc.Cool_TV_Guide.Cool_BlueLong.value == "Bouquetlist":
|
|---|
| 1686 | self.CoolBouquetlist()
|
|---|
| 1687 |
|
|---|
| 1688 | def CoolOK(self):
|
|---|
| 1689 | if config.misc.Cool_TV_Guide.Cool_OK.value == "Zap":
|
|---|
| 1690 | self.zapTo()
|
|---|
| 1691 | if config.misc.Cool_TV_Guide.Cool_OK.value == "Zap + Exit":
|
|---|
| 1692 | self.zap()
|
|---|
| 1693 | if config.misc.Cool_TV_Guide.Cool_OK.value == "Search":
|
|---|
| 1694 | self.CoolSearch()
|
|---|
| 1695 | if config.misc.Cool_TV_Guide.Cool_OK.value == "IMDb Search":
|
|---|
| 1696 | self.IMDbSearch()
|
|---|
| 1697 | if config.misc.Cool_TV_Guide.Cool_OK.value == "CoolSwitch":
|
|---|
| 1698 | self.key7()
|
|---|
| 1699 | if config.misc.Cool_TV_Guide.Cool_OK.value == "Channel Info":
|
|---|
| 1700 | self.infoKeyPressed()
|
|---|
| 1701 | if config.misc.Cool_TV_Guide.Cool_OK.value == "Timer":
|
|---|
| 1702 | self.timerAdd()
|
|---|
| 1703 | if config.misc.Cool_TV_Guide.Cool_OK.value == "QuickRec":
|
|---|
| 1704 | self.CoolRecord()
|
|---|
| 1705 | if config.misc.Cool_TV_Guide.Cool_OK.value == "AutoTimer":
|
|---|
| 1706 | self.CoolAutoTimer()
|
|---|
| 1707 | if config.misc.Cool_TV_Guide.Cool_OK.value == "Primetime":
|
|---|
| 1708 | self.key9()
|
|---|
| 1709 | if config.misc.Cool_TV_Guide.Cool_OK.value == "Bouquet +":
|
|---|
| 1710 | self.nextBouquet()
|
|---|
| 1711 | if config.misc.Cool_TV_Guide.Cool_OK.value == "Bouquet -":
|
|---|
| 1712 | self.prevBouquet()
|
|---|
| 1713 | if config.misc.Cool_TV_Guide.Cool_OK.value == "Bouquetlist":
|
|---|
| 1714 | self.CoolBouquetlist()
|
|---|
| 1715 |
|
|---|
| 1716 | def CoolOKLong(self):
|
|---|
| 1717 | if config.misc.Cool_TV_Guide.Cool_OKLong.value == "Zap":
|
|---|
| 1718 | self.zapTo()
|
|---|
| 1719 | if config.misc.Cool_TV_Guide.Cool_OKLong.value == "Zap + Exit":
|
|---|
| 1720 | self.zap()
|
|---|
| 1721 | if config.misc.Cool_TV_Guide.Cool_OKLong.value == "Search":
|
|---|
| 1722 | self.CoolSearch()
|
|---|
| 1723 | if config.misc.Cool_TV_Guide.Cool_OKLong.value == "IMDb Search":
|
|---|
| 1724 | self.IMDbSearch()
|
|---|
| 1725 | if config.misc.Cool_TV_Guide.Cool_OKLong.value == "CoolSwitch":
|
|---|
| 1726 | self.key7()
|
|---|
| 1727 | if config.misc.Cool_TV_Guide.Cool_OKLong.value == "Channel Info":
|
|---|
| 1728 | self.infoKeyPressed()
|
|---|
| 1729 | if config.misc.Cool_TV_Guide.Cool_OKLong.value == "Timer":
|
|---|
| 1730 | self.timerAdd()
|
|---|
| 1731 | if config.misc.Cool_TV_Guide.Cool_OKLong.value == "QuickRec":
|
|---|
| 1732 | self.CoolRecord()
|
|---|
| 1733 | if config.misc.Cool_TV_Guide.Cool_OKLong.value == "AutoTimer":
|
|---|
| 1734 | self.CoolAutoTimer()
|
|---|
| 1735 | if config.misc.Cool_TV_Guide.Cool_OKLong.value == "Primetime":
|
|---|
| 1736 | self.key9()
|
|---|
| 1737 | if config.misc.Cool_TV_Guide.Cool_OKLong.value == "Bouquet +":
|
|---|
| 1738 | self.nextBouquet()
|
|---|
| 1739 | if config.misc.Cool_TV_Guide.Cool_OKLong.value == "Bouquet -":
|
|---|
| 1740 | self.prevBouquet()
|
|---|
| 1741 | if config.misc.Cool_TV_Guide.Cool_OKLong.value == "Bouquetlist":
|
|---|
| 1742 | self.CoolBouquetlist()
|
|---|
| 1743 |
|
|---|
| 1744 | def CoolInfo(self):
|
|---|
| 1745 | if config.misc.Cool_TV_Guide.Cool_Info.value == "Cool Single Guide":
|
|---|
| 1746 | self.OpenCoolSingleGuide()
|
|---|
| 1747 | if config.misc.Cool_TV_Guide.Cool_Info.value == "Cool TV<>Multi Guide":
|
|---|
| 1748 | self.CoolMultiGuide()
|
|---|
| 1749 | if config.misc.Cool_TV_Guide.Cool_Info.value == "View Single EPG":
|
|---|
| 1750 | self.OpenSingleEPG()
|
|---|
| 1751 | if config.misc.Cool_TV_Guide.Cool_Info.value == "Channel Info":
|
|---|
| 1752 | self.infoKeyPressed()
|
|---|
| 1753 |
|
|---|
| 1754 | def CoolInfoLong(self):
|
|---|
| 1755 | if config.misc.Cool_TV_Guide.Cool_InfoLong.value == "Cool Single Guide":
|
|---|
| 1756 | self.OpenCoolSingleGuide()
|
|---|
| 1757 | if config.misc.Cool_TV_Guide.Cool_InfoLong.value == "Cool TV<>Multi Guide":
|
|---|
| 1758 | self.CoolMultiGuide()
|
|---|
| 1759 | if config.misc.Cool_TV_Guide.Cool_InfoLong.value == "View Single EPG":
|
|---|
| 1760 | self.OpenSingleEPG()
|
|---|
| 1761 | if config.misc.Cool_TV_Guide.Cool_InfoLong.value == "Channel Info":
|
|---|
| 1762 | self.infoKeyPressed()
|
|---|
| 1763 |
|
|---|
| 1764 | def nextBouquet(self):
|
|---|
| 1765 | if self.bouquetChangeCB:
|
|---|
| 1766 | self.bouquetChangeCB(1, self)
|
|---|
| 1767 |
|
|---|
| 1768 | def prevBouquet(self):
|
|---|
| 1769 | if self.bouquetChangeCB:
|
|---|
| 1770 | self.bouquetChangeCB(-1, self)
|
|---|
| 1771 |
|
|---|
| 1772 | def CoolBouquetlist(self):
|
|---|
| 1773 | global bouquetSel
|
|---|
| 1774 | bouquetSel = Session.openWithCallback(closed, BouquetSelector, bouquets, openBouquetEPG, enableWrapAround=True)
|
|---|
| 1775 | dlg_stack.append(bouquetSel)
|
|---|
| 1776 |
|
|---|
| 1777 | def enterDateTime(self):
|
|---|
| 1778 | self.session.openWithCallback(self.onDateTimeInputClosed, TimeDateInput, config.misc.Cool_TV_Guide.prev_time )
|
|---|
| 1779 |
|
|---|
| 1780 | def onDateTimeInputClosed(self, ret):
|
|---|
| 1781 | if len(ret) > 1:
|
|---|
| 1782 | if ret[0]:
|
|---|
| 1783 | self.ask_time=ret[1]
|
|---|
| 1784 | l = self["list"]
|
|---|
| 1785 | l.resetOffset()
|
|---|
| 1786 | l.fillCoolTVGuide(self.services, ret[1])
|
|---|
| 1787 | self.moveTimeLines(True)
|
|---|
| 1788 |
|
|---|
| 1789 | def showSetup(self):
|
|---|
| 1790 | self.session.openWithCallback(self.onSetupClose, CoolTVGuideSetup )
|
|---|
| 1791 |
|
|---|
| 1792 | def onSetupClose(self):
|
|---|
| 1793 | l = self["list"]
|
|---|
| 1794 | l.setItemsPerPage()
|
|---|
| 1795 | l.setEventFontsize()
|
|---|
| 1796 | l.setEpoch(config.misc.Cool_TV_Guide.prev_time_period.value)
|
|---|
| 1797 | l.setOverjump_Empty(config.misc.Cool_TV_Guide.overjump.value)
|
|---|
| 1798 | self.moveTimeLines()
|
|---|
| 1799 | self["key_red"].setText(config.misc.Cool_TV_Guide.Cool_Red.value)
|
|---|
| 1800 | self["key_green"].setText(config.misc.Cool_TV_Guide.Cool_Green.value)
|
|---|
| 1801 | self["key_yellow"].setText(config.misc.Cool_TV_Guide.Cool_Yellow.value)
|
|---|
| 1802 | self["key_blue"].setText(config.misc.Cool_TV_Guide.Cool_Blue.value)
|
|---|
| 1803 |
|
|---|
| 1804 | def CoolClose(self):
|
|---|
| 1805 | self.closeRecursive = True
|
|---|
| 1806 | ref = self["list"].getCurrent()[1]
|
|---|
| 1807 | if ref:
|
|---|
| 1808 | self.closeScreen()
|
|---|
| 1809 |
|
|---|
| 1810 | def closeScreen(self):
|
|---|
| 1811 | config.misc.Cool_TV_Guide.save()
|
|---|
| 1812 | self.close(self.closeRecursive)
|
|---|
| 1813 |
|
|---|
| 1814 | def infoKeyPressed(self):
|
|---|
| 1815 | cur = self["list"].getCurrent()
|
|---|
| 1816 | event = cur[0]
|
|---|
| 1817 | service = cur[1]
|
|---|
| 1818 | if event is not None:
|
|---|
| 1819 | self.session.open(CoolViewSimple, event, service, self.eventViewCallback, self.openSimilarList)
|
|---|
| 1820 |
|
|---|
| 1821 | def openSimilarList(self, eventid, refstr):
|
|---|
| 1822 | self.session.open(EPGSelection, refstr, None, eventid)
|
|---|
| 1823 |
|
|---|
| 1824 | def setServices(self, services):
|
|---|
| 1825 | self.services = services
|
|---|
| 1826 | self.onCreate()
|
|---|
| 1827 |
|
|---|
| 1828 | def onCreate(self):
|
|---|
| 1829 | self["list"].curr_refcool = self.session.nav.getCurrentlyPlayingServiceReference()
|
|---|
| 1830 | self["list"].fillCoolTVGuide(self.services, self.ask_time)
|
|---|
| 1831 | self["list"].moveToService(self.session.nav.getCurrentlyPlayingServiceReference())
|
|---|
| 1832 | self.moveTimeLines()
|
|---|
| 1833 | if config.misc.Cool_TV_Guide.channel1.value == "Yes":
|
|---|
| 1834 | self["list"].instance.moveSelectionTo(0)
|
|---|
| 1835 |
|
|---|
| 1836 | def eventViewCallback(self, setEvent, setService, val):
|
|---|
| 1837 | l = self["list"]
|
|---|
| 1838 | old = l.getCurrent()
|
|---|
| 1839 | self.updEvent(val, False)
|
|---|
| 1840 | cur = l.getCurrent()
|
|---|
| 1841 | if cur[0] is None and cur[1].ref != old[1].ref:
|
|---|
| 1842 | self.eventViewCallback(setEvent, setService, val)
|
|---|
| 1843 | else:
|
|---|
| 1844 | setService(cur[1])
|
|---|
| 1845 | setEvent(cur[0])
|
|---|
| 1846 |
|
|---|
| 1847 | def zapTo(self):
|
|---|
| 1848 | if self.zapFunc:
|
|---|
| 1849 | self.closeRecursive = True
|
|---|
| 1850 | ref = self["list"].getCurrent()[1]
|
|---|
| 1851 | self["list"].curr_refcool = ref.ref
|
|---|
| 1852 | self["list"].fillCoolTVGuide(None)
|
|---|
| 1853 | if ref:
|
|---|
| 1854 | self.zapFunc(ref.ref)
|
|---|
| 1855 |
|
|---|
| 1856 | def zap(self):
|
|---|
| 1857 | if self.zapFunc :
|
|---|
| 1858 | self.closeRecursive = True
|
|---|
| 1859 | ref = self["list"].getCurrent()[1]
|
|---|
| 1860 | if ref:
|
|---|
| 1861 | self.zapFunc(ref.ref)
|
|---|
| 1862 | self.closeScreen()
|
|---|
| 1863 |
|
|---|
| 1864 | def eventSelected(self):
|
|---|
| 1865 | self.infoKeyPressed()
|
|---|
| 1866 |
|
|---|
| 1867 | def removeTimer(self, timer):
|
|---|
| 1868 | timer.afterEvent = AFTEREVENT.NONE
|
|---|
| 1869 | self.session.nav.RecordTimer.removeEntry(timer)
|
|---|
| 1870 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Timer":
|
|---|
| 1871 | self["key_red"].setText(_("Add timer"))
|
|---|
| 1872 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Timer":
|
|---|
| 1873 | self["key_green"].setText(_("Add timer"))
|
|---|
| 1874 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Timer":
|
|---|
| 1875 | self["key_yellow"].setText(_("Add timer"))
|
|---|
| 1876 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Timer":
|
|---|
| 1877 | self["key_blue"].setText(_("Add timer"))
|
|---|
| 1878 | self.key_green_choice = self.ADD_TIMER
|
|---|
| 1879 |
|
|---|
| 1880 | def timerAdd(self):
|
|---|
| 1881 | cur = self["list"].getCurrent()
|
|---|
| 1882 | event = cur[0]
|
|---|
| 1883 | serviceref = cur[1]
|
|---|
| 1884 | if event is None:
|
|---|
| 1885 | return
|
|---|
| 1886 | eventid = event.getEventId()
|
|---|
| 1887 | refstr = serviceref.ref.toString()
|
|---|
| 1888 | for timer in self.session.nav.RecordTimer.timer_list:
|
|---|
| 1889 | if timer.eit == eventid and timer.service_ref.ref.toString() == refstr:
|
|---|
| 1890 | cb_func = lambda ret : not ret or self.removeTimer(timer)
|
|---|
| 1891 | self.session.openWithCallback(cb_func, MessageBox, _("Do you really want to delete %s?") % event.getEventName())
|
|---|
| 1892 | break
|
|---|
| 1893 | else:
|
|---|
| 1894 | newEntry = RecordTimerEntry(serviceref, checkOldTimers = True, *parseEvent(event))
|
|---|
| 1895 | self.session.openWithCallback(self.finishedAdd, TimerEntry, newEntry)
|
|---|
| 1896 |
|
|---|
| 1897 | def finishedAdd(self, answer):
|
|---|
| 1898 | print "finished add"
|
|---|
| 1899 | if answer[0]:
|
|---|
| 1900 | entry = answer[1]
|
|---|
| 1901 | simulTimerList = self.session.nav.RecordTimer.record(entry)
|
|---|
| 1902 | if simulTimerList is not None:
|
|---|
| 1903 | for x in simulTimerList:
|
|---|
| 1904 | if x.setAutoincreaseEnd(entry):
|
|---|
| 1905 | self.session.nav.RecordTimer.timeChanged(x)
|
|---|
| 1906 | simulTimerList = self.session.nav.RecordTimer.record(entry)
|
|---|
| 1907 | if simulTimerList is not None:
|
|---|
| 1908 | self.session.openWithCallback(self.finishSanityCorrection, TimerSanityConflict, simulTimerList)
|
|---|
| 1909 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Timer":
|
|---|
| 1910 | self["key_red"].setText(_("Remove timer"))
|
|---|
| 1911 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Timer":
|
|---|
| 1912 | self["key_green"].setText(_("Remove timer"))
|
|---|
| 1913 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Timer":
|
|---|
| 1914 | self["key_yellow"].setText(_("Remove timer"))
|
|---|
| 1915 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Timer":
|
|---|
| 1916 | self["key_blue"].setText(_("Remove timer"))
|
|---|
| 1917 | self.key_green_choice = self.REMOVE_TIMER
|
|---|
| 1918 | else:
|
|---|
| 1919 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Timer":
|
|---|
| 1920 | self["key_red"].setText(_("Add timer"))
|
|---|
| 1921 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Timer":
|
|---|
| 1922 | self["key_green"].setText(_("Add timer"))
|
|---|
| 1923 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Timer":
|
|---|
| 1924 | self["key_yellow"].setText(_("Add timer"))
|
|---|
| 1925 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Timer":
|
|---|
| 1926 | self["key_blue"].setText(_("Add timer"))
|
|---|
| 1927 | self.key_green_choice = self.ADD_TIMER
|
|---|
| 1928 | print "Timeredit aborted"
|
|---|
| 1929 |
|
|---|
| 1930 | def finishSanityCorrection(self, answer):
|
|---|
| 1931 | self.finishedAdd(answer)
|
|---|
| 1932 |
|
|---|
| 1933 | def onSelectionChanged(self):
|
|---|
| 1934 | cur = self["list"].getCurrent()
|
|---|
| 1935 | if cur is None:
|
|---|
| 1936 | if self.key_green_choice != self.EMPTY:
|
|---|
| 1937 | self["key_green"].setText("")
|
|---|
| 1938 | self.key_green_choice = self.EMPTY
|
|---|
| 1939 | if self.key_red_choice != self.EMPTY:
|
|---|
| 1940 | self["key_red"].setText("")
|
|---|
| 1941 | self.key_red_choice = self.EMPTY
|
|---|
| 1942 | if self.key_yellow_choice != self.EMPTY:
|
|---|
| 1943 | self["key_yellow"].setText("")
|
|---|
| 1944 | self.key_yellow_choice = self.EMPTY
|
|---|
| 1945 | if self.key_blue_choice != self.EMPTY:
|
|---|
| 1946 | self["key_blue"].setText("")
|
|---|
| 1947 | self.key_blue_choice = self.EMPTY
|
|---|
| 1948 | return
|
|---|
| 1949 |
|
|---|
| 1950 | event = cur[0]
|
|---|
| 1951 | self["Event"].newEvent(event)
|
|---|
| 1952 | count = self["list"].getCurrentChangeCount()
|
|---|
| 1953 | days = [ _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun") ]
|
|---|
| 1954 | datestr = ""
|
|---|
| 1955 | if event is not None:
|
|---|
| 1956 | now = time()
|
|---|
| 1957 | beg = event.getBeginTime()
|
|---|
| 1958 | nowTime = localtime(now)
|
|---|
| 1959 | begTime = localtime(beg)
|
|---|
| 1960 | if nowTime[2] != begTime[2]:
|
|---|
| 1961 | datestr = '%s %d.%d.'%(days[begTime[6]], begTime[2], begTime[1])
|
|---|
| 1962 | else:
|
|---|
| 1963 | datestr = '%s %d.%d.'%(_("Today"), begTime[2], begTime[1])
|
|---|
| 1964 | self["date"].setText(datestr)
|
|---|
| 1965 |
|
|---|
| 1966 | if cur[1] is None or cur[1].getServiceName() == "":
|
|---|
| 1967 | if self.key_green_choice != self.EMPTY:
|
|---|
| 1968 | self["key_green"].setText("")
|
|---|
| 1969 | self.key_green_choice = self.EMPTY
|
|---|
| 1970 | if self.key_red_choice != self.EMPTY:
|
|---|
| 1971 | self["key_red"].setText("")
|
|---|
| 1972 | self.key_red_choice = self.EMPTY
|
|---|
| 1973 | if self.key_yellow_choice != self.EMPTY:
|
|---|
| 1974 | self["key_yellow"].setText("")
|
|---|
| 1975 | self.key_yellow_choice = self.EMPTY
|
|---|
| 1976 | if self.key_blue_choice != self.EMPTY:
|
|---|
| 1977 | self["key_blue"].setText("")
|
|---|
| 1978 | self.key_blue_choice = self.EMPTY
|
|---|
| 1979 | return
|
|---|
| 1980 |
|
|---|
| 1981 | if not event:
|
|---|
| 1982 | if self.key_green_choice != self.EMPTY:
|
|---|
| 1983 | self["key_green"].setText("")
|
|---|
| 1984 | self.key_green_choice = self.EMPTY
|
|---|
| 1985 | return
|
|---|
| 1986 |
|
|---|
| 1987 | serviceref = cur[1]
|
|---|
| 1988 | eventid = event.getEventId()
|
|---|
| 1989 | refstr = serviceref.ref.toString()
|
|---|
| 1990 | isRecordEvent = False
|
|---|
| 1991 |
|
|---|
| 1992 | for timer in self.session.nav.RecordTimer.timer_list:
|
|---|
| 1993 | if timer.eit == eventid and timer.service_ref.ref.toString() == refstr:
|
|---|
| 1994 | isRecordEvent = True
|
|---|
| 1995 | break
|
|---|
| 1996 | if isRecordEvent and self.key_green_choice != self.REMOVE_TIMER:
|
|---|
| 1997 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Timer":
|
|---|
| 1998 | self["key_red"].setText(_("Remove timer"))
|
|---|
| 1999 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Timer":
|
|---|
| 2000 | self["key_green"].setText(_("Remove timer"))
|
|---|
| 2001 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Timer":
|
|---|
| 2002 | self["key_yellow"].setText(_("Remove timer"))
|
|---|
| 2003 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Timer":
|
|---|
| 2004 | self["key_blue"].setText(_("Remove timer"))
|
|---|
| 2005 | self.key_green_choice = self.REMOVE_TIMER
|
|---|
| 2006 | elif not isRecordEvent and self.key_green_choice != self.ADD_TIMER:
|
|---|
| 2007 | if config.misc.Cool_TV_Guide.Cool_Red.value == "Timer":
|
|---|
| 2008 | self["key_red"].setText(_("Add timer"))
|
|---|
| 2009 | if config.misc.Cool_TV_Guide.Cool_Green.value == "Timer":
|
|---|
| 2010 | self["key_green"].setText(_("Add timer"))
|
|---|
| 2011 | if config.misc.Cool_TV_Guide.Cool_Yellow.value == "Timer":
|
|---|
| 2012 | self["key_yellow"].setText(_("Add timer"))
|
|---|
| 2013 | if config.misc.Cool_TV_Guide.Cool_Blue.value == "Timer":
|
|---|
| 2014 | self["key_blue"].setText(_("Add timer"))
|
|---|
| 2015 | self.key_green_choice = self.ADD_TIMER
|
|---|
| 2016 |
|
|---|
| 2017 | def moveTimeLines(self, force=False):
|
|---|
| 2018 | self.updateTimelineTimer.start((60-(int(time())%60))*1000) #keep syncronised
|
|---|
| 2019 | l = self["list"]
|
|---|
| 2020 | event_rect = l.getEventRect()
|
|---|
| 2021 | time_epoch = l.getTimeEpoch()
|
|---|
| 2022 | time_base = l.getTimeBase()
|
|---|
| 2023 | if event_rect is None or time_epoch is None or time_base is None:
|
|---|
| 2024 | return
|
|---|
| 2025 | time_steps = time_epoch > 180 and 60 or 30
|
|---|
| 2026 |
|
|---|
| 2027 | num_lines = time_epoch/time_steps
|
|---|
| 2028 | incWidth=event_rect.width()/num_lines
|
|---|
| 2029 | pos=event_rect.left()
|
|---|
| 2030 | timeline_entries = [ ]
|
|---|
| 2031 | x = 0
|
|---|
| 2032 | changecount = 0
|
|---|
| 2033 |
|
|---|
| 2034 | for line in self.time_lines:
|
|---|
| 2035 | old_pos = line.position
|
|---|
| 2036 | new_pos = (x == num_lines and event_rect.left()+event_rect.width() or pos, old_pos[1])
|
|---|
| 2037 | if not x or x >= num_lines:
|
|---|
| 2038 | line.visible = False
|
|---|
| 2039 | else:
|
|---|
| 2040 | if old_pos != new_pos:
|
|---|
| 2041 | line.setPosition(new_pos[0], new_pos[1])
|
|---|
| 2042 | changecount += 1
|
|---|
| 2043 | line.visible = True
|
|---|
| 2044 | if not x or line.visible:
|
|---|
| 2045 | timeline_entries.append((time_base + x * time_steps * 60, new_pos[0]))
|
|---|
| 2046 | x += 1
|
|---|
| 2047 | pos += incWidth
|
|---|
| 2048 |
|
|---|
| 2049 | if changecount or force:
|
|---|
| 2050 | self["timeline_text"].setEntries(timeline_entries)
|
|---|
| 2051 |
|
|---|
| 2052 | now=time()
|
|---|
| 2053 | timeline_now = self["timeline_now"]
|
|---|
| 2054 | if now >= time_base and now < (time_base + time_epoch * 60):
|
|---|
| 2055 | xpos = int((((now - time_base) * event_rect.width()) / (time_epoch * 60))-(timeline_now.instance.size().width()/2))
|
|---|
| 2056 | old_pos = timeline_now.position
|
|---|
| 2057 | new_pos = (xpos+event_rect.left(), old_pos[1])
|
|---|
| 2058 | if old_pos != new_pos:
|
|---|
| 2059 | timeline_now.setPosition(new_pos[0], new_pos[1])
|
|---|
| 2060 | timeline_now.visible = True
|
|---|
| 2061 | else:
|
|---|
| 2062 | timeline_now.visible = False
|
|---|
| 2063 |
|
|---|
| 2064 | l.l.invalidate()
|
|---|
| 2065 |
|
|---|
| 2066 |
|
|---|
| 2067 | class CoolTVGuideSetup(Screen, ConfigListScreen):
|
|---|
| 2068 |
|
|---|
| 2069 | def __init__(self, session, args = None):
|
|---|
| 2070 | Screen.__init__(self, session)
|
|---|
| 2071 | self.setup_title = _("Cool TV Guide Settings")
|
|---|
| 2072 | skinpath = str(resolveFilename)
|
|---|
| 2073 | self.skinName = "CoolTVGuideSetup"
|
|---|
| 2074 | skin = "/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSkin/CoolTVGuideSetup.xml"
|
|---|
| 2075 | Cool = open(skin)
|
|---|
| 2076 | self.skin = Cool.read()
|
|---|
| 2077 | Cool.close()
|
|---|
| 2078 |
|
|---|
| 2079 | self["actions"] = ActionMap(["SetupActions", "HelpActions"],
|
|---|
| 2080 | {
|
|---|
| 2081 | "ok": self.keySave,
|
|---|
| 2082 | "save": self.keySave,
|
|---|
| 2083 | "cancel": self.keyCancel,
|
|---|
| 2084 | "red": self.keyCancel,
|
|---|
| 2085 | "green": self.keySave,
|
|---|
| 2086 | "displayHelp": self.myhelp,
|
|---|
| 2087 | }, -1)
|
|---|
| 2088 |
|
|---|
| 2089 | self["oktext"] = Label(_("OK"))
|
|---|
| 2090 | self["canceltext"] = Label(_("Cancel"))
|
|---|
| 2091 | self["key_red"] = Button(_("Cancel"))
|
|---|
| 2092 | self["key_green"] = Button(_("Save"))
|
|---|
| 2093 | self.onChangedEntry = [ ]
|
|---|
| 2094 | self.session = session
|
|---|
| 2095 | self.list = []
|
|---|
| 2096 | ConfigListScreen.__init__(self, self.list, session = self.session)
|
|---|
| 2097 | self.createSetup()
|
|---|
| 2098 |
|
|---|
| 2099 | def myhelp(self):
|
|---|
| 2100 | self.session.open(CoolTVGuideHelp, "/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/help.jpg")
|
|---|
| 2101 |
|
|---|
| 2102 | def createSetup(self):
|
|---|
| 2103 | print "Creating Cool TV Guide Setup"
|
|---|
| 2104 | self.list = [ ]
|
|---|
| 2105 |
|
|---|
| 2106 | self.list.append(getConfigListEntry(_("Cool 3D"), config.misc.Cool_TV_Guide.Cool3D))
|
|---|
| 2107 | self.list.append(getConfigListEntry(_("Load Picon (Yes) (need restart)"), config.misc.Cool_TV_Guide.CoolPiconON))
|
|---|
| 2108 | self.list.append(getConfigListEntry(_("Load CoolPico (Yes) (need restart)"), config.misc.Cool_TV_Guide.CoolPicoON))
|
|---|
| 2109 | self.list.append(getConfigListEntry(_("Start View 60 , 30 (60)"), config.misc.Cool_TV_Guide.coolswitch))
|
|---|
| 2110 | self.list.append(getConfigListEntry(_("Picon Height (60), (54), (54)"), config.misc.Cool_TV_Guide.PiconHeight))
|
|---|
| 2111 | self.list.append(getConfigListEntry(_("Picon Item Height (60), (54), (54)"), config.misc.Cool_TV_Guide.PiconItemHeight))
|
|---|
| 2112 | self.list.append(getConfigListEntry(_("CoolPico Height (30), (27), (27)"), config.misc.Cool_TV_Guide.CoolPicoHeight))
|
|---|
| 2113 | self.list.append(getConfigListEntry(_("CoolPico Item Height (30), (27), (27)"), config.misc.Cool_TV_Guide.CoolPicoItemHeight))
|
|---|
| 2114 | self.list.append(getConfigListEntry(_("Left Width for 60 Height (110), (75), (75)"), config.misc.Cool_TV_Guide.cool_left8))
|
|---|
| 2115 | self.list.append(getConfigListEntry(_("Left Width for 30 Height (190), (110), (110)"), config.misc.Cool_TV_Guide.cool_left16))
|
|---|
| 2116 | self.list.append(getConfigListEntry(_("Channel 1 at Start (No)"), config.misc.Cool_TV_Guide.channel1))
|
|---|
| 2117 |
|
|---|
| 2118 | self.list.append(getConfigListEntry(_("----------"), config.misc.Cool_TV_Guide.cool_BlankLine))
|
|---|
| 2119 |
|
|---|
| 2120 | self.list.append(getConfigListEntry(_("Red Button (Zap)"), config.misc.Cool_TV_Guide.Cool_Red))
|
|---|
| 2121 | self.list.append(getConfigListEntry(_("LongRed Button (ZAP+Exit)"), config.misc.Cool_TV_Guide.Cool_RedLong))
|
|---|
| 2122 | self.list.append(getConfigListEntry(_("Green Button (Timer)"), config.misc.Cool_TV_Guide.Cool_Green))
|
|---|
| 2123 | self.list.append(getConfigListEntry(_("LongGreen Button (Autotimer)"), config.misc.Cool_TV_Guide.Cool_GreenLong))
|
|---|
| 2124 | self.list.append(getConfigListEntry(_("Yellow Button (CoolSwitch)"), config.misc.Cool_TV_Guide.Cool_Yellow))
|
|---|
| 2125 | self.list.append(getConfigListEntry(_("LongYellow Button (Bouquetlist)"), config.misc.Cool_TV_Guide.Cool_YellowLong))
|
|---|
| 2126 | self.list.append(getConfigListEntry(_("Blue Button (Search)"), config.misc.Cool_TV_Guide.Cool_Blue))
|
|---|
| 2127 | self.list.append(getConfigListEntry(_("LongBlue Button (IMDb Search)"), config.misc.Cool_TV_Guide.Cool_BlueLong))
|
|---|
| 2128 | self.list.append(getConfigListEntry(_("OK Button (Channel Info)"), config.misc.Cool_TV_Guide.Cool_OK))
|
|---|
| 2129 | self.list.append(getConfigListEntry(_("LongOK Button"), config.misc.Cool_TV_Guide.Cool_OKLong))
|
|---|
| 2130 | self.list.append(getConfigListEntry(_("Info Button (Cool Single Guide)"), config.misc.Cool_TV_Guide.Cool_Info))
|
|---|
| 2131 | self.list.append(getConfigListEntry(_("LongInfo Button (Cool TV<>Multi Guide)"), config.misc.Cool_TV_Guide.Cool_InfoLong))
|
|---|
| 2132 |
|
|---|
| 2133 | self.list.append(getConfigListEntry(_("----------"), config.misc.Cool_TV_Guide.cool_BlankLine))
|
|---|
| 2134 |
|
|---|
| 2135 | self.list.append(getConfigListEntry(_("Cool Primetime (20) hour"), config.misc.Cool_TV_Guide.CoolPrimetime1))
|
|---|
| 2136 | self.list.append(getConfigListEntry(_("Cool Primetime (00) minute"), config.misc.Cool_TV_Guide.CoolPrimetime2))
|
|---|
| 2137 |
|
|---|
| 2138 | self.list.append(getConfigListEntry(_("----------"), config.misc.Cool_TV_Guide.cool_BlankLine))
|
|---|
| 2139 |
|
|---|
| 2140 | self.list.append(getConfigListEntry(_("Event Fontsize (18), (15), (15)"), config.misc.Cool_TV_Guide.Cool_Fontsize))
|
|---|
| 2141 | self.list.append(getConfigListEntry(_("Left Fontsize (22), (18), (16) (need restart)"), config.misc.Cool_TV_Guide.Cool_Left_Fontsize))
|
|---|
| 2142 | self.list.append(getConfigListEntry(_("Timeline Fontsize (20), (18), (16) (need restart)"), config.misc.Cool_TV_Guide.Cool_Timeline))
|
|---|
| 2143 |
|
|---|
| 2144 | self.list.append(getConfigListEntry(_("Time Scale (180)"), config.misc.Cool_TV_Guide.prev_time_period))
|
|---|
| 2145 |
|
|---|
| 2146 | self.list.append(getConfigListEntry(_("----------"), config.misc.Cool_TV_Guide.cool_BlankLine))
|
|---|
| 2147 |
|
|---|
| 2148 | self.list.append(getConfigListEntry(_("chance folder picon ==> coolpicon (needs fullrestart)"), config.misc.Cool_TV_Guide.CoolPiconPath))
|
|---|
| 2149 | self.list.append(getConfigListEntry(_("chance folder picon/coolpico ==> coolpicon/coolpico"), config.misc.Cool_TV_Guide.CoolPicoPath))
|
|---|
| 2150 | self.list.append(getConfigListEntry(_("Bouquet at Start (No)"), config.misc.Cool_TV_Guide.autostart_bouquet))
|
|---|
| 2151 | self.list.append(getConfigListEntry(_("Skip Empty Services (false) (need restart)"), config.misc.Cool_TV_Guide.overjump))
|
|---|
| 2152 |
|
|---|
| 2153 | self["config"].list = self.list
|
|---|
| 2154 | self["config"].l.setList(self.list)
|
|---|
| 2155 |
|
|---|
| 2156 |
|
|---|
| 2157 | class CoolTVGuideHelp(Screen):
|
|---|
| 2158 | if (getDesktop(0).size().width()) == 720:
|
|---|
| 2159 | skin="""
|
|---|
| 2160 | <screen flags="wfNoBorder" position="0,0" size="720,576" title="..Help.." backgroundColor="#ffffffff">
|
|---|
| 2161 | <widget name="Picture" position="0,0" size="720,576" zPosition="1"/>
|
|---|
| 2162 | </screen>"""
|
|---|
| 2163 | elif (getDesktop(0).size().width()) == 1024:
|
|---|
| 2164 | skin="""
|
|---|
| 2165 | <screen flags="wfNoBorder" position="0,0" size="1024,576" title="..Help.." backgroundColor="#ffffffff">
|
|---|
| 2166 | <widget name="Picture" position="0,0" size="1024,576" zPosition="1"/>
|
|---|
| 2167 | </screen>"""
|
|---|
| 2168 | else:
|
|---|
| 2169 | skin="""
|
|---|
| 2170 | <screen flags="wfNoBorder" position="0,0" size="1280,720" title="..Help.." backgroundColor="#ffffffff">
|
|---|
| 2171 | <widget name="Picture" position="0,0" size="1280,720" zPosition="1"/>
|
|---|
| 2172 | </screen>"""
|
|---|
| 2173 |
|
|---|
| 2174 | def __init__(self, session, whatPic = None):
|
|---|
| 2175 | self.skin = CoolTVGuideHelp.skin
|
|---|
| 2176 | Screen.__init__(self, session)
|
|---|
| 2177 | self.whatPic = whatPic
|
|---|
| 2178 | self.EXscale = (AVSwitch().getFramebufferScale())
|
|---|
| 2179 | self.EXpicload = ePicLoad()
|
|---|
| 2180 | self["Picture"] = Pixmap()
|
|---|
| 2181 | self["actions"] = ActionMap(["WizardActions", "ColorActions"],
|
|---|
| 2182 | {
|
|---|
| 2183 | "ok": self.close,
|
|---|
| 2184 | "back": self.close,
|
|---|
| 2185 | "red": self.close,
|
|---|
| 2186 | "green": self.close
|
|---|
| 2187 | }, -1)
|
|---|
| 2188 |
|
|---|
| 2189 | self["key_red"] = Button(_("Cancel"))
|
|---|
| 2190 | self["key_green"] = Button(_("Save"))
|
|---|
| 2191 |
|
|---|
| 2192 | self.EXpicload.PictureData.get().append(self.DecodeAction)
|
|---|
| 2193 | self.onLayoutFinish.append(self.Help_Picture)
|
|---|
| 2194 |
|
|---|
| 2195 | def Help_Picture(self):
|
|---|
| 2196 | if self.whatPic is not None:
|
|---|
| 2197 | self.EXpicload.setPara([self["Picture"].instance.size().width(), self["Picture"].instance.size().height(), self.EXscale[0], self.EXscale[1], 0, 1, "#121214"])
|
|---|
| 2198 | self.EXpicload.startDecode(self.whatPic)
|
|---|
| 2199 |
|
|---|
| 2200 | def DecodeAction(self, pictureInfo=" "):
|
|---|
| 2201 | if self.whatPic is not None:
|
|---|
| 2202 | ptr = self.EXpicload.getData()
|
|---|
| 2203 | self["Picture"].instance.setPixmap(ptr)
|
|---|
| 2204 |
|
|---|
| 2205 |
|
|---|
| 2206 | class CoolTimerEntry(TimerEntry):
|
|---|
| 2207 |
|
|---|
| 2208 | def __init__(self, session, timer):
|
|---|
| 2209 | Screen.__init__(self, session)
|
|---|
| 2210 | self.timer = timer
|
|---|
| 2211 | self.entryDate = None
|
|---|
| 2212 | self.entryService = None
|
|---|
| 2213 | self.createConfig()
|
|---|
| 2214 | self.list = []
|
|---|
| 2215 | ConfigListScreen.__init__(self, self.list, session = session)
|
|---|
| 2216 | self.createSetup("config")
|
|---|
| 2217 |
|
|---|
| 2218 | def createConfig(self):
|
|---|
| 2219 | justplay = self.timer.justplay
|
|---|
| 2220 | afterevent = {
|
|---|
| 2221 | AFTEREVENT.NONE: "nothing",
|
|---|
| 2222 | AFTEREVENT.DEEPSTANDBY: "deepstandby",
|
|---|
| 2223 | AFTEREVENT.STANDBY: "standby",
|
|---|
| 2224 | AFTEREVENT.AUTO: "auto"
|
|---|
| 2225 | }[self.timer.afterEvent]
|
|---|
| 2226 |
|
|---|
| 2227 | weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")
|
|---|
| 2228 |
|
|---|
| 2229 | day = []
|
|---|
| 2230 | weekday = 0
|
|---|
| 2231 | for x in (0, 1, 2, 3, 4, 5, 6):
|
|---|
| 2232 | day.append(0)
|
|---|
| 2233 | if self.timer.repeated: # repeated
|
|---|
| 2234 | type = "repeated"
|
|---|
| 2235 | if (self.timer.repeated == 31): # Mon-Fri
|
|---|
| 2236 | repeated = "weekdays"
|
|---|
| 2237 | elif (self.timer.repeated == 127): # daily
|
|---|
| 2238 | repeated = "daily"
|
|---|
| 2239 | else:
|
|---|
| 2240 | flags = self.timer.repeated
|
|---|
| 2241 | repeated = "user"
|
|---|
| 2242 | count = 0
|
|---|
| 2243 | for x in (0, 1, 2, 3, 4, 5, 6):
|
|---|
| 2244 | if flags == 1: # weekly
|
|---|
| 2245 | print "Set to weekday " + str(x)
|
|---|
| 2246 | weekday = x
|
|---|
| 2247 | if flags & 1 == 1: # set user defined flags
|
|---|
| 2248 | day[x] = 1
|
|---|
| 2249 | count += 1
|
|---|
| 2250 | else:
|
|---|
| 2251 | day[x] = 0
|
|---|
| 2252 | flags = flags >> 1
|
|---|
| 2253 | if count == 1:
|
|---|
| 2254 | repeated = "weekly"
|
|---|
| 2255 | else: # once
|
|---|
| 2256 | type = "once"
|
|---|
| 2257 | repeated = None
|
|---|
| 2258 | weekday = (int(strftime("%w", localtime(self.timer.begin))) - 1) % 7
|
|---|
| 2259 | day[weekday] = 1
|
|---|
| 2260 |
|
|---|
| 2261 | self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = {0: "record", 1: "zap"}[justplay])
|
|---|
| 2262 | if SystemInfo["DeepstandbySupport"]:
|
|---|
| 2263 | shutdownString = _("go to deep standby")
|
|---|
| 2264 | else:
|
|---|
| 2265 | shutdownString = _("shut down")
|
|---|
| 2266 | self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("auto", _("auto"))], default = afterevent)
|
|---|
| 2267 | self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
|
|---|
| 2268 | self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False)
|
|---|
| 2269 | self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
|
|---|
| 2270 | self.timerentry_tags = self.timer.tags[:]
|
|---|
| 2271 | self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])
|
|---|
| 2272 | self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
|
|---|
| 2273 | self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
|
|---|
| 2274 | self.timerentry_starttime = ConfigClock(default = self.timer.begin)
|
|---|
| 2275 | self.timerentry_endtime = ConfigClock(default = self.timer.end)
|
|---|
| 2276 | self.timerentry_showendtime = ConfigSelection(default = ((self.timer.end - self.timer.begin) > 4), choices = [(True, _("yes")), (False, _("no"))])
|
|---|
| 2277 | default = self.timer.dirname or defaultMoviePath()
|
|---|
| 2278 | tmp = config.movielist.videodirs.value
|
|---|
| 2279 | if default not in tmp:
|
|---|
| 2280 | tmp.append(default)
|
|---|
| 2281 | self.timerentry_dirname = ConfigSelection(default = default, choices = tmp)
|
|---|
| 2282 | self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)
|
|---|
| 2283 | self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])
|
|---|
| 2284 | self.timerentry_day = ConfigSubList()
|
|---|
| 2285 | for x in (0, 1, 2, 3, 4, 5, 6):
|
|---|
| 2286 | self.timerentry_day.append(ConfigYesNo(default = day[x]))
|
|---|
| 2287 | servicename = "N/A"
|
|---|
| 2288 | try: # no current service available?
|
|---|
| 2289 | servicename = str(self.timer.service_ref.getServiceName())
|
|---|
| 2290 | except:
|
|---|
| 2291 | pass
|
|---|
| 2292 | self.timerentry_service_ref = self.timer.service_ref
|
|---|
| 2293 | self.timerentry_service = ConfigSelection([servicename])
|
|---|
| 2294 |
|
|---|
| 2295 | def createSetup(self, widget):
|
|---|
| 2296 | self.list = []
|
|---|
| 2297 | self.list.append(getConfigListEntry(_("Name"), self.timerentry_name))
|
|---|
| 2298 | self.list.append(getConfigListEntry(_("Description"), self.timerentry_description))
|
|---|
| 2299 | self.timerJustplayEntry = getConfigListEntry(_("Timer Type"), self.timerentry_justplay)
|
|---|
| 2300 | self.list.append(self.timerJustplayEntry)
|
|---|
| 2301 | self.timerTypeEntry = getConfigListEntry(_("Repeat Type"), self.timerentry_type)
|
|---|
| 2302 | self.list.append(self.timerTypeEntry)
|
|---|
| 2303 |
|
|---|
| 2304 | if self.timerentry_type.value == "once":
|
|---|
| 2305 | self.frequencyEntry = None
|
|---|
| 2306 | else: # repeated
|
|---|
| 2307 | self.frequencyEntry = getConfigListEntry(_("Repeats"), self.timerentry_repeated)
|
|---|
| 2308 | self.list.append(self.frequencyEntry)
|
|---|
| 2309 | self.repeatedbegindateEntry = getConfigListEntry(_("Starting on"), self.timerentry_repeatedbegindate)
|
|---|
| 2310 | self.list.append(self.repeatedbegindateEntry)
|
|---|
| 2311 | if self.timerentry_repeated.value == "daily":
|
|---|
| 2312 | pass
|
|---|
| 2313 | if self.timerentry_repeated.value == "weekdays":
|
|---|
| 2314 | pass
|
|---|
| 2315 | if self.timerentry_repeated.value == "weekly":
|
|---|
| 2316 | self.list.append(getConfigListEntry(_("Weekday"), self.timerentry_weekday))
|
|---|
| 2317 |
|
|---|
| 2318 | if self.timerentry_repeated.value == "user":
|
|---|
| 2319 | self.list.append(getConfigListEntry(_("Monday"), self.timerentry_day[0]))
|
|---|
| 2320 | self.list.append(getConfigListEntry(_("Tuesday"), self.timerentry_day[1]))
|
|---|
| 2321 | self.list.append(getConfigListEntry(_("Wednesday"), self.timerentry_day[2]))
|
|---|
| 2322 | self.list.append(getConfigListEntry(_("Thursday"), self.timerentry_day[3]))
|
|---|
| 2323 | self.list.append(getConfigListEntry(_("Friday"), self.timerentry_day[4]))
|
|---|
| 2324 | self.list.append(getConfigListEntry(_("Saturday"), self.timerentry_day[5]))
|
|---|
| 2325 | self.list.append(getConfigListEntry(_("Sunday"), self.timerentry_day[6]))
|
|---|
| 2326 |
|
|---|
| 2327 | self.entryDate = getConfigListEntry(_("Date"), self.timerentry_date)
|
|---|
| 2328 | if self.timerentry_type.value == "once":
|
|---|
| 2329 | self.list.append(self.entryDate)
|
|---|
| 2330 | self.entryStartTime = getConfigListEntry(_("StartTime"), self.timerentry_starttime)
|
|---|
| 2331 | self.list.append(self.entryStartTime)
|
|---|
| 2332 | self.entryShowEndTime = getConfigListEntry(_("Set End Time"), self.timerentry_showendtime)
|
|---|
| 2333 | if self.timerentry_justplay.value == "zap":
|
|---|
| 2334 | self.list.append(self.entryShowEndTime)
|
|---|
| 2335 | self.entryEndTime = getConfigListEntry(_("EndTime"), self.timerentry_endtime)
|
|---|
| 2336 | if self.timerentry_justplay.value != "zap" or self.timerentry_showendtime.value:
|
|---|
| 2337 | self.list.append(self.entryEndTime)
|
|---|
| 2338 | self.channelEntry = getConfigListEntry(_("Channel"), self.timerentry_service)
|
|---|
| 2339 | self.list.append(self.channelEntry)
|
|---|
| 2340 | self.dirname = getConfigListEntry(_("Location"), self.timerentry_dirname)
|
|---|
| 2341 | self.tagsSet = getConfigListEntry(_("Tags"), self.timerentry_tagsset)
|
|---|
| 2342 | if self.timerentry_justplay.value != "zap":
|
|---|
| 2343 | if config.usage.setup_level.index >= 2: # expert+
|
|---|
| 2344 | self.list.append(self.dirname)
|
|---|
| 2345 | if getPreferredTagEditor():
|
|---|
| 2346 | self.list.append(self.tagsSet)
|
|---|
| 2347 | self.list.append(getConfigListEntry(_("After event"), self.timerentry_afterevent))
|
|---|
| 2348 |
|
|---|
| 2349 | self.keyGo()
|
|---|
| 2350 |
|
|---|
| 2351 | def finishedChannelSelection(self, *args):
|
|---|
| 2352 | if args:
|
|---|
| 2353 | self.timerentry_service_ref = ServiceReference(args[0])
|
|---|
| 2354 | self.timerentry_service.setCurrentText(self.timerentry_service_ref.getServiceName())
|
|---|
| 2355 | self["config"].invalidate(self.channelEntry)
|
|---|
| 2356 |
|
|---|
| 2357 | def getTimestamp(self, date, mytime):
|
|---|
| 2358 | d = localtime(date)
|
|---|
| 2359 | dt = datetime(d.tm_year, d.tm_mon, d.tm_mday, mytime[0], mytime[1])
|
|---|
| 2360 | return int(mktime(dt.timetuple()))
|
|---|
| 2361 |
|
|---|
| 2362 | def getBeginEnd(self):
|
|---|
| 2363 | date = self.timerentry_date.value
|
|---|
| 2364 | endtime = self.timerentry_endtime.value
|
|---|
| 2365 | starttime = self.timerentry_starttime.value
|
|---|
| 2366 | begin = self.getTimestamp(date, starttime)
|
|---|
| 2367 | end = self.getTimestamp(date, endtime)
|
|---|
| 2368 | if end < begin:
|
|---|
| 2369 | end += 86400
|
|---|
| 2370 | return begin, end
|
|---|
| 2371 |
|
|---|
| 2372 | def selectChannelSelector(self, *args):
|
|---|
| 2373 | self.session.openWithCallback(
|
|---|
| 2374 | self.finishedChannelSelectionCorrection,
|
|---|
| 2375 | ChannelSelection.SimpleChannelSelection,
|
|---|
| 2376 | _("Select channel to record from")
|
|---|
| 2377 | )
|
|---|
| 2378 |
|
|---|
| 2379 | def finishedChannelSelectionCorrection(self, *args):
|
|---|
| 2380 | if args:
|
|---|
| 2381 | self.finishedChannelSelection(*args)
|
|---|
| 2382 | self.keyGo()
|
|---|
| 2383 |
|
|---|
| 2384 | def keyGo(self, result = None):
|
|---|
| 2385 | self.timer.name = self.timerentry_name.value
|
|---|
| 2386 | self.timer.description = self.timerentry_description.value
|
|---|
| 2387 | self.timer.justplay = self.timerentry_justplay.value == "zap"
|
|---|
| 2388 | if self.timerentry_justplay.value == "zap":
|
|---|
| 2389 | if not self.timerentry_showendtime.value:
|
|---|
| 2390 | self.timerentry_endtime.value = self.timerentry_starttime.value
|
|---|
| 2391 | self.timer.resetRepeated()
|
|---|
| 2392 | self.timer.afterEvent = {
|
|---|
| 2393 | "auto": AFTEREVENT.AUTO
|
|---|
| 2394 | }[self.timerentry_afterevent.value]
|
|---|
| 2395 | self.timer.service_ref = self.timerentry_service_ref
|
|---|
| 2396 | self.timer.tags = self.timerentry_tags
|
|---|
| 2397 |
|
|---|
| 2398 | if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath():
|
|---|
| 2399 | self.timer.dirname = self.timerentry_dirname.value
|
|---|
| 2400 | config.movielist.last_timer_videodir.value = self.timer.dirname
|
|---|
| 2401 | config.movielist.last_timer_videodir.save()
|
|---|
| 2402 |
|
|---|
| 2403 | if self.timerentry_type.value == "once":
|
|---|
| 2404 | self.timer.begin, self.timer.end = self.getBeginEnd()
|
|---|
| 2405 |
|
|---|
| 2406 | if self.timer.eit is not None:
|
|---|
| 2407 | event = eEPGCache.getInstance().lookupEventId(self.timer.service_ref.ref, self.timer.eit)
|
|---|
| 2408 | if event:
|
|---|
| 2409 | n = event.getNumOfLinkageServices()
|
|---|
| 2410 | if n > 1:
|
|---|
| 2411 | tlist = []
|
|---|
| 2412 | ref = self.session.nav.getCurrentlyPlayingServiceReference()
|
|---|
| 2413 | parent = self.timer.service_ref.ref
|
|---|
| 2414 | selection = 0
|
|---|
| 2415 | for x in range(n):
|
|---|
| 2416 | i = event.getLinkageService(parent, x)
|
|---|
| 2417 | if i.toString() == ref.toString():
|
|---|
| 2418 | selection = x
|
|---|
| 2419 | tlist.append((i.getName(), i))
|
|---|
| 2420 | self.session.openWithCallback(self.subserviceSelected, ChoiceBox, title=_("Please select a subservice to record..."), list = tlist, selection = selection)
|
|---|
| 2421 | return
|
|---|
| 2422 | elif n > 0:
|
|---|
| 2423 | parent = self.timer.service_ref.ref
|
|---|
| 2424 | self.timer.service_ref = ServiceReference(event.getLinkageService(parent, 0))
|
|---|
| 2425 | self.saveTimer()
|
|---|
| 2426 | self.close((True, self.timer))
|
|---|
| 2427 |
|
|---|
| 2428 | def subserviceSelected(self, service):
|
|---|
| 2429 | if not service is None:
|
|---|
| 2430 | self.timer.service_ref = ServiceReference(service[1])
|
|---|
| 2431 | self.saveTimer()
|
|---|
| 2432 | self.close((True, self.timer))
|
|---|
| 2433 |
|
|---|
| 2434 | def saveTimer(self):
|
|---|
| 2435 | self.session.nav.RecordTimer.saveTimer()
|
|---|
| 2436 |
|
|---|
| 2437 |
|
|---|
| 2438 | ####################################################
|
|---|
| 2439 |
|
|---|
| 2440 | def zapToService(service):
|
|---|
| 2441 | if not service is None:
|
|---|
| 2442 | if Servicelist.getRoot() != epg_bouquet: #already in correct bouquet?
|
|---|
| 2443 | Servicelist.clearPath()
|
|---|
| 2444 | if Servicelist.bouquet_root != epg_bouquet:
|
|---|
| 2445 | Servicelist.enterPath(Servicelist.bouquet_root)
|
|---|
| 2446 | Servicelist.enterPath(epg_bouquet)
|
|---|
| 2447 | Servicelist.setCurrentSelection(service) #select the service in Servicelist
|
|---|
| 2448 | Servicelist.zap()
|
|---|
| 2449 |
|
|---|
| 2450 | def getBouquetServices(bouquet):
|
|---|
| 2451 | services = [ ]
|
|---|
| 2452 | Servicelist = eServiceCenter.getInstance().list(bouquet)
|
|---|
| 2453 | if not Servicelist is None:
|
|---|
| 2454 | while True:
|
|---|
| 2455 | service = Servicelist.getNext()
|
|---|
| 2456 | if not service.valid(): #check if end of list
|
|---|
| 2457 | break
|
|---|
| 2458 | if service.flags & (eServiceReference.isDirectory | eServiceReference.isMarker): #ignore non playable services
|
|---|
| 2459 | continue
|
|---|
| 2460 | services.append(ServiceReference(service))
|
|---|
| 2461 | return services
|
|---|
| 2462 |
|
|---|
| 2463 | def cleanup():
|
|---|
| 2464 | global Session
|
|---|
| 2465 | Session = None
|
|---|
| 2466 | global Servicelist
|
|---|
| 2467 | Servicelist = None
|
|---|
| 2468 |
|
|---|
| 2469 | def closed(ret=False):
|
|---|
| 2470 | closedScreen = dlg_stack.pop()
|
|---|
| 2471 | global bouquetSel
|
|---|
| 2472 | if bouquetSel and closedScreen == bouquetSel:
|
|---|
| 2473 | bouquetSel = None
|
|---|
| 2474 | dlgs=len(dlg_stack)
|
|---|
| 2475 | if ret and dlgs > 0: # recursive close wished
|
|---|
| 2476 | dlg_stack[dlgs-1].close(dlgs > 1)
|
|---|
| 2477 | if dlgs <= 0:
|
|---|
| 2478 | cleanup()
|
|---|
| 2479 |
|
|---|
| 2480 | def openBouquetEPG(bouquet):
|
|---|
| 2481 | services = getBouquetServices(bouquet)
|
|---|
| 2482 | if len(services):
|
|---|
| 2483 | global epg_bouquet
|
|---|
| 2484 | epg_bouquet = bouquet
|
|---|
| 2485 | dlg_stack.append(Session.openWithCallback(closed, CoolTVGuide, services, zapToService, CoolBouquetchange))
|
|---|
| 2486 | return True
|
|---|
| 2487 | return False
|
|---|
| 2488 |
|
|---|
| 2489 | def CoolBouquetchange(direction, epg):
|
|---|
| 2490 | global epg_bouquet
|
|---|
| 2491 | global man_bouquets
|
|---|
| 2492 | if bouquetSel:
|
|---|
| 2493 | if direction > 0:
|
|---|
| 2494 | bouquetSel.down()
|
|---|
| 2495 | else:
|
|---|
| 2496 | bouquetSel.up()
|
|---|
| 2497 | bouquet = bouquetSel.getCurrent()
|
|---|
| 2498 | services = getBouquetServices(bouquet)
|
|---|
| 2499 | if len(services):
|
|---|
| 2500 | # global epg_bouquet
|
|---|
| 2501 | epg_bouquet = bouquet
|
|---|
| 2502 | epg.setServices(services)
|
|---|
| 2503 |
|
|---|
| 2504 | else:
|
|---|
| 2505 | for cool in range(len(cool_bouquets)):
|
|---|
| 2506 | if cool_bouquets[cool][1] == man_bouquets: break
|
|---|
| 2507 | cool = cool + 1
|
|---|
| 2508 | if direction > 0:
|
|---|
| 2509 | if cool == len(cool_bouquets): man = 0
|
|---|
| 2510 | else: man = cool
|
|---|
| 2511 | else:
|
|---|
| 2512 | if cool == 1:
|
|---|
| 2513 | man = len(cool_bouquets)
|
|---|
| 2514 | man = man - 1
|
|---|
| 2515 | else:
|
|---|
| 2516 | man = cool - 2
|
|---|
| 2517 | services = getBouquetServices(cool_bouquets[man][1])
|
|---|
| 2518 | if len(services):
|
|---|
| 2519 | # global man_bouquets
|
|---|
| 2520 | # global epg_bouquet
|
|---|
| 2521 | man_bouquets = cool_bouquets[man][1]
|
|---|
| 2522 | epg_bouquet = cool_bouquets[man][1]
|
|---|
| 2523 | epg.setServices(services)
|
|---|
| 2524 |
|
|---|
| 2525 | def main(session, servicelist = None, **kwargs):
|
|---|
| 2526 | if servicelist == None:
|
|---|
| 2527 | if "servicelist" in kwargs:
|
|---|
| 2528 | servicelist = kwargs["servicelist"]
|
|---|
| 2529 | else:
|
|---|
| 2530 | session.open(MessageBox, _(" No function with your Image"), MessageBox.TYPE_ERROR)
|
|---|
| 2531 | return
|
|---|
| 2532 | global Session
|
|---|
| 2533 | Session = session
|
|---|
| 2534 | global cool_bouquets
|
|---|
| 2535 | global man_bouquets
|
|---|
| 2536 | global bouquetSel
|
|---|
| 2537 | global Servicelist
|
|---|
| 2538 | Servicelist = servicelist
|
|---|
| 2539 | man_bouquets = Servicelist and Servicelist.getRoot()
|
|---|
| 2540 | global bouquets
|
|---|
| 2541 | bouquets = Servicelist and Servicelist.getBouquetList()
|
|---|
| 2542 | del cool_bouquets[:]
|
|---|
| 2543 | for cool in range(len(bouquets)):
|
|---|
| 2544 | services = getBouquetServices(bouquets[cool][1])
|
|---|
| 2545 | if len(services):
|
|---|
| 2546 | cool_bouquets.append(bouquets[cool])
|
|---|
| 2547 | services = getBouquetServices(man_bouquets)
|
|---|
| 2548 |
|
|---|
| 2549 | if bouquets is None:
|
|---|
| 2550 | cnt = 0
|
|---|
| 2551 | else:
|
|---|
| 2552 | cnt = len(bouquets)
|
|---|
| 2553 | if len(services):
|
|---|
| 2554 | cnt = 0
|
|---|
| 2555 |
|
|---|
| 2556 | if cnt > 1: # show bouquet list
|
|---|
| 2557 |
|
|---|
| 2558 | bouquetSel = Session.openWithCallback(closed, BouquetSelector, bouquets, openBouquetEPG, enableWrapAround=True)
|
|---|
| 2559 | dlg_stack.append(bouquetSel)
|
|---|
| 2560 |
|
|---|
| 2561 | elif cnt == 1:
|
|---|
| 2562 | openBouquetEPG(bouquets[0][1])
|
|---|
| 2563 | if not openBouquetEPG(bouquets[0][1]):
|
|---|
| 2564 | cleanup()
|
|---|
| 2565 |
|
|---|
| 2566 | elif config.misc.Cool_TV_Guide.autostart_bouquet.value == "Yes":
|
|---|
| 2567 | bouquetSel = Session.openWithCallback(closed, BouquetSelector, bouquets, openBouquetEPG, enableWrapAround=True)
|
|---|
| 2568 | dlg_stack.append(bouquetSel)
|
|---|
| 2569 |
|
|---|
| 2570 | elif cnt == 0:
|
|---|
| 2571 | if not openBouquetEPG(man_bouquets):
|
|---|
| 2572 | cleanup()
|
|---|
| 2573 |
|
|---|
| 2574 | def Plugins(**kwargs):
|
|---|
| 2575 | name = _("Cool TV Guide")
|
|---|
| 2576 | descr = _("Cool TV Guide 3D EPG with switchable 5-24 TV-Lines and changeable Buttons with Setup")
|
|---|
| 2577 | return [ PluginDescriptor(name=name, description=descr, where = PluginDescriptor.WHERE_EVENTINFO, fnc=main),
|
|---|
| 2578 | PluginDescriptor(name=name, description=descr, where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main) ]
|
|---|