Skip to content

Commit

Permalink
Fixed 'red tint' problem and other minor problems on Gotham
Browse files Browse the repository at this point in the history
  • Loading branch information
twinther committed Mar 24, 2014
1 parent bd70d5b commit 2ebe14e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 23 deletions.
2 changes: 1 addition & 1 deletion addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.tvguide" name="TV Guide" version="2.0.6" provider-name="twinther">
<addon id="script.tvguide" name="TV Guide" version="2.1.0" provider-name="twinther">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.simplejson" version="2.0.10"/>
Expand Down
7 changes: 5 additions & 2 deletions changelog.txt
@@ -1,6 +1,9 @@
[B]Version 2.0.6 - 2013-xx-xx[/B[
[B]Version 2.1.0 - 2014-03-24[/B]
- Fixed 'red tint' problem and other minor problems on Gotham

[B]Version 2.0.6 - unreleased[/B]
- Merged ONTV source into XMLTV
It's not possible to loa XMLTV either from a local file or from a URL
It's now possible to load XMLTV either from a local file or from a URL
- Display a 'No program available' for channels without programs to be able to stream

[B]Version 2.0.5 - 2013-06-04[/B]
Expand Down
49 changes: 30 additions & 19 deletions gui.py
@@ -1,5 +1,5 @@
#
# Copyright (C) 2013 Tommy Winther
# Copyright (C) 2014 Tommy Winther
# http://tommy.winther.nu
#
# This Program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -122,7 +122,6 @@ def __init__(self):
super(TVGuide, self).__init__()
self.migrateSettings()

self.initialized = False
self.notification = None
self.redrawingEPG = False
self.isClosing = False
Expand Down Expand Up @@ -178,11 +177,6 @@ def close(self):

@buggalo.buggalo_try_except({'method': 'TVGuide.onInit'})
def onInit(self):
if self.initialized:
# onInit(..) is invoked again by XBMC after a video addon exits after being invoked by XBMC.RunPlugin(..)
xbmc.log("[script.tvguide] TVGuide.onInit(..) invoked, but we're already initialized!")
return
self.initialized = True
self._hideControl(self.C_MAIN_MOUSE_CONTROLS, self.C_MAIN_OSD)
self._showControl(self.C_MAIN_EPG, self.C_MAIN_LOADING)
self.setControlLabel(self.C_MAIN_LOADING_TIME_LEFT, strings(BACKGROUND_UPDATE_IN_PROGRESS))
Expand Down Expand Up @@ -451,8 +445,11 @@ def onFocus(self, controlId):
return

self.setControlLabel(self.C_MAIN_TITLE, '[B]%s[/B]' % program.title)
self.setControlLabel(self.C_MAIN_TIME,
'[B]%s - %s[/B]' % (self.formatTime(program.startDate), self.formatTime(program.endDate)))
if program.startDate or program.endDate:
self.setControlLabel(self.C_MAIN_TIME,
'[B]%s - %s[/B]' % (self.formatTime(program.startDate), self.formatTime(program.endDate)))
else:
self.setControlLabel(self.C_MAIN_TIME, '')
if program.description:
description = program.description
else:
Expand Down Expand Up @@ -581,8 +578,11 @@ def _showOsd(self):

if self.osdProgram is not None:
self.setControlLabel(self.C_MAIN_OSD_TITLE, '[B]%s[/B]' % self.osdProgram.title)
self.setControlLabel(self.C_MAIN_OSD_TIME, '[B]%s - %s[/B]' % (
self.formatTime(self.osdProgram.startDate), self.formatTime(self.osdProgram.endDate)))
if self.osdProgram.startDate or self.osdProgram.endDate:
self.setControlLabel(self.C_MAIN_OSD_TIME, '[B]%s - %s[/B]' % (
self.formatTime(self.osdProgram.startDate), self.formatTime(self.osdProgram.endDate)))
else:
self.setControlLabel(self.C_MAIN_OSD_TIME, '')
self.setControlText(self.C_MAIN_OSD_DESCRIPTION, self.osdProgram.description)
self.setControlLabel(self.C_MAIN_OSD_CHANNEL_TITLE, self.osdChannel.title)
if self.osdProgram.channel.logo is not None:
Expand Down Expand Up @@ -705,7 +705,8 @@ def onRedrawEPG(self, channelStart, startTime, focusFunction=None):
focusTexture='tvguide-program-grey-focus.png'
)

self.controlAndProgramList.append(ControlAndProgram(control, None))
program = src.Program(channel, strings(NO_PROGRAM_AVAILABLE), None, None, None)
self.controlAndProgramList.append(ControlAndProgram(control, program))

# add program controls
if focusFunction is None:
Expand Down Expand Up @@ -890,12 +891,18 @@ def _showControl(self, *controlIds):
control.setVisible(False)

def formatTime(self, timestamp):
format = xbmc.getRegion('time').replace(':%S', '').replace('%H%H', '%H')
return timestamp.strftime(format)
if timestamp:
format = xbmc.getRegion('time').replace(':%S', '').replace('%H%H', '%H')
return timestamp.strftime(format)
else:
return ''

def formatDate(self, timestamp):
format = xbmc.getRegion('dateshort')
return timestamp.strftime(format)
if timestamp:
format = xbmc.getRegion('dateshort')
return timestamp.strftime(format)
else:
return ''

def setControlImage(self, controlId, image):
control = self.getControl(controlId)
Expand Down Expand Up @@ -985,10 +992,14 @@ def onInit(self):

programTitleControl.setLabel(self.program.title)

if self.showRemind:
remindControl.setLabel(strings(REMIND_PROGRAM))
if self.program.startDate:
remindControl.setEnabled(True)
if self.showRemind:
remindControl.setLabel(strings(REMIND_PROGRAM))
else:
remindControl.setLabel(strings(DONT_REMIND_PROGRAM))
else:
remindControl.setLabel(strings(DONT_REMIND_PROGRAM))
remindControl.setEnabled(False)

@buggalo.buggalo_try_except({'method': 'PopupMenu.onAction'})
def onAction(self, action):
Expand Down
6 changes: 6 additions & 0 deletions resources/skins/Default/720p/script-tvguide-main.xml
Expand Up @@ -10,11 +10,17 @@
<control type="image">
<description>workaround for texture not being loaded</description>
<posx>-10000</posx>
<posy>-10000</posy>
<width>1</width>
<height>1</height>
<texture>tvguide-program-red.png</texture>
</control>
<control type="image">
<description>workaround for texture not being loaded</description>
<posx>-10000</posx>
<posy>-10000</posy>
<width>1</width>
<height>1</height>
<texture>tvguide-program-red-focus.png</texture>
</control>

Expand Down
5 changes: 4 additions & 1 deletion streaming.py
@@ -1,5 +1,5 @@
#
# Copyright (C) 2012 Tommy Winther
# Copyright (C) 2014 Tommy Winther
# http://tommy.winther.nu
#
# This Program is free software; you can redistribute it and/or modify
Expand All @@ -19,6 +19,7 @@
#
import xbmc
from xml.etree import ElementTree
from xml.etree.ElementTree import ParseError
from xml.parsers.expat import ExpatError
import ConfigParser
import os
Expand Down Expand Up @@ -57,6 +58,8 @@ def loadFavourites(self):
entries.append((node.get('name'), value))
except ExpatError:
pass
except ParseError:
pass

return entries

Expand Down

0 comments on commit 2ebe14e

Please sign in to comment.