[dvbapp] fix pluginbrowser patch.
authorhschang <chang@dev3>
Fri, 6 Feb 2015 05:35:36 +0000 (14:35 +0900)
committerhschang <chang@dev3>
Fri, 6 Feb 2015 09:43:35 +0000 (18:43 +0900)
meta-openvuplus/recipes-vuplus/enigma2/enigma2.bb
meta-openvuplus/recipes-vuplus/enigma2/enigma2/enigma2_vuplus_pluginbrowser.patch

index bfcf1f3..7ba12da 100644 (file)
@@ -195,7 +195,7 @@ RDEPENDS_enigma2-plugin-systemplugins-backupsuitehdd = "mtd-utils-mkfs.ubifs mtd
 RDEPENDS_enigma2-plugin-systemplugins-backupsuiteusb = "enigma2-plugin-extensions-backupsuitehdd"
 
 PN = "enigma2"
-PR = "r97"
+PR = "r98"
 
 inherit gitpkgv pythonnative
 
index 25ebe95..ecddf24 100644 (file)
@@ -1,19 +1,73 @@
 diff --git a/lib/python/Screens/PluginBrowser.py b/lib/python/Screens/PluginBrowser.py
-index d423f46..359552e 100755
+index d423f46..0a029ed 100755
 --- a/lib/python/Screens/PluginBrowser.py
 +++ b/lib/python/Screens/PluginBrowser.py
-@@ -220,8 +220,8 @@ class PluginDownloadBrowser(Screen):
+@@ -14,6 +14,9 @@ from Tools.LoadPixmap import LoadPixmap
+ from time import time
++import os
++import glob
++
+ def languageChanged():
+       plugins.clearPluginList()
+       plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
+@@ -179,7 +182,8 @@ class PluginDownloadBrowser(Screen):
+                               self.container.execute("opkg update")
+                               PluginDownloadBrowser.lastDownloadDate = time()
+                       else:
+-                              self.startIpkgListAvailable()
++                              self.run = 1
++                              self.startIpkgListInstalled()
+               elif self.type == self.REMOVE:
+                       self.run = 1
+                       self.startIpkgListInstalled()
+@@ -198,7 +202,16 @@ class PluginDownloadBrowser(Screen):
+                               self.startIpkgListInstalled()
+               elif self.run == 1 and self.type == self.DOWNLOAD:
+                       self.run = 2
+-                      self.startIpkgListAvailable()
++                      for x in self.getPluginListAvailable():
++                              if x[0] not in self.installedplugins:
++                                      self.pluginlist.append(x)
++
++                      if self.pluginlist:
++                              self.pluginlist.sort()
++                              self.updateList()
++                              self["list"].instance.show()
++                      else:
++                              self["text"].setText(_("No new plugins found"))
+               else:
+                       if len(self.pluginlist) > 0:
+                               self.updateList()
+@@ -220,17 +233,18 @@ class PluginDownloadBrowser(Screen):
                        self.remainingdata = ""
  
                for x in lines:
 -                      plugin = x.split(" - ")
--                      if len(plugin) >= 2:
 +                      plugin = x.split(" - ", 2)
-+                      if len(plugin) == 3:
-                               if self.run == 1 and self.type == self.DOWNLOAD:
+                       if len(plugin) >= 2:
+-                              if self.run == 1 and self.type == self.DOWNLOAD:
++                              if plugin[0].startswith('enigma2-plugin-') and not plugin[0].endswith('-dev') and not plugin[0].endswith('-staticdev') and not plugin[0].endswith('-dbg') and not plugin[0].endswith('-doc') and not plugin[0].endswith('-src'):
                                        if plugin[0] not in self.installedplugins:
-                                               self.installedplugins.append(plugin[0])
-@@ -239,13 +239,6 @@ class PluginDownloadBrowser(Screen):
+-                                              self.installedplugins.append(plugin[0])
+-                              else:
+-                                      if plugin[0] not in self.installedplugins:
+-                                              plugin.append(plugin[0][15:])
++                                              if self.run == 1 and self.type == self.DOWNLOAD:
++                                                      self.installedplugins.append(plugin[0])
++                                              else:
++                                                      if len(plugin) == 2:
++                                                              plugin.append('')
++                                                      plugin.append(plugin[0][15:])
++                                                      self.pluginlist.append(plugin)
+-                                              self.pluginlist.append(plugin)
+-      
+       def updateList(self):
+               list = []
+               expandableIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/expandable-plugins.png"))
+@@ -239,13 +253,6 @@ class PluginDownloadBrowser(Screen):
                
                self.plugins = {}
                for x in self.pluginlist:
@@ -27,3 +81,60 @@ index d423f46..359552e 100755
                        split = x[3].split('-', 1)
                        if len(split) < 2:
                                continue
+@@ -263,4 +270,56 @@ class PluginDownloadBrowser(Screen):
+               self.list = list
+               self["list"].l.setList(list)
++      def getPluginListAvailable(self):
++                      plugin_list = []
++                      # get feed names
++                      feeds = []
++                      for fn in glob.glob("/etc/opkg/*-feed.conf"):
++                              feeds.append(open(fn, 'r').read().split()[1])
++
++                      #get list_dir
++                      list_dir = "/var/lib/opkg"
++                      for line in open("/etc/opkg/opkg.conf", 'r'):
++                              if line.startswith('lists_dir'):
++                                      list_dir = line.split()[-1]
++
++                      for feed in feeds:
++                              Package = None
++                              for line in open(os.path.join(list_dir, feed), 'r'):
++                                      if line.startswith("Package:"):
++                                              pkg = line.split(":", 1)[1].strip()
++                                              if pkg.startswith('enigma2-plugin-') and not pkg.endswith('-dev') and not pkg.endswith('-staticdev') and not pkg.endswith('-dbg') and not pkg.endswith('-doc') and not pkg.endswith('-src'):
++                                                      Package = pkg
++                                                      Version = ''
++                                                      Description = ''
++                                              continue
++
++                                      if Package is None:
++                                              continue
++
++                                      if line.startswith("Version:"):
++                                              Version = line.split(":", 1)[1].strip()
++
++                                      elif line.startswith("Description:"):
++                                              Description = line.split(":", 1)[1].strip()
++
++                                      elif Description and line.startswith(' '):
++                                              Description += line[:-1]
++
++                                      elif len(line) <= 1:
++                                              sp = Description.split(' ', 3)
++                                              if sp[1] == "version":
++                                                      Description = sp[3].strip()
++
++                                              pn = Package.split('enigma2-plugin-')[1]
++
++                                              sp = Description.split(' ', 1)
++                                              if sp[0] == pn and len(sp[1]) > 0:
++                                                      Description = sp[1].strip()
++
++                                              plugin_list.append((Package, Version, Description, pn))
++                                              Package = None
++
++                      return plugin_list
++
+ language.addCallback(languageChanged)