The branch, dharma has been updated
       via  1794b584af4446e069e370bfdc858485d7939199 (commit)
      from  9c6a01c9cbafceb715eeed38f547ff522413e468 (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=1794b584af4446e069e370bfdc858485d7939199

commit 1794b584af4446e069e370bfdc858485d7939199
Author: spiff <[email protected]>
Date:   Tue Oct 11 09:44:38 2011 +0200

    [script.tvguide] -v 0.4.0

diff --git a/script.tvguide/addon.py b/script.tvguide/addon.py
index ede2d64..aa9df02 100644
--- a/script.tvguide/addon.py
+++ b/script.tvguide/addon.py
@@ -17,12 +17,14 @@ sourceRef = SOURCES[ADDON.getSetting('source')]
 SETTINGS = {
     'cache.path' : xbmc.translatePath(ADDON.getAddonInfo('profile')),
     'xmltv.file' : ADDON.getSetting('xmltv.file'),
-    'youseetv.category' : ADDON.getSetting('youseetv.category')
+    'youseetv.category' : ADDON.getSetting('youseetv.category'),
+    'notifications.enabled' : ADDON.getSetting('notifications.enabled'),
+    'cache.data.on.xbmc.startup' : 
ADDON.getSetting('cache.data.on.xbmc.startup')
 }
 
 SOURCE = sourceRef(SETTINGS)
 
-xbmc.log("Loading TVGuide [script.tvguide] source: " + str(sourceRef))
+xbmc.log("[script.tvguide] Using source: " + str(sourceRef))
 
 if __name__ == '__main__':
     w = gui.TVGuide(source = SOURCE)
diff --git a/script.tvguide/addon.xml b/script.tvguide/addon.xml
index 098968a..fdad3ab 100644
--- a/script.tvguide/addon.xml
+++ b/script.tvguide/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="script.tvguide"
        name="TV Guide"
-       version="0.3.1"
+       version="0.4.0"
        provider-name="twinther [[email protected]]">
     <requires>
         <import addon="xbmc.python" version="1.0"/>
diff --git a/script.tvguide/changelog.txt b/script.tvguide/changelog.txt
index 0e5b9c4..16b085d 100644
--- a/script.tvguide/changelog.txt
+++ b/script.tvguide/changelog.txt
@@ -1,3 +1,8 @@
+[B]Version 0.4.0 - 2011-10-09[/B]
+- Add option to get notified before programs start
+- New graphics
+- Readded initial support for streaming channels
+
 [B]Version 0.3.1 - 2011-09-10[/B]
 - Made paging of channels more logical to navigate
 - Better handling of errors if EPG data is unavailable
diff --git a/script.tvguide/clear_cache.py b/script.tvguide/clear_cache.py
index a78d4a4..3bfc62c 100644
--- a/script.tvguide/clear_cache.py
+++ b/script.tvguide/clear_cache.py
@@ -5,14 +5,13 @@ import xbmcgui
 
 from strings import *
 
-
 xbmc.log("Clearing TVGuide [script.tvguide] caches...")
 cachePath = xbmc.translatePath(xbmcaddon.Addon(id = 
'script.tvguide').getAddonInfo('profile'))
 
 for file in os.listdir(cachePath):
-    if file != 'settings.xml':
+    if file not in ['settings.xml', 'notification.db']:
         os.unlink(os.path.join(cachePath, file))
 
-xbmcgui.Dialog().ok(strings(CLEAR_CACHE), strings(CLEAR_CACHE_DONE))
+xbmcgui.Dialog().ok(strings(CLEAR_CACHE), strings(DONE))
 
 xbmc.log("Clearing TVGuide [script.tvguide] caches. Done!")
\ No newline at end of file
diff --git a/script.tvguide/gui.py b/script.tvguide/gui.py
index 6f09607..afb3373 100644
--- a/script.tvguide/gui.py
+++ b/script.tvguide/gui.py
@@ -19,7 +19,7 @@ KEY_INFO = 11
 KEY_NAV_BACK = 92
 KEY_CONTEXT_MENU = 117
 
-CHANNELS_PER_PAGE = 8
+CHANNELS_PER_PAGE = 9
 
 CELL_HEIGHT = 50
 CELL_WIDTH = 275
@@ -28,8 +28,10 @@ CELL_WIDTH_CHANNELS = 180
 HALF_HOUR = datetime.timedelta(minutes = 30)
 
 ADDON = xbmcaddon.Addon(id = 'script.tvguide')
-TEXTURE_BUTTON_NOFOCUS = 
os.path.join(xbmc.translatePath(ADDON.getAddonInfo('path')), 'resources', 
'skins', 'Default', 'media', 'cell-bg.png')
-TEXTURE_BUTTON_FOCUS = 
os.path.join(xbmc.translatePath(ADDON.getAddonInfo('path')), 'resources', 
'skins', 'Default', 'media', 'cell-bg-selected.png')
+TEXTURE_BUTTON_NOFOCUS = 
os.path.join(xbmc.translatePath(ADDON.getAddonInfo('path')), 'resources', 
'skins', 'Default', 'media', 'tvguide-program-grey.png')
+TEXTURE_BUTTON_FOCUS = 
os.path.join(xbmc.translatePath(ADDON.getAddonInfo('path')), 'resources', 
'skins', 'Default', 'media', 'tvguide-program-grey-focus.png')
+TEXTURE_BUTTON_NOFOCUS_NOTIFY = 
os.path.join(xbmc.translatePath(ADDON.getAddonInfo('path')), 'resources', 
'skins', 'Default', 'media', 'tvguide-program-red.png')
+TEXTURE_BUTTON_FOCUS_NOTIFY = 
os.path.join(xbmc.translatePath(ADDON.getAddonInfo('path')), 'resources', 
'skins', 'Default', 'media', 'tvguide-program-red-focus.png')
 
 class TVGuide(xbmcgui.WindowXML):
     C_MAIN_TITLE = 4020
@@ -38,13 +40,17 @@ class TVGuide(xbmcgui.WindowXML):
     C_MAIN_IMAGE = 4023
     C_MAIN_LOADING = 4200
     C_MAIN_LOADING_PROGRESS = 4201
+    C_MAIN_BACKGROUND = 4600
 
     def __new__(cls, source):
         return super(TVGuide, cls).__new__(cls, 'script-tvguide-main.xml', 
ADDON.getAddonInfo('path'))
 
     def __init__(self,  source):
+        """
+        @param source: the source of EPG data
+        @type source: source.Source
+        """
         super(TVGuide, self).__init__()
-
         self.source = source
         self.controlToProgramMap = {}
         self.focusX = 0
@@ -93,10 +99,14 @@ class TVGuide(xbmcgui.WindowXML):
 
     def onClick(self, controlId):
         program = self.controlToProgramMap[controlId]
-        if program.imageLarge is not None:
-            d = TVGuideInfo(program)
-            d.doModal()
-            del d
+
+        d = PopupMenu(program)
+        d.doModal()
+        buttonClicked = d.buttonClicked
+        del d
+
+        if buttonClicked == PopupMenu.C_POPUP_PLAY:
+            program.channel.play()
 
     def onFocus(self, controlId):
         controlInFocus = self.getControl(controlId)
@@ -104,7 +114,6 @@ class TVGuide(xbmcgui.WindowXML):
         if left > self.focusX or left + controlInFocus.getWidth() < 
self.focusX:
             self.focusX = left
 
-
         program = self.controlToProgramMap[controlId]
 
         self.getControl(self.C_MAIN_TITLE).setLabel('[B]%s[/B]' % 
program.title)
@@ -114,6 +123,9 @@ class TVGuide(xbmcgui.WindowXML):
         if program.imageSmall is not None:
             self.getControl(self.C_MAIN_IMAGE).setImage(program.imageSmall)
 
+        if ADDON.getSetting('program.background.enabled') == 'true' and 
program.imageLarge is not None:
+            
self.getControl(self.C_MAIN_BACKGROUND).setImage(program.imageLarge)
+
     def _left(self, currentX, currentY):
         control = self._findControlOnLeft(currentX, currentY)
         if control is None:
@@ -158,7 +170,7 @@ class TVGuide(xbmcgui.WindowXML):
         self.page = self.onRedrawEPG(self.page+ 1, self.date)
         return self._findControlBelow(0)
 
-    def onRedrawEPG(self, page, startTime):
+    def onRedrawEPG(self, page, startTime, autoChangeFocus = True):
         oldControltoProgramMap = self.controlToProgramMap.copy()
         self.controlToProgramMap.clear()
 
@@ -223,13 +235,14 @@ class TVGuide(xbmcgui.WindowXML):
                 if cellWidth > 1:
                     control = xbmcgui.ControlButton(
                         cellStart,
-                        25 + CELL_HEIGHT * (1 + idx),
-                        cellWidth,
-                        CELL_HEIGHT,
+                        60 + CELL_HEIGHT * idx,
+                        cellWidth - 2,
+                        CELL_HEIGHT - 2,
                         program.title,
                         noFocusTexture = TEXTURE_BUTTON_NOFOCUS,
                         focusTexture = TEXTURE_BUTTON_FOCUS
                     )
+
                     controlsToAdd.append([control, program])
 
 
@@ -244,7 +257,7 @@ class TVGuide(xbmcgui.WindowXML):
         try:
             self.getFocus()
         except TypeError:
-            if len(self.controlToProgramMap.keys()) > 0:
+            if len(self.controlToProgramMap.keys()) > 0 and autoChangeFocus:
                 
self.setFocus(self.getControl(self.controlToProgramMap.keys()[0]))
 
         self.getControl(self.C_MAIN_LOADING).setVisible(False)
@@ -343,24 +356,33 @@ class TVGuide(xbmcgui.WindowXML):
 
 
 
-class TVGuideInfo(xbmcgui.WindowXMLDialog):
-    C_INFO_IMAGE = 4000
+class PopupMenu(xbmcgui.WindowXMLDialog):
+    C_POPUP_PLAY = 4000
+    C_POPUP_CANCEL = 4001
 
     def __new__(cls, program):
-        return super(TVGuideInfo, cls).__new__(cls, 'script-tvguide-info.xml', 
ADDON.getAddonInfo('path'))
+        return super(PopupMenu, cls).__new__(cls, 'script-tvguide-menu.xml', 
ADDON.getAddonInfo('path'))
 
     def __init__(self, program):
-   def __init__(self, program):s).__new__(cls, 'script-tvguide-menu.xml', 
ADDON.getAddonInfo('path'))ns', 'Default', 'media', 
'tvguide-program-red-focus.png')u=p+’h9q
+Ð2bÿ€€[q+€Å2bÿPÄ2bÿkpp+6 
èè!è! Ð2bÿÐ2bÿx$9q
+€Æ2bÿ’Rp+†pp+ Ð2bÿ`Rp
+_Ð2bÿÀq+uZp+q+؝q+¨q+€zp+x$9q
+€Æ2bÿPÅ2bÿkpp+à!à! Ð2bÿÐ2bÿHîq
+`Ç2bÿ’Rp+†pp+ Ð2bÿ`Rp
+_Ð2bÿPÐ2bÿHÐ2bÿ8{=p+Œp˜Ð2bÿuZp+€zp
+`Ç2bÿ0Æ2bÿkpp
+GHIJKMNOP 
Ð2bÿÐ2bÿH¥ïp+É2bÿ’Rp+†pp+ 
Ð2bÿ0q+uZp+09q+ ÙÌp+q+؝q+¨q+€zp
+H¥ïp+É2bÿ@Ç2bÿkpp+8¥ïp
+É2bÿpÇ2bÿkpp+(¥ïp
+É2bÿ Ç2bÿkpp+¥ïp
+É2bÿÐÇ2bÿkpp+ ¨q+uZp+¨q
+PÂ2bÿŠ(Íp+eYp+؝q+pÈ2bÿy(Íp+eYp
+q+ È2bÿZ(Íp+eYp+ØÔÌp+09q+ ÙÌp+q
+Ø49q+؝q+¨q+€zp+8{=p+˜p
+Ð2bÿpkÌp+PÊ2bÿ É2bÿkpp
+5678:<=>?@BD 
Ð2bÿÐ2bÿà•p+Ð2bÿuZp+u=p
+ÐÈ2bÿ˜p+eYp+u=p+Õ_@fÆS Qöl±íÁ³dp
+Ð2bÿà•p+`Ë2bÿ0Ê2bÿkpp+u]ÞÓ     
4Q ÷U^Qʉ§¶uª¹ñìò*ēv Ð2bÿÐ2bÿHîap+4žp
+ÐÑ2bÿ¦@r+¦@r+†›p
+_Ð2bÿÑ2bÿHÐ2bÿ°Ì2bÿ?9q+uZp+Ø49q+Ó2bÿ¢@r
+àÑ2bÿpÍ2bÿÿÿÿÿÿÿÿÿ¢@r
+˜Ð2bÿ     super(TVGuideInfo, self).__init__()
+        super(PopupMenu, self).__init__()
         self.program = program
-            
+        self.buttonClicked = None
+
     def onInit(self):
-        self.getControl(self.C_INFO_IMAGE).setImage(self.program.imageLarge)
+        playControl = self.getControl(self.C_POPUP_PLAY)
+        playControl.setLabel(strings(WATCH_CHANNEL, 
self.program.channel.title))
+        if not self.program.channel.isPlayable():
+            playControl.setEnabled(False)
+            self.setFocusId(self.C_POPUP_CANCEL)
 
     def onAction(self, action):
-        self.close()
+        if action.getId() in [KEY_BACK, KEY_MENU, KEY_NAV_BACK]:
+            self.close()
+            return
 
     def onClick(self, controlId):
-        pass
+        self.buttonClicked = controlId
+        self.close()
 
     def onFocus(self, controlId):
         pass
diff --git a/script.tvguide/resources/language/Danish/strings.xml 
b/script.tvguide/resources/language/Danish/strings.xml
index e736c45..af8f5b0 100644
--- a/script.tvguide/resources/language/Danish/strings.xml
+++ b/script.tvguide/resources/language/Danish/strings.xml
@@ -9,9 +9,22 @@
     <string id="30103">XMLTV fil</string>
     <string id="30104">Slet midlertidige filer...</string>
     <string id="30105">Færdig!</string>
+    <string id="30106">Vis notifikation før udvalgte programmer 
starter</string>
+    <string id="30107">Brug program billede som baggrund</string>
+    <string id="30108">Slet alle påmindelser...</string>
+    <string id="30109">Husk at slette midlertidige filer, når du skifter 
kilde</string>
+    <string id="30110">Opdater program information når XBMC starter</string>
+
+    <string id="30150">Ups, det er pinligt!</string>
+    <string id="30151">Det var ikke muligt at indlæse program data,</string>
+    <string id="30152">prøv igen senere...</string>
+
+    <string id="30200">på [B]%s[/B] om 5 minutter...</string>
+
+    <string id="30300">Se %s</string>
+    <string id="30301">PÃ¥mind</string>
+    <string id="30302">PÃ¥mind ikke</string>
+    <string id="30303">Annuller</string>
 
-    <string id="30110">Ups, det er pinligt!</string>
-    <string id="30111">Det var ikke muligt at indlæse program data,</string>
-    <string id="30112">prøv igen senere...</string>
 </strings>
  
diff --git a/script.tvguide/resources/language/English/strings.xml 
b/script.tvguide/resources/language/English/strings.xml
index 6529561..c79af7e 100644
--- a/script.tvguide/resources/language/English/strings.xml
+++ b/script.tvguide/resources/language/English/strings.xml
@@ -9,10 +9,21 @@
     <string id="30103">XMLTV file</string>
     <string id="30104">Clear cache...</string>
     <string id="30105">Done!</string>
+    <string id="30106">Show notification before selected programs 
start</string>
+    <string id="30107">Use program image as background</string>
+    <string id="30108">Clear all reminders...</string>
+    <string id="30109">Remember to clear the cache when you change 
source</string>
+    <string id="30110">Update program information on XBMC startup</string>
 
-    <string id="30110">Oops, sorry about that!</string>
-    <string id="30111">It was not possible to load program data,</string>
-    <string id="30112">please try again later...</string>
+    <string id="30150">Oops, sorry about that!</string>
+    <string id="30151">It was not possible to load program data,</string>
+    <string id="30152">please try again later...</string>
 
+    <string id="30200">on [B]%s[/B] in 5 minutes...</string>
+
+    <string id="30300">Watch %s</string>
+    <string id="30301">Remind</string>
+    <string id="30302">Don't remind</string>
+    <string id="30303">Cancel</string>
 </strings>
 
diff --git a/script.tvguide/resources/settings.xml 
b/script.tvguide/resources/settings.xml
index fac253e..4122b02 100644
--- a/script.tvguide/resources/settings.xml
+++ b/script.tvguide/resources/settings.xml
@@ -10,8 +10,14 @@
 
         <setting id="xmltv.file" label="30103" type="file" visible="eq(-2,3)" 
/>
 
+        <setting type="lsep" label="30109" />
+
+        <setting type="sep" />
+        <setting id="program.background.enabled" label="30107" type="bool" 
default="true" />
+
         <setting type="sep" />
         <setting label="30104" type="action" 
action="RunScript($CWD/clear_cache.py)" />
+
        </category>
 </settings>
 
diff --git 
a/script.tvguide/resources/skins/Default/720p/script-tvguide-main.xml 
b/script.tvguide/resources/skins/Default/720p/script-tvguide-main.xml
index 4fb6b26..806aa54 100644
--- a/script.tvguide/resources/skins/Default/720p/script-tvguide-main.xml
+++ b/script.tvguide/resources/skins/Default/720p/script-tvguide-main.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <window>
        <allowoverlay>no</allowoverlay>
-       <defaultcontrol always="false">1</defaultcontrol>
        <coordinates>
                <system>1</system>
                <posx>0</posx>
@@ -9,13 +8,21 @@
        </coordinates>
        <controls>
                <!-- Background -->
-               <control type="image">
+               <control type="image" id="4600">
                        <posx>0</posx>
                        <posy>0</posy>
                        <width>1280</width>
                        <height>720</height>
-                       <texture>tvguide-background.png</texture>
+            <texture>tvguide-background-default.jpg</texture>
+            <fadetime>500</fadetime>
                </control>
+        <control type="image">
+            <posx>0</posx>
+            <posy>0</posy>
+            <width>1280</width>
+            <height>720</height>
+            <texture>tvguide-background.png</texture>
+        </control>
 
         <control type="group">
             <description>TV Guide group</description>
@@ -25,62 +32,70 @@
             <height>720</height>
 
             <!-- Date and time row -->
-            <control type="label" id="4000">
-                <description>Displays todays date</description>
+            <control type="group">
                 <posx>0</posx>
-                <posy>25</posy>
-                <width>180</width>
-                <height>50</height>
-                <textcolor>ffffffff</textcolor>
-                <font>font13</font>
-                <align>center</align>
-                <aligny>center</aligny>
-            </control>
-            <control type="label" id="4001">
-                <description>1st half hour column</description>
-                <posx>180</posx>
-                <posy>25</posy>
-                <width>270</width>
-                <height>50</height>
-                <textcolor>ffffffff</textcolor>
-                <font>font13</font>
-                <aligny>center</aligny>
-            </control>
-            <control type="label" id="4002">
-                <description>2nd half hour column</description>
-                <posx>455</posx>
-                <posy>25</posy>
-                <width>270</width>
+                <posy>10</posy>
+                <width>1280</width>
                 <height>50</height>
-                <textcolor>ffffffff</textcolor>
-                <font>font13</font>
-                <aligny>center</aligny>
-            </control>
-            <control type="label" id="4003">
-                <description>3rd half hour column</description>
-                <posx>730</posx>
-                <posy>25</posy>
-                <width>270</width>
-                <height>50</height>
-                <textcolor>ffffffff</textcolor>
-                <font>font13</font>
-                <aligny>center</aligny>
-            </control>
-            <control type="label" id="4004">
-                <description>4th half hour column</description>
-                <posx>1005</posx>
-                <posy>25</posy>
-                <width>270</width>
-                <height>50</height>
-                <textcolor>ffffffff</textcolor>
-                <font>font13</font>
-                <aligny>center</aligny>
+                <visible>true</visible>
+
+                <control type="label" id="4000">
+                    <description>Displays todays date</description>
+                    <posx>0</posx>
+                    <posy>0</posy>
+                    <width>180</width>
+                    <height>50</height>
+                    <textcolor>ffffffff</textcolor>
+                    <font>font13</font>
+                    <align>center</align>
+                    <aligny>center</aligny>
+                </control>
+                <control type="label" id="4001">
+                    <description>1st half hour column</description>
+                    <posx>180</posx>
+                    <posy>0</posy>
+                    <width>270</width>
+                    <height>50</height>
+                    <textcolor>ffffffff</textcolor>
+                    <font>font13</font>
+                    <aligny>center</aligny>
+                </control>
+                <control type="label" id="4002">
+                    <description>2nd half hour column</description>
+                    <posx>455</posx>
+                    <posy>0</posy>
+                    <width>270</width>
+                    <height>50</height>
+                    <textcolor>ffffffff</textcolor>
+                    <font>font13</font>
+                    <aligny>center</aligny>
+                </control>
+                <control type="label" id="4003">
+                    <description>3rd half hour column</description>
+                    <posx>730</posx>
+                    <posy>0</posy>
+                    <width>270</width>
+                    <height>50</height>
+                    <textcolor>ffffffff</textcolor>
+                    <font>font13</font>
+                    <aligny>center</aligny>
+                </control>
+                <control type="label" id="4004">
+                    <description>4th half hour column</description>
+                    <posx>1005</posx>
+                    <posy>0</posy>
+                    <width>270</width>
+                    <height>50</height>
+                    <textcolor>ffffffff</textcolor>
+                    <font>font13</font>
+                    <aligny>center</aligny>
+                </control>
             </control>
 
             <!-- Channels text column -->
             <control type="group" id="4500">
                 <posx>0</posx>
-                <posy>75</posy>
+                <posy>60</posy>
                 <width>180</width>
                 <height>400</height>
                 <visible>true</visible>
@@ -165,12 +180,22 @@
                     <font>font13</font>
                     <align>center</align>
                 </control>
+                <control type="label" id="4018">
+                    <description>9th channel</description>
+                    <posx>0</posx>
+                    <posy>400</posy>
+                    <width>180</width>
+                    <height>50</height>
+                    <textcolor>ffffffff</textcolor>
+                    <font>font13</font>
+                    <align>center</align>
+                </control>
             </control><!-- end group -->
 
             <!-- Channels icon column -->
             <control type="group" id="4501">
                 <posx>0</posx>
-                <posy>75</posy>
+                <posy>60</posy>
                 <width>180</width>
                 <height>400</height>
                 <visible>true</visible>
@@ -247,9 +272,26 @@
                     <aspectratio>keep</aspectratio>
                     <fadetime>500</fadetime>
                 </control>
+                <control type="image" id="4118">
+                    <description>9th channel</description>
+                    <posx>10</posx>
+                    <posy>400</posy>
+                    <width>160</width>
+                    <height>45</height>
+                    <aspectratio>keep</aspectratio>
+                    <fadetime>500</fadetime>
+                </control>
             </control><!-- end group -->
 
             <!-- Program description -->
+            <!--<control type="image" id="4117">-->
+                <!--<description>glasspane</description>-->
+                <!--<posx>0</posx>-->
+                <!--<posy>500</posy>-->
+                <!--<width>1280</width>-->
+                <!--<height>220</height>-->
+                <!--<texture>tvguide-glasspane.png</texture>-->
+            <!--</control>-->
             <control type="label" id="4020">
                 <description>Program title</description>
                 <posx>30</posx>
@@ -292,15 +334,15 @@
                 <width>320</width>
                 <height>160</height>
                 <aspectratio>keep</aspectratio>
-                <fadetime>250</fadetime>
+                <fadetime>500</fadetime>
                 <visible>!Control.IsVisible(4200)</visible>
             </control>
 
             <control type="image" id="4100">
                 <posx>180</posx>
-                <posy>25</posy>
+                <posy>0</posy>
                 <width>2</width>
-                <height>488</height>
+                <height>515</height>
                 <texture>timebar.png</texture>
             </control>
 
@@ -316,9 +358,9 @@
                     <posy>0</posy>
                     <width>580</width>
                     <height>60</height>
-                    <texturebg>cell-bg.png</texturebg>
+                    <texturebg>tvguide-program-grey.png</texturebg>
                     <lefttexture />
-                    <midtexture>cell-bg-selected.png</midtexture>
+                    <midtexture>tvguide-program-grey-focus.png</midtexture>
                     <righttexture />
                 </control>
                 <control type="label">
diff --git 
a/script.tvguide/resources/skins/Default/media/tvguide-background.png 
b/script.tvguide/resources/skins/Default/media/tvguide-background.png
index a70edec..71e373b 100644
Binary files 
a/script.tvguide/resources/skins/Default/media/tvguide-background.png and 
b/script.tvguide/resources/skins/Default/media/tvguide-background.png differ
diff --git a/script.tvguide/source.py b/script.tvguide/source.py
index 0b77cc7..9ad4293 100644
--- a/script.tvguide/source.py
+++ b/script.tvguide/source.py
@@ -7,17 +7,37 @@ from elementtree import ElementTree
 from strings import *
 import ysapi
 
+import xbmc
+import xbmcgui
 import pickle
 
+STREAM_DR1 = 'rtmp://rtmplive.dr.dk/live/livedr01astream3'
+STREAM_DR2 = 'rtmp://rtmplive.dr.dk/live/livedr02astream3'
+STREAM_DR_UPDATE = 'rtmp://rtmplive.dr.dk/live/livedr03astream3'
+STREAM_DR_K = 'rtmp://rtmplive.dr.dk/live/livedr04astream3'
+STREAM_DR_RAMASJANG = 'rtmp://rtmplive.dr.dk/live/livedr05astream3'
+STREAM_DR_HD = 'rtmp://livetv.gss.dr.dk/live/livedr06astream3'
+STREAM_24_NORDJYSKE = 'mms://stream.nordjyske.dk/24nordjyske - Full Broadcast 
Quality'
+
 class Channel(object):
-    def __init__(self, id, title, logo = None):
+    def __init__(self, id, title, logo = None, streamUrl = None):
         self.id = id
         self.title = title
         self.logo = logo
+        self.streamUrl = streamUrl
+
+    def isPlayable(self):
+        return hasattr(self, 'streamUrl') and self.streamUrl
+
+    def play(self):
+        print "Playing %s" % self.streamUrl
+#        item = xbmcgui.ListItem(path = self.streamUrl)
+#        item.setProperty('IsLive', 'true')
+        xbmc.Player().play(item = self.streamUrl + ' live=1')
 
     def __repr__(self):
-        return 'Channel(id=%s, title=%s, logo=%s)' \
-               % (self.id, self.title, self.logo)
+        return 'Channel(id=%s, title=%s, logo=%s, streamUrl=%s)' \
+               % (self.id, self.title, self.logo, self.streamUrl)
 
 class Program(object):
     def __init__(self, channel, title, startDate, endDate, description, 
imageLarge = None, imageSmall=None):
@@ -36,7 +56,8 @@ class Program(object):
 
 class Source(object):
     KEY = "undefiend"
-    
+    STREAMS = {}
+
     def __init__(self, settings, hasChannelIcons):
         self.channelIcons = hasChannelIcons
         self.cachePath = settings['cache.path']
@@ -44,6 +65,16 @@ class Source(object):
     def hasChannelIcons(self):
         return self.channelIcons
 
+    def updateChannelAndProgramListCaches(self):
+        print "[script.tvguide] Updating channel list caches..."
+        channelList = self.getChannelList()
+
+        for channel in channelList:
+            print "[script.tvguide] Updating program list caches for channel " 
+ channel.title.decode('iso-8859-1') + "..."
+            self.getProgramList(channel)
+
+        print "[script.tvguide] Done updating caches."
+
     def getChannelList(self):
         cacheFile = os.path.join(self.cachePath, self.KEY + '.channellist')
 
@@ -57,14 +88,18 @@ class Source(object):
         if not cacheHit:
             try:
                 channelList = self._getChannelList()
+                for channel in channelList:
+                    if self.STREAMS.has_key(channel.id):
+                        channel.streamUrl = self.STREAMS[channel.id]
+                        
                 pickle.dump(channelList, open(cacheFile, 'w'))
             except Exception, ex:
-                print "Unable to get channel list\n" + str(ex)
+                print "[script.tvguide] Unable to get channel list\n" + str(ex)
         else:
-            channelList = pickle.load(open(cacheFile))
-
-        if channelList:
-            print "Loaded %d channels" % len(channelList)
+            try:
+                channelList = pickle.load(open(cacheFile))
+            except Exception:
+                pass
 
         return channelList
 
@@ -75,8 +110,6 @@ class Source(object):
         id = str(channel.id).replace('/', '')
         cacheFile = os.path.join(self.cachePath, self.KEY + '-' + id + 
'.programlist')
 
-        print cacheFile
-
         try:
             cachedOn = 
datetime.datetime.fromtimestamp(os.path.getmtime(cacheFile))
             cacheHit = cachedOn.day == datetime.datetime.now().day
@@ -89,13 +122,10 @@ class Source(object):
                 programList = self._getProgramList(channel)
                 pickle.dump(programList, open(cacheFile, 'w'))
             except Exception, ex:
-                print "Unable to get program list for channel: " + channel + 
"\n" + str(ex)
+                print "[script.tvguide] Unable to get program list for 
channel: " + channel + "\n" + str(ex)
         else:
             programList = pickle.load(open(cacheFile))
 
-        if programList:
-            print "Loaded %d programs for channel %s" % (len(programList), 
channel.id)
-
         return programList
     
     def _getProgramList(self, channel):
@@ -110,10 +140,18 @@ class Source(object):
 
 class DrDkSource(Source):
     KEY = 'drdk'
-
     CHANNELS_URL = 
'http://www.dr.dk/tjenester/programoversigt/dbservice.ashx/getChannels?type=tv'
     PROGRAMS_URL = 
'http://www.dr.dk/tjenester/programoversigt/dbservice.ashx/getSchedule?channel_source_url=%s&broadcastDate=%s'
 
+    STREAMS = {
+        'dr.dk/mas/whatson/channel/DR1' : STREAM_DR1,
+        'dr.dk/mas/whatson/channel/DR2' : STREAM_DR2,
+        'dr.dk/external/ritzau/channel/dru' : STREAM_DR_UPDATE,
+        'dr.dk/mas/whatson/channel/TVR' : STREAM_DR_RAMASJANG,
+        'dr.dk/mas/whatson/channel/TVK' : STREAM_DR_K,
+        'dr.dk/mas/whatson/channel/TV' : STREAM_DR_HD
+    }
+
     def __init__(self, settings):
         Source.__init__(self, settings, False)
         self.date = datetime.datetime.today()
@@ -151,8 +189,14 @@ class DrDkSource(Source):
 class YouSeeTvSource(Source):
     KEY = 'youseetv'
 
-    CHANNELS_URL = 'http://yousee.tv'
-    PROGRAMS_URL = 'http://yousee.tv/feeds/tvguide/getprogrammes/?channel=%s'
+    STREAMS = {
+        1 : STREAM_DR1,
+        2 : STREAM_DR2,
+        889 : STREAM_DR_UPDATE,
+        505: STREAM_DR_RAMASJANG,
+        504 : STREAM_DR_K,
+        503 : STREAM_DR_HD
+    }
 
     def __init__(self, settings):
         Source.__init__(self, settings, True)
@@ -201,6 +245,15 @@ class TvTidSource(Source):
     BASE_URL = 'http://tvtid.tv2.dk%s'
     FETCH_URL = BASE_URL % '/js/fetch.js.php/from-%d.js'
 
+    STREAMS = {
+        11825154 : STREAM_DR1,
+        11823606 : STREAM_DR2,
+        11841417 : STREAM_DR_UPDATE,
+        25995179 : STREAM_DR_RAMASJANG,
+        26000893 : STREAM_DR_K,
+        26005640 : STREAM_DR_HD
+    }
+
     def __init__(self, settings):
         Source.__init__(self, settings, True)
         self.time = time.time()
@@ -214,6 +267,7 @@ class TvTidSource(Source):
 
         channelList = list()
         for channel in json['channels']:
+            print str(channel['id']) + " - " + channel['name'].encode('utf-8', 
'replace')
             logoFile = self.BASE_URL % channel['logo']
 
             c = Channel(id = channel['id'], title = channel['name'], logo = 
logoFile)
diff --git a/script.tvguide/strings.py b/script.tvguide/strings.py
index f0efe26..2d850a9 100644
--- a/script.tvguide/strings.py
+++ b/script.tvguide/strings.py
@@ -7,11 +7,18 @@ NO_STREAM_AVAILABLE_LINE1 = 30101
 NO_STREAM_AVAILABLE_LINE2 = 30102
 
 CLEAR_CACHE = 30104
-CLEAR_CACHE_DONE = 30105
+CLEAR_NOTIFICATIONS = 30108
+DONE = 30105
 
-LOAD_ERROR_TITLE = 30110
-LOAD_ERROR_LINE1 = 30111
-LOAD_ERROR_LINE2 = 30112
+LOAD_ERROR_TITLE = 30150
+LOAD_ERROR_LINE1 = 30151
+LOAD_ERROR_LINE2 = 30152
+
+NOTIFICATION_TEMPLATE = 30200
+
+WATCH_CHANNEL = 30300
+REMIND_PROGRAM = 30301
+DONT_REMIND_PROGRAM = 30302
 
 def strings(id, replacements = None):
     string = xbmcaddon.Addon(id = 'script.tvguide').getLocalizedString(id)
diff --git a/script.tvguide/ysapi.py b/script.tvguide/ysapi.py
index aaa5736..33abc7c 100644
--- a/script.tvguide/ysapi.py
+++ b/script.tvguide/ysapi.py
@@ -73,10 +73,7 @@ class YouSeeTVGuideApi(YouSeeApi):
 
 if __name__ == '__main__':
     api = YouSeeTVGuideApi()
-    json = api.channels()
-
-    #api = YouSeeMovieApi()
-    #print api.moviesInGenre('action')['movies'][0]
+    json = api.programs(1)
 
     s = simplejson.dumps(json, sort_keys=True, indent='    ')
     print '\n'.join([l.rstrip() for l in  s.splitlines()])

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                                         |    3 +
 script.tvguide/addon.py                            |    6 +-
 script.tvguide/addon.xml                           |    2 +-
 script.tvguide/changelog.txt                       |    5 +
 script.tvguide/clear_cache.py                      |    5 +-
 script.tvguide/gui.py                              |   66 ++++++---
 .../resources/language/Danish/strings.xml          |   19 ++-
 .../resources/language/English/strings.xml         |   17 ++-
 script.tvguide/resources/settings.xml              |    6 +
 .../skins/Default/720p/script-tvguide-main.xml     |  158 ++++++++++++-------
 .../skins/Default/720p/script-tvguide-menu.xml     |   52 +++++++
 .../Default/media/tvguide-background-default.jpg   |  Bin 0 -> 16124 bytes
 .../skins/Default/media/tvguide-background.png     |  Bin 243177 -> 5419 bytes
 .../Default/media/tvguide-program-grey-focus.png   |  Bin 0 -> 6092 bytes
 .../skins/Default/media/tvguide-program-grey.png   |  Bin 0 -> 4453 bytes
 .../Default/media/tvguide-program-red-focus.png    |  Bin 0 -> 3503 bytes
 .../skins/Default/media/tvguide-program-red.png    |  Bin 0 -> 3105 bytes
 script.tvguide/source.py                           |   90 +++++++++---
 script.tvguide/strings.py                          |   15 ++-
 script.tvguide/ysapi.py                            |    5 +-
 20 files changed, 331 insertions(+), 118 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 
script.tvguide/resources/skins/Default/720p/script-tvguide-menu.xml
 create mode 100644 
script.tvguide/resources/skins/Default/media/tvguide-background-default.jpg
 create mode 100644 
script.tvguide/resources/skins/Default/media/tvguide-program-grey-focus.png
 create mode 100644 
script.tvguide/resources/skins/Default/media/tvguide-program-grey.png
 create mode 100644 
script.tvguide/resources/skins/Default/media/tvguide-program-red-focus.png
 create mode 100644 
script.tvguide/resources/skins/Default/media/tvguide-program-red.png


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to