The branch, dharma has been updated
       via  a40ea7baff1e95431ea4e8cf00bb15d000f0a3a5 (commit)
       via  d84d27fb4beaf0d7f69ccf5b467b9bc107e2e2ea (commit)
      from  e9558f523707c847ddc81b3add58e1fb5655ea5b (commit)

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

commit a40ea7baff1e95431ea4e8cf00bb15d000f0a3a5
Author: amet <[email protected]>
Date:   Tue Sep 13 00:53:00 2011 +0400

    [script.xbmc-pbx-addon] -0.0.8
    
      * Updated images (fanart and icons) to comply with this guideline: 
http://wiki.xbmc.org/index.php?title=Add-ons_for_XBMC_%28Development%29
      * Removed (unnecessary) check for Linux64 that was causing trouble with 
XBMC Eden(-pre). Thanks freebs (XBMC Forum member);
      * Added option to disable background service (so video is not going to be 
paused and notification popups are not going to be shown);
      * Added check for Front-end and Back-end versions to make sure they match;
      * Some other minor changes;

diff --git a/script.xbmc-pbx-addon/addon.xml b/script.xbmc-pbx-addon/addon.xml
index 81b1780..64e919a 100644
--- a/script.xbmc-pbx-addon/addon.xml
+++ b/script.xbmc-pbx-addon/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <addon id="script.xbmc-pbx-addon"
     name="XBMC PBX Addon" 
-    version="0.0.7" 
+    version="0.0.8" 
     provider-name="hmronline">
     <requires>
         <import addon="xbmc.python" version="1.0"/>
diff --git a/script.xbmc-pbx-addon/backend_files/manager_custom.conf 
b/script.xbmc-pbx-addon/backend_files/manager_custom.conf
index a9c8259..809ce38 100644
--- a/script.xbmc-pbx-addon/backend_files/manager_custom.conf
+++ b/script.xbmc-pbx-addon/backend_files/manager_custom.conf
@@ -1,6 +1,6 @@
 [xbmc]
 secret  = xbmc
-deny    = 0.0.0.0/0.0.0.0
-permit  = 192.168.1.4
+;deny    = 0.0.0.0/0.0.0.0
+;permit  = 192.168.1.4
 read    = system,call,command,dialplan,originate
 write   = call,command,dialplan,originate
diff --git a/script.xbmc-pbx-addon/backend_files/xbmc-pbx-addon.php 
b/script.xbmc-pbx-addon/backend_files/xbmc-pbx-addon.php
index ac63a31..a869b51 100644
--- a/script.xbmc-pbx-addon/backend_files/xbmc-pbx-addon.php
+++ b/script.xbmc-pbx-addon/backend_files/xbmc-pbx-addon.php
@@ -12,7 +12,7 @@ $__addon__              = "XBMC PBX Addon";
 $__addon_id__           = "script.xbmc-pbx-addon";
 $__author__             = "hmronline";
 $__url__                = "http://code.google.com/p/xbmc-pbx-addon/";;
-$__version__            = "0.0.7";
+$__version__            = "0.0.8";
 
 
 // 
************************************************************************************************************
@@ -92,6 +92,9 @@ elseif (isset($_GET["cdr"]) || isset($_GET["vm"])) {
     $xmldoc->formatOutput = true;
     $xmlroot = $xmldoc->createElement("pbx");
     $xmldoc->appendChild($xmlroot);
+    $node = $xmldoc->createElement("version");
+    $node->appendChild($xmldoc->createTextNode($__version__));
+    $xmlroot->appendChild($node);
     if (isset($_GET["cdr"])) {
         //
         // Call Detail Records (CDR)
diff --git a/script.xbmc-pbx-addon/bgservice.py 
b/script.xbmc-pbx-addon/bgservice.py
index e440f1f..92a19c5 100644
--- a/script.xbmc-pbx-addon/bgservice.py
+++ b/script.xbmc-pbx-addon/bgservice.py
@@ -12,7 +12,7 @@ __addon__       = "XBMC PBX Addon"
 __addon_id__    = "script.xbmc-pbx-addon"
 __author__      = "hmronline"
 __url__         = "http://code.google.com/p/xbmc-pbx-addon/";
-__version__     = "0.0.7"
+__version__     = "0.0.8"
 
 # Modules
 import sys, os
@@ -24,12 +24,6 @@ xbmc.log("[%s]: Version %s\n" % (__addon__,__version__))
 
 # Get environment OS
 __os__          = os.environ.get( "OS", "win32" )
-# Check to see if using a 64bit version of Linux
-if re.match("Linux", __os__):
-        import platform
-        env2 = platform.machine()
-        if(env2 == "x86_64"):
-                __os__ = "Linux64"
 xbmc.log("[%s]: XBMC for %s\n" % (__addon__,__os__))
 
 __language__    = xbmcaddon.Addon(__addon_id__).getLocalizedString
@@ -156,9 +150,9 @@ class get_incoming_call(object):
         settings = xbmcaddon.Addon(__addon_id__)
         arr_timeout = [5,10,15,20,25,30]
         xbmc_oncall_notification_timeout = 
int(arr_timeout[int(settings.getSetting("xbmc_oncall_notification_timeout"))])
-        cfg_asterisk_cid_alert_info = 
settings.getSetting("asterisk_cid_alert_info")
-        cfg_asterisk_redir_alert_info = 
settings.getSetting("asterisk_redir_alert_info")
-        asterisk_now_playing_context = 
settings.getSetting("asterisk_now_playing_context")
+        cfg_asterisk_cid_alert_info = 
settings.getSetting("asterisk_cid_alert_info").strip(' \t\n\r')
+        cfg_asterisk_redir_alert_info = 
settings.getSetting("asterisk_redir_alert_info").strip(' \t\n\r')
+        asterisk_now_playing_context = 
settings.getSetting("asterisk_now_playing_context").strip(' \t\n\r')
         xbmc_img = 
xbmc.translatePath(os.path.join(RESOURCE_PATH,'media','xbmc-pbx-addon.png'))
         xbmc_oncall_pause_media = False
         if (settings.getSetting("xbmc_oncall_pause_media") == "true"):
@@ -227,24 +221,30 @@ try:
     log("Running in background...")
     settings = xbmcaddon.Addon(__addon_id__)
     DEBUG = settings.getSetting("xbmc_debug")
+    xbmc_bgservice = settings.getSetting("xbmc_bgservice")
     manager_host_port = 
settings.getSetting("asterisk_manager_host"),int(settings.getSetting("asterisk_manager_port"))
-    pbx = 
Manager(manager_host_port,settings.getSetting("asterisk_manager_user"),settings.getSetting("asterisk_manager_pass"))
+    manager_user = settings.getSetting("asterisk_manager_user")
+    manager_pass = settings.getSetting("asterisk_manager_pass")
     vm = settings.getSetting("asterisk_vm_mailbox") +"@"+ 
settings.getSetting("asterisk_vm_context")
     arr_timeout = [5,10,15,20,25,30]
     xbmc_vm_notification_timeout = 
int(arr_timeout[int(settings.getSetting("xbmc_vm_notification_timeout"))])
     del settings
-    asterisk_version = str(pbx.Command("core show version")[1])
-    asterisk_series = asterisk_version[9:12]
-    if (DEBUG == "true"): log(">> " + asterisk_version)
-    log(">> Asterisk: " + asterisk_series)
-    vm_count = str(pbx.MailboxCount(vm)[0])
-    xbmc_notification = __language__(30053) + vm_count
-    xbmc_img = 
xbmc.translatePath(os.path.join(RESOURCE_PATH,'media','xbmc-pbx-addon.png'))
-    log(">> Notification: " + xbmc_notification)
-    xbmc.executebuiltin("XBMC.Notification("+ __language__(30052) +","+ 
xbmc_notification +","+ str(xbmc_vm_notification_timeout*1000) +","+ xbmc_img 
+")")
-    grab = get_incoming_call()
-    pbx.events += grab.events
-    pbx.serve_forever()
+    if (xbmc_bgservice == "true"):
+        log(">> Background service is disabled.")
+    else:
+        pbx = Manager(manager_host_port,manager_user,manager_pass)
+        asterisk_version = str(pbx.Command("core show version")[1])
+        asterisk_series = asterisk_version[9:12]
+        if (DEBUG == "true"): log(">> " + asterisk_version)
+        log(">> Asterisk: " + asterisk_series)
+        vm_count = str(pbx.MailboxCount(vm)[0])
+        xbmc_notification = __language__(30053) + vm_count
+        xbmc_img = 
xbmc.translatePath(os.path.join(RESOURCE_PATH,'media','xbmc-pbx-addon.png'))
+        log(">> Notification: " + xbmc_notification)
+        xbmc.executebuiltin("XBMC.Notification("+ __language__(30052) +","+ 
xbmc_notification +","+ str(xbmc_vm_notification_timeout*1000) +","+ xbmc_img 
+")")
+        grab = get_incoming_call()
+        pbx.events += grab.events
+        pbx.serve_forever()
 except:
     xbmc_notification = str(sys.exc_info()[1])
     xbmc_img = 
xbmc.translatePath(os.path.join(RESOURCE_PATH,'media','xbmc-pbx-addon.png'))
@@ -253,7 +253,6 @@ except:
 try:
     del grab
     del pbx
-    sys.modules.clear()
 except:
     pass
 
diff --git a/script.xbmc-pbx-addon/changelog.txt 
b/script.xbmc-pbx-addon/changelog.txt
index 3ac93b3..19993f6 100644
--- a/script.xbmc-pbx-addon/changelog.txt
+++ b/script.xbmc-pbx-addon/changelog.txt
@@ -1,58 +1,68 @@
-= Changelog =

-

-== 0.0.7 ==

-  * Several fixes and improvements done by oneadvent (XBMC Forum member) 
Thanks!;

-  * Made it compatible with Dharma and Eden XBMC releases;

-    * Tested it on XBMC for Linux, Windows, XBMC4XBOX 3.0.1 and LiveCD;

-  * Added some checks and instructions on server-side;

-  * Added settings for VoiceMail notification timeout;

-  * Added settings to display Caller ID and/or pause video only if ALERT_INFO 
matches;

-  * Added setting to enable/disable DEBUG;

-  * Updated py-asterisk library to version 0.2;

-  * Fixed VoiceMail sorting;

-  * Added a "Refresh" button, so new CDR and VM information is retrieved from 
Asterisk;

-  * GUI moved from PAL to 720p default resolution;

-  * Added fanart;

-

-== 0.0.6 ==

-  * Fixed support for both Asterisk 1.4 and Asterisk 1.6;

-  * Added ability to delete Voice Mail;

-  * Rewrote skin to avoid localization bug and changed layout;

-  * Added Music Player controls while playing Voice Mail;

-  * Plus a few other changes and fixes;

-

-== 0.0.5 ==

-  * Added new setting to redirect calls if ALERT_INFO matches;

-  * Restricted AMI permissions;

-  * Re-arranged script settings;

-  * Added script image on notifications, tbn, etc;

-  * Some other minor changes;

-

-== 0.0.4 ==

-  * Changed the way script settings are used, making possible to reflect them 
immediately;

-  * Script splitted in two files (one for background and another for GUI) as 
XBox is unable to run the same script twice;

-  * Some fixes;

-

-== 0.0.3 ==

-  * Updated py-asterisk library;

-  * Added VoiceMail Context configuration;

-  * Added NewChannel State configuration;

-  * Added VoiceMail count notification on script startup;

-  * Added ability to Redirect(Transfer) phone calls if playing video;

-  * Some fixes;

-

-== 0.0.2 ==

-  * Added some error handling and messages for missing CDR & VM 
files/directory;

-  * Some fixes;

-

-== 0.0.1 ==

-  * Started a GUI using WindowsXML;

-  * GUI skinnable and supporting internationalization;

-  * Instructions are shown on first use;

-  * Partially working functionality:

-    * XBMC actions (i.e. Caller ID notification popup) based on Asterisk 
events;

-    * Displaying CDR info into XBMC;

-    * Initiating an outgoing phone call for the selected record;

-    * Displaying Voice Mail info into XBMC;

-    * Should be able to play the VoiceMail recorded message into XBMC.

-

+= Changelog =
+
+== 0.0.8 ==
+  * Updated images (fanart and icons) to comply with this guideline: 
http://wiki.xbmc.org/index.php?title=Add-ons_for_XBMC_%28Development%29
+  * Removed (unnecessary) check for Linux64 that was causing trouble with XBMC 
Eden(-pre). Thanks freebs (XBMC Forum member);
+  * Added option to disable background service (so video is not going to be 
paused and notification popups are not going to be shown);
+  * Added check for Front-end and Back-end versions to make sure they match;
+  * Some other minor changes;
+
+== 1.0.7 ==
+  * Minor updates to make it compatible with the Official XBMC Eden(-pre) 
Add-on repository;
+
+== 0.0.7 ==
+  * Several fixes and improvements done by oneadvent (XBMC Forum member) 
Thanks!;
+  * Made it compatible with Dharma and Eden XBMC releases;
+    * Tested it on XBMC for Linux, Windows, XBMC4XBOX 3.0.1 and LiveCD;
+  * Added some checks and instructions on server-side;
+  * Added settings for VoiceMail notification timeout;
+  * Added settings to display Caller ID and/or pause video only if ALERT_INFO 
matches;
+  * Added setting to enable/disable DEBUG;
+  * Updated py-asterisk library to version 0.2;
+  * Fixed VoiceMail sorting;
+  * Added a "Refresh" button, so new CDR and VM information is retrieved from 
Asterisk;
+  * GUI moved from PAL to 720p default resolution;
+  * Added fanart;
+
+== 0.0.6 ==
+  * Fixed support for both Asterisk 1.4 and Asterisk 1.6;
+  * Added ability to delete Voice Mail;
+  * Rewrote skin to avoid localization bug and changed layout;
+  * Added Music Player controls while playing Voice Mail;
+  * Plus a few other changes and fixes;
+
+== 0.0.5 ==
+  * Added new setting to redirect calls if ALERT_INFO matches;
+  * Restricted AMI permissions;
+  * Re-arranged script settings;
+  * Added script image on notifications, tbn, etc;
+  * Some other minor changes;
+
+== 0.0.4 ==
+  * Changed the way script settings are used, making possible to reflect them 
immediately;
+  * Script splitted in two files (one for background and another for GUI) as 
XBox is unable to run the same script twice;
+  * Some fixes;
+
+== 0.0.3 ==
+  * Updated py-asterisk library;
+  * Added VoiceMail Context configuration;
+  * Added NewChannel State configuration;
+  * Added VoiceMail count notification on script startup;
+  * Added ability to Redirect(Transfer) phone calls if playing video;
+  * Some fixes;
+
+== 0.0.2 ==
+  * Added some error handling and messages for missing CDR & VM 
files/directory;
+  * Some fixes;
+
+== 0.0.1 ==
+  * Started a GUI using WindowsXML;
+  * GUI skinnable and supporting internationalization;
+  * Instructions are shown on first use;
+  * Partially working functionality:
+    * XBMC actions (i.e. Caller ID notification popup) based on Asterisk 
events;
+    * Displaying CDR info into XBMC;
+    * Initiating an outgoing phone call for the selected record;
+    * Displaying Voice Mail info into XBMC;
+    * Should be able to play the VoiceMail recorded message into XBMC.
+
diff --git a/script.xbmc-pbx-addon/default.py b/script.xbmc-pbx-addon/default.py
index a55343b..b1ef3ca 100644
--- a/script.xbmc-pbx-addon/default.py
+++ b/script.xbmc-pbx-addon/default.py
@@ -12,7 +12,7 @@ __addon__       = "XBMC PBX Addon"
 __addon_id__    = "script.xbmc-pbx-addon"
 __author__      = "hmronline"
 __url__         = "http://code.google.com/p/xbmc-pbx-addon/";
-__version__     = "0.0.7"
+__version__     = "0.0.8"
 
 # Modules
 import sys, os
@@ -24,12 +24,6 @@ xbmc.log("[%s]: Version %s\n" % (__addon__,__version__))
 
 # Get environment OS
 __os__          = os.environ.get( "OS", "win32" )
-# Check to see if using a 64bit version of Linux
-if re.match("Linux", __os__):
-        import platform
-        env2 = platform.machine()
-        if(env2 == "x86_64"):
-                __os__ = "Linux64"
 xbmc.log("[%s]: XBMC for %s\n" % (__addon__,__os__))
 
 __language__    = xbmcaddon.Addon(__addon_id__).getLocalizedString
@@ -117,14 +111,18 @@ class MainGUI(xbmcgui.WindowXML):
         log("> getInfo()")
         settings = xbmcaddon.Addon(__addon_id__)
         manager_host_port = 
settings.getSetting("asterisk_manager_host"),int(settings.getSetting("asterisk_manager_port"))
-        pbx = 
Manager(manager_host_port,settings.getSetting("asterisk_manager_user"),settings.getSetting("asterisk_manager_pass"))
+        manager_user = settings.getSetting("asterisk_manager_user")
+        manager_pass = settings.getSetting("asterisk_manager_pass")
+        asterisk_vm_mailbox = settings.getSetting("asterisk_vm_mailbox")
+        asterisk_vm_context = settings.getSetting("asterisk_vm_context")
+        str_url = settings.getSetting("asterisk_info_url")
+        del settings
+        pbx = Manager(manager_host_port,manager_user,manager_pass)
         asterisk_version = str(pbx.Command("core show version")[1])
         del pbx
         log(">> " + asterisk_version)
-        str_url = settings.getSetting("asterisk_info_url")
-        str_url = str_url +"?vm&cdr&mailbox="+ 
settings.getSetting("asterisk_vm_mailbox")
-        str_url = str_url +"&vmcontext="+ 
settings.getSetting("asterisk_vm_context")
-        del settings
+        str_url = str_url +"?vm&cdr&mailbox="+ asterisk_vm_mailbox
+        str_url = str_url +"&vmcontext="+ asterisk_vm_context
         if (self.DEBUG):
             log(">> " + str_url)
         f = urllib.urlopen(str_url)
@@ -137,6 +135,9 @@ class MainGUI(xbmcgui.WindowXML):
     
#####################################################################################################
     def showInfo(self):
         log("> showInfo()")
+        backend_version = "unknown"
+        for node in self.dom.getElementsByTagName('version'):
+            backend_version = node.firstChild.data
         options = {"cdr":120,"vm":121}
         if (__os__ == 'xbox'): xbmcgui.lock()
         for option in options.keys():
@@ -154,6 +155,12 @@ class MainGUI(xbmcgui.WindowXML):
                 del listitem
         if (__os__ == 'xbox'): xbmcgui.unlock()
         del self.dom
+        if (backend_version != __version__):
+            log(">> Version mismatch!: Frontend is " + __version__ + " while 
Backend is " + backend_version)
+            xbmc_notification = "You have to update the backend!"
+            xbmc_img = 
xbmc.translatePath(os.path.join(RESOURCE_PATH,'media','xbmc-pbx-addon.png'))
+            log(">> Notification: " + xbmc_notification)
+            xbmc.executebuiltin("XBMC.Notification("+ __language__(30051) 
+","+ xbmc_notification +","+ str(15*1000) +","+ xbmc_img +")")
 
     
#####################################################################################################
     def onAction(self,action):
diff --git a/script.xbmc-pbx-addon/fanart.jpg b/script.xbmc-pbx-addon/fanart.jpg
index aba9238..86e3bdb 100644
Binary files a/script.xbmc-pbx-addon/fanart.jpg and 
b/script.xbmc-pbx-addon/fanart.jpg differ
diff --git a/script.xbmc-pbx-addon/icon.png b/script.xbmc-pbx-addon/icon.png
index 87c144c..771868c 100644
Binary files a/script.xbmc-pbx-addon/icon.png and 
b/script.xbmc-pbx-addon/icon.png differ
diff --git a/script.xbmc-pbx-addon/resources/language/English/strings.xml 
b/script.xbmc-pbx-addon/resources/language/English/strings.xml
index a14c6c4..ce7ef55 100644
--- a/script.xbmc-pbx-addon/resources/language/English/strings.xml
+++ b/script.xbmc-pbx-addon/resources/language/English/strings.xml
@@ -4,6 +4,7 @@
     <string id="30001">Info</string>
     <string id="30002">URL</string>
     <string id="30003">Debug</string>
+    <string id="30004">Disable background service</string>
 
     <!-- Script Settings related strings -->
     <!-- Connection -->
diff --git a/script.xbmc-pbx-addon/resources/media/xbmc-pbx-addon.png 
b/script.xbmc-pbx-addon/resources/media/xbmc-pbx-addon.png
index 36c152b..beb93ad 100755
Binary files a/script.xbmc-pbx-addon/resources/media/xbmc-pbx-addon.png and 
b/script.xbmc-pbx-addon/resources/media/xbmc-pbx-addon.png differ
diff --git a/script.xbmc-pbx-addon/resources/settings.xml 
b/script.xbmc-pbx-addon/resources/settings.xml
index 5252cf4..83e09bc 100644
--- a/script.xbmc-pbx-addon/resources/settings.xml
+++ b/script.xbmc-pbx-addon/resources/settings.xml
@@ -5,6 +5,7 @@
         <setting id="first_time_use" type="bool" default="true" 
visible="false"/>
         <setting id="info" type="text" label="30002" 
default="http://code.google.com/p/xbmc-pbx-addon/"; enable="false"/>
         <setting id="xbmc_debug" type="bool" label="30003" default="false"/>
+        <setting id="xbmc_bgservice" type="bool" label="30004" 
default="false"/>
     </category>
     <category label="30010">
         <!-- Connection -->
diff --git 
a/script.xbmc-pbx-addon/resources/skins/Default/media/xbmc-pbx-addon.png 
b/script.xbmc-pbx-addon/resources/skins/Default/media/xbmc-pbx-addon.png
index 36c152b..beb93ad 100644
Binary files 
a/script.xbmc-pbx-addon/resources/skins/Default/media/xbmc-pbx-addon.png and 
b/script.xbmc-pbx-addon/resources/skins/Default/media/xbmc-pbx-addon.png differ

http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=d84d27fb4beaf0d7f69ccf5b467b9bc107e2e2ea

commit d84d27fb4beaf0d7f69ccf5b467b9bc107e2e2ea
Author: amet <[email protected]>
Date:   Tue Sep 13 00:51:55 2011 +0400

    [script.tvguide] - 0.3.1
    
    - Made paging of channels more logical to navigate
    - Better handling of errors if EPG data is unavailable
    - Improved visual feedback while loading
    - Added option in settings to clear cached EPG data (useful if you change 
source)

diff --git a/script.tvguide/addon.xml b/script.tvguide/addon.xml
index b3d9f2f..098968a 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.0"
+       version="0.3.1"
        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 ec05286..0e5b9c4 100644
--- a/script.tvguide/changelog.txt
+++ b/script.tvguide/changelog.txt
@@ -1,3 +1,9 @@
+[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
+- Improved visual feedback while loading
+- Added option in settings to clear cached EPG data (useful if you change 
source)
+
 [B]Version 0.3.0 - 2011-08-17[/B]
 - Major restructuring
 - Updated YouSee source to use official API
diff --git a/script.tvguide/gui.py b/script.tvguide/gui.py
index e0cafb0..6f09607 100644
--- a/script.tvguide/gui.py
+++ b/script.tvguide/gui.py
@@ -37,6 +37,7 @@ class TVGuide(xbmcgui.WindowXML):
     C_MAIN_DESCRIPTION = 4022
     C_MAIN_IMAGE = 4023
     C_MAIN_LOADING = 4200
+    C_MAIN_LOADING_PROGRESS = 4201
 
     def __new__(cls, source):
         return super(TVGuide, cls).__new__(cls, 'script-tvguide-main.xml', 
ADDON.getAddonInfo('path'))
@@ -47,18 +48,18 @@ class TVGuide(xbmcgui.WindowXML):
         self.source = source
         self.controlToProgramMap = {}
         self.focusX = 0
-        self.channelIndex = 0
+        self.page = 0
 
         # find nearest half hour
         self.date = datetime.datetime.today()
         self.date -= datetime.timedelta(minutes = self.date.minute % 30)
 
     def onInit(self):
-        self._redrawEpg(0, self.date)
+        self.onRedrawEPG(0, self.date)
         self.getControl(self.C_MAIN_IMAGE).setImage('tvguide-logo-%s.png' % 
self.source.KEY)
 
     def onAction(self, action):
-        if action.getId() == KEY_BACK or action.getId() == KEY_MENU or 
action.getId() == KEY_NAV_BACK:
+        if action.getId() in [KEY_BACK, KEY_MENU, KEY_NAV_BACK]:
             self.close()
             return
 
@@ -67,8 +68,9 @@ class TVGuide(xbmcgui.WindowXML):
             (left, top) = controlInFocus.getPosition()
             currentX = left + (controlInFocus.getWidth() / 2)
             currentY = top + (controlInFocus.getHeight() / 2)
-        except TypeError, ex:
-            return # ignore
+        except TypeError:
+            currentX = None
+            currentY = None
 
         control = None
 
@@ -116,7 +118,7 @@ class TVGuide(xbmcgui.WindowXML):
         control = self._findControlOnLeft(currentX, currentY)
         if control is None:
             self.date -= datetime.timedelta(hours = 2)
-            self._redrawEpg(self.channelIndex, self.date)
+            self.onRedrawEPG(self.page, self.date)
             control = self._findControlOnLeft(1280, currentY)
 
         (left, top) = control.getPosition()
@@ -127,7 +129,7 @@ class TVGuide(xbmcgui.WindowXML):
         control = self._findControlOnRight(currentX, currentY)
         if control is None:
             self.date += datetime.timedelta(hours = 2)
-            self._redrawEpg(self.channelIndex, self.date)
+            self.onRedrawEPG(self.page, self.date)
             control = self._findControlOnRight(0, currentY)
 
         (left, top) = control.getPosition()
@@ -137,32 +139,32 @@ class TVGuide(xbmcgui.WindowXML):
     def _up(self, currentY):
         control = self._findControlAbove(currentY)
         if control is None:
-            self.channelIndex = self._redrawEpg(self.channelIndex - 
CHANNELS_PER_PAGE, self.date)
+            self.page = self.onRedrawEPG(self.page - 1, self.date)
             control = self._findControlAbove(720)
         return control
 
     def _down(self, currentY):
         control = self._findControlBelow(currentY)
         if control is None:
-            self.channelIndex = self._redrawEpg(self.channelIndex + 
CHANNELS_PER_PAGE, self.date)
+            self.page = self.onRedrawEPG(self.page + 1, self.date)
             control = self._findControlBelow(0)
         return control
 
     def _pageUp(self):
-        self.channelIndex = self._redrawEpg(self.channelIndex - 
CHANNELS_PER_PAGE, self.date)
+        self.page = self.onRedrawEPG(self.page - 1, self.date)
         return self._findControlAbove(720)
 
     def _pageDown(self):
-        self.channelIndex = self._redrawEpg(self.channelIndex + 
CHANNELS_PER_PAGE, self.date)
+        self.page = self.onRedrawEPG(self.page+ 1, self.date)
         return self._findControlBelow(0)
 
-    def _redrawEpg(self, startChannel, startTime):
-        for controlId in self.controlToProgramMap.keys():
-            self.removeControl(self.getControl(controlId))
-
+    def onRedrawEPG(self, page, startTime):
+        oldControltoProgramMap = self.controlToProgramMap.copy()
         self.controlToProgramMap.clear()
+
+        progressControl = self.getControl(self.C_MAIN_LOADING_PROGRESS)
+        progressControl.setPercent(0)
         self.getControl(self.C_MAIN_LOADING).setVisible(True)
-        xbmc.sleep(250)
 
         # move timebar to current time
         timeDelta = datetime.datetime.today() - self.date
@@ -181,19 +183,30 @@ class TVGuide(xbmcgui.WindowXML):
 
         # channels
         channels = self.source.getChannelList()
-        if startChannel < 0:
-            startChannel = len(channels) - CHANNELS_PER_PAGE
-        elif startChannel > len(channels) - CHANNELS_PER_PAGE:
-            startChannel = 0
+        if channels is None:
+            self.onEPGLoadError()
+            return
+        totalPages = len(channels) / CHANNELS_PER_PAGE
+        if len(channels) % CHANNELS_PER_PAGE == 0:
+            totalPages -= 1
 
-        controlsToAdd = list()
-        for idx, channel in enumerate(channels[startChannel : startChannel + 
CHANNELS_PER_PAGE]):
-            if self.source.hasChannelIcons() and channel.logo is not None:
-                self.getControl(4110 + idx).setImage(channel.logo)
-            else:
-                self.getControl(4010 + idx).setLabel(channel.title)
+        if page < 0:
+            page = totalPages
+        elif page > totalPages:
+            page = 0
+
+        channelStart = page * CHANNELS_PER_PAGE
+        channelEnd = page * CHANNELS_PER_PAGE + CHANNELS_PER_PAGE
 
-            for program in self.source.getProgramList(channel):
+        controlsToAdd = list()
+        for idx, channel in enumerate(channels[channelStart : channelEnd]):
+            progressControl.setPercent(idx * 100 / CHANNELS_PER_PAGE)
+            programs = self.source.getProgramList(channel)
+            if programs is None:
+                self.onEPGLoadError()
+                return
+
+            for program in programs:
                 if program.endDate <= self.date:
                     continue
 
@@ -220,6 +233,10 @@ class TVGuide(xbmcgui.WindowXML):
                     controlsToAdd.append([control, program])
 
 
+        for controlId in oldControltoProgramMap:
+            self.removeControl(self.getControl(controlId))
+
+        # add program controls
         for control, program in controlsToAdd:
             self.addControl(control)
             self.controlToProgramMap[control.getId()] = program
@@ -232,8 +249,25 @@ class TVGuide(xbmcgui.WindowXML):
 
         self.getControl(self.C_MAIN_LOADING).setVisible(False)
 
-        return startChannel
+        # set channel logo or text
+        channelsToShow = channels[channelStart : channelEnd]
+        for idx in range(0, CHANNELS_PER_PAGE):
+            if idx >= len(channelsToShow):
+                self.getControl(4110 + idx).setImage('')
+                self.getControl(4010 + idx).setLabel('')
+            else:
+                channel = channelsToShow[idx]
+                if self.source.hasChannelIcons() and channel.logo is not None:
+                    self.getControl(4110 + idx).setImage(channel.logo)
+                else:
+                    self.getControl(4010 + idx).setLabel(channel.title)
 
+        return page
+
+    def onEPGLoadError(self):
+        self.getControl(self.C_MAIN_LOADING).setVisible(False)
+        xbmcgui.Dialog().ok(strings(LOAD_ERROR_TITLE), 
strings(LOAD_ERROR_LINE1), strings(LOAD_ERROR_LINE2))
+        self.close()
 
     def _secondsToXposition(self, seconds):
         return CELL_WIDTH_CHANNELS + (seconds * CELL_WIDTH / 1800)
@@ -280,12 +314,13 @@ class TVGuide(xbmcgui.WindowXML):
 
         for controlId in self.controlToProgramMap.keys():
             control = self.getControl(controlId)
-            (left, top) = control.getPosition()
+            (leftEdge, top) = control.getPosition()
             y = top + (control.getHeight() / 2)
 
             if currentY < y:
-                if(left <= self.focusX and left + control.getWidth() > 
self.focusX
-                    and (nearestControl is None or 
nearestControl.getPosition()[1] > top)):
+                rightEdge = leftEdge + control.getWidth()
+                if(leftEdge <= self.focusX < rightEdge
+                   and (nearestControl is None or 
nearestControl.getPosition()[1] > top)):
                     nearestControl = control
 
         return nearestControl
@@ -295,12 +330,13 @@ class TVGuide(xbmcgui.WindowXML):
 
         for controlId in self.controlToProgramMap.keys():
             control = self.getControl(controlId)
-            (left, top) = control.getPosition()
+            (leftEdge, top) = control.getPosition()
             y = top + (control.getHeight() / 2)
 
             if currentY > y:
-                if(left <= self.focusX and left + control.getWidth() > 
self.focusX
-                    and (nearestControl is None or 
nearestControl.getPosition()[1] < top)):
+                rightEdge = leftEdge + control.getWidth()
+                if(leftEdge <= self.focusX < rightEdge
+                   and (nearestControl is None or 
nearestControl.getPosition()[1] < top)):
                     nearestControl = control
 
         return nearestControl
diff --git a/script.tvguide/resources/language/Danish/strings.xml 
b/script.tvguide/resources/language/Danish/strings.xml
index 20415f0..e736c45 100644
--- a/script.tvguide/resources/language/Danish/strings.xml
+++ b/script.tvguide/resources/language/Danish/strings.xml
@@ -7,5 +7,11 @@
     <string id="30101">Kilde</string>
     <string id="30102">Vis kanaler i kategori</string>
     <string id="30103">XMLTV fil</string>
+    <string id="30104">Slet midlertidige filer...</string>
+    <string id="30105">Færdig!</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 2bdac31..6529561 100644
--- a/script.tvguide/resources/language/English/strings.xml
+++ b/script.tvguide/resources/language/English/strings.xml
@@ -7,5 +7,12 @@
     <string id="30101">Source</string>
     <string id="30102">Show channels from category</string>
     <string id="30103">XMLTV file</string>
+    <string id="30104">Clear cache...</string>
+    <string id="30105">Done!</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>
+
 </strings>
 
diff --git a/script.tvguide/resources/settings.xml 
b/script.tvguide/resources/settings.xml
index f97cca7..fac253e 100644
--- a/script.tvguide/resources/settings.xml
+++ b/script.tvguide/resources/settings.xml
@@ -9,6 +9,9 @@
                  visible="eq(-1,0)" />
 
         <setting id="xmltv.file" label="30103" type="file" visible="eq(-2,3)" 
/>
+
+        <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 5369f8d..4fb6b26 100644
--- a/script.tvguide/resources/skins/Default/720p/script-tvguide-main.xml
+++ b/script.tvguide/resources/skins/Default/720p/script-tvguide-main.xml
@@ -182,6 +182,7 @@
                     <width>160</width>
                     <height>45</height>
                     <aspectratio>keep</aspectratio>
+                    <fadetime>500</fadetime>
                 </control>
                 <control type="image" id="4111">
                     <description>2nd channel</description>
@@ -190,6 +191,7 @@
                     <width>160</width>
                     <height>45</height>
                     <aspectratio>keep</aspectratio>
+                    <fadetime>500</fadetime>
                 </control>
                 <control type="image" id="4112">
                     <description>3rd channel</description>
@@ -198,6 +200,7 @@
                     <width>160</width>
                     <height>45</height>
                     <aspectratio>keep</aspectratio>
+                    <fadetime>500</fadetime>
                 </control>
                 <control type="image" id="4113">
                     <description>4th channel</description>
@@ -206,6 +209,7 @@
                     <width>160</width>
                     <height>45</height>
                     <aspectratio>keep</aspectratio>
+                    <fadetime>500</fadetime>
                 </control>
                 <control type="image" id="4114">
                     <description>5th channel</description>
@@ -214,6 +218,7 @@
                     <width>160</width>
                     <height>45</height>
                     <aspectratio>keep</aspectratio>
+                    <fadetime>500</fadetime>
                 </control>
                 <control type="image" id="4115">
                     <description>6th channel</description>
@@ -222,6 +227,7 @@
                     <width>160</width>
                     <height>45</height>
                     <aspectratio>keep</aspectratio>
+                    <fadetime>500</fadetime>
                 </control>
                 <control type="image" id="4116">
                     <description>7th channel</description>
@@ -230,6 +236,7 @@
                     <width>160</width>
                     <height>45</height>
                     <aspectratio>keep</aspectratio>
+                    <fadetime>500</fadetime>
                 </control>
                 <control type="image" id="4117">
                     <description>8th channel</description>
@@ -238,6 +245,7 @@
                     <width>160</width>
                     <height>45</height>
                     <aspectratio>keep</aspectratio>
+                    <fadetime>500</fadetime>
                 </control>
             </control><!-- end group -->
 
@@ -296,17 +304,35 @@
                 <texture>timebar.png</texture>
             </control>
 
-            <!-- loading splash -->
-            <control type="label" id ="4200">
-                <posx>0</posx>
-                <posy>500</posy>
-                <width>1280</width>
-                <height>220</height>
-                <label>$ADDON[script.tvguide 30001]</label>
-                <textcolor>ffffffff</textcolor>
-                <font>font30</font>
-                <align>center</align>
-                <aligny>center</aligny>
+
+            <control type="group" id="4200">
+                <posx>350</posx>
+                <posy>580</posy>
+                <width>580</width>
+                <height>60</height>
+
+                <control type="progress" id="4201">
+                    <posx>0</posx>
+                    <posy>0</posy>
+                    <width>580</width>
+                    <height>60</height>
+                    <texturebg>cell-bg.png</texturebg>
+                    <lefttexture />
+                    <midtexture>cell-bg-selected.png</midtexture>
+                    <righttexture />
+                </control>
+                <control type="label">
+                    <description>loading splash</description>
+                    <posx>0</posx>
+                    <posy>10</posy>
+                    <width>580</width>
+                    <height>40</height>
+                    <label>$ADDON[script.tvguide 30001]</label>
+                    <textcolor>ffffffff</textcolor>
+                    <font>font30</font>
+                    <align>center</align>
+                    <aligny>center</aligny>
+                </control>
             </control>
         </control><!-- id="5000" -->
 
diff --git a/script.tvguide/source.py b/script.tvguide/source.py
index e542225..0b77cc7 100644
--- a/script.tvguide/source.py
+++ b/script.tvguide/source.py
@@ -15,7 +15,7 @@ class Channel(object):
         self.title = title
         self.logo = logo
 
-    def __str__(self):
+    def __repr__(self):
         return 'Channel(id=%s, title=%s, logo=%s)' \
                % (self.id, self.title, self.logo)
 
@@ -29,7 +29,7 @@ class Program(object):
         self.imageLarge = imageLarge
         self.imageSmall = imageSmall
 
-    def __str__(self):
+    def __repr__(self):
         return 'Program(channel=%s, title=%s, startDate=%s, endDate=%s, 
description=%s, imageLarge=%s, imageSmall=%s)' % \
             (self.channel, self.title, self.startDate, self.endDate, 
self.description, self.imageLarge, self.imageSmall)
 
@@ -53,12 +53,19 @@ class Source(object):
         except OSError:
             cacheHit = False
 
+        channelList = None
         if not cacheHit:
-            channelList = self._getChannelList()
-            pickle.dump(channelList, open(cacheFile, 'w'))
+            try:
+                channelList = self._getChannelList()
+                pickle.dump(channelList, open(cacheFile, 'w'))
+            except Exception, ex:
+                print "Unable to get channel list\n" + str(ex)
         else:
             channelList = pickle.load(open(cacheFile))
 
+        if channelList:
+            print "Loaded %d channels" % len(channelList)
+
         return channelList
 
     def _getChannelList(self):
@@ -68,18 +75,27 @@ 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
         except OSError:
             cacheHit = False
 
+        programList = None
         if not cacheHit:
-            programList = self._getProgramList(channel)
-            pickle.dump(programList, open(cacheFile, 'w'))
+            try:
+                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)
         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):
@@ -230,9 +246,15 @@ class XMLTVSource(Source):
     KEY = 'xmltv'
 
     def __init__(self, settings):
-        Source.__init__(self, settings, True)
         self.xmlTvFile = settings['xmltv.file']
         self.time = time.time()
+        try:
+            doc = self._loadXml()
+            hasChannelIcons = doc.find('channel/icon') is not None
+        except Exception:
+            hasChannelIcons = False
+
+        super(XMLTVSource, self).__init__(settings, hasChannelIcons)
 
         # calculate nearest hour
         self.time -= self.time % 3600
@@ -241,7 +263,10 @@ class XMLTVSource(Source):
         doc = self._loadXml()
         channelList = list()
         for channel in doc.findall('channel'):
-            c = Channel(id = channel.get('id'), title = 
channel.findtext('display-name'), logo = channel.find('icon').get('src'))
+            logo = None
+            if channel.find('icon'):
+                logo = channel.find('icon').get('src')
+            c = Channel(id = channel.get('id'), title = 
channel.findtext('display-name'), logo = logo)
             channelList.append(c)
 
         return channelList
diff --git a/script.tvguide/strings.py b/script.tvguide/strings.py
index 11aec71..f0efe26 100644
--- a/script.tvguide/strings.py
+++ b/script.tvguide/strings.py
@@ -6,6 +6,13 @@ NO_STREAM_AVAILABLE_TITLE = 30100
 NO_STREAM_AVAILABLE_LINE1 = 30101
 NO_STREAM_AVAILABLE_LINE2 = 30102
 
+CLEAR_CACHE = 30104
+CLEAR_CACHE_DONE = 30105
+
+LOAD_ERROR_TITLE = 30110
+LOAD_ERROR_LINE1 = 30111
+LOAD_ERROR_LINE2 = 30112
+
 def strings(id, replacements = None):
     string = xbmcaddon.Addon(id = 'script.tvguide').getLocalizedString(id)
     if replacements is not None:

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

Summary of changes:
 script.tvguide/addon.xml                           |    2 +-
 script.tvguide/changelog.txt                       |    6 +
 script.tvguide/clear_cache.py                      |   18 +++
 script.tvguide/gui.py                              |  104 +++++++++++------
 .../resources/language/Danish/strings.xml          |    6 +
 .../resources/language/English/strings.xml         |    7 +
 script.tvguide/resources/settings.xml              |    3 +
 .../skins/Default/720p/script-tvguide-main.xml     |   48 ++++++--
 .../skins/Default/media/tvguide-background.xcf     |  Bin 982043 -> 0 bytes
 script.tvguide/source.py                           |   41 +++++--
 script.tvguide/strings.py                          |    7 +
 script.xbmc-pbx-addon/addon.xml                    |    2 +-
 script.xbmc-pbx-addon/autoexec.py                  |   16 ---
 .../backend_files/manager_custom.conf              |    4 +-
 .../backend_files/xbmc-pbx-addon.php               |    5 +-
 script.xbmc-pbx-addon/bgservice.py                 |   47 ++++----
 script.xbmc-pbx-addon/changelog.txt                |  126 +++++++++++---------
 script.xbmc-pbx-addon/default.py                   |   31 +++--
 script.xbmc-pbx-addon/fanart.jpg                   |  Bin 400040 -> 394846 
bytes
 script.xbmc-pbx-addon/icon.png                     |  Bin 55684 -> 61096 bytes
 .../resources/language/English/strings.xml         |    1 +
 .../resources/media/xbmc-pbx-addon.png             |  Bin 64961 -> 63957 bytes
 script.xbmc-pbx-addon/resources/settings.xml       |    1 +
 .../resources/skins/Default/720p/includes.xml      |    2 +
 .../skins/Default/media/xbmc-pbx-addon.png         |  Bin 64961 -> 63957 bytes
 25 files changed, 309 insertions(+), 168 deletions(-)
 create mode 100644 script.tvguide/clear_cache.py
 delete mode 100644 
script.tvguide/resources/skins/Default/media/tvguide-background.xcf
 delete mode 100644 script.xbmc-pbx-addon/autoexec.py
 create mode 100644 
script.xbmc-pbx-addon/resources/skins/Default/720p/includes.xml


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to