> 1) changed
> 2) i don't write to the plugin dir. The only write option goes to the cache
> dir, defined in the config file. The config file is placed in the plugin-dir
> cause it's unchangeable by the plugin itself (i don't find a proper way to
> edit lists by the xbmc-build in addon-config). The user don't need to edit
> or create these file, if he is lucky and get always fast server (no lags
> while playing the videos). If not he has to edit this file and create a
> cache dir. Cause of the size (around 10 GB and more) i decide it's not the
> proper way to store this in the plugin-user-dir. (in my case this would be
> placed on a 60gb SSD). Is this ok?

not okay. try something ala attached.
From ba31df4ec8476adf770db632013726a148644d3c Mon Sep 17 00:00:00 2001
From: spiff <[email protected]>
Date: Wed, 22 Dec 2010 12:58:49 +0100
Subject: [PATCH] attempt at explaining

---
 config.example                         |    6 ------
 default.py                             |   15 ++-------------
 fetchOfflineData.py                    |   22 ++++++----------------
 gamestar.py                            |   28 +++++++++++++++-------------
 resources/language/English/strings.xml |   18 ++++++++++++++++++
 resources/language/German/strings.xml  |   18 ++++++++++++++++++
 resources/settings.xml                 |   15 +++++++++++++++
 7 files changed, 74 insertions(+), 48 deletions(-)
 delete mode 100644 config.example
 create mode 100644 resources/language/English/strings.xml
 create mode 100644 resources/language/German/strings.xml
 create mode 100644 resources/settings.xml

diff --git a/config.example b/config.example
deleted file mode 100644
index 07e1e2b..0000000
--- a/config.example
+++ /dev/null
@@ -1,6 +0,0 @@
-cachePath=/add/some/path
-#download all files in categorie 0 (Neuste Videos) and 6 (Server Down Show)
-downloadCats=0;6;
-#force Precaching in Categorie server down show
-forcePrecaching=6; 
-#watch gamestar.py to map cat numbers to names...
\ No newline at end of file
diff --git a/default.py b/default.py
index efadd82..12e9cb1 100644
--- a/default.py
+++ b/default.py
@@ -38,18 +38,7 @@ def get_params():
 __settings__ = xbmcaddon.Addon(id='plugin.video.gamestar')
 rootPath = __settings__.getAddonInfo('path');
 
-configFilePath = os.path.join(rootPath,"config");
-archivePath = None
-forcedPrecachingConfig = None
-if(os.path.exists(configFilePath)):
-  configFile = open(configFilePath,"r");
-  for line in configFile.readlines():
-    if(line.startswith("cachePath=")):
-      archivePath = line.replace("cachePath=","").rstrip();
-    if(line.startswith("forcePrecaching=")):
-      forcedPrecachingConfig = line.replace("cachePath=","");
-
-gui = SimpleXbmcGui(archivePath);
+gui = SimpleXbmcGui(__settings__.getSetting('path'));
 webSite=GamestarWeb(gui);
 
 gui.openMenuContext();
@@ -59,7 +48,7 @@ cat=int(params.get("cat", 0))
 gui.log("action: "+action);
 
 if(action == "list"):
-  forcedPrecaching = forcedPrecachingConfig is not None and forcedPrecachingConfig.find("%d;"%cat)>-1;
+  forcedPrecaching = __settings__.getSetting(params.get("cat",0)) == 3;
   category = webSite.categories[cat];
   webSite.builCategoryMenu(category,forcedPrecaching);
 elif(action == "download"):
diff --git a/fetchOfflineData.py b/fetchOfflineData.py
index adf1257..6ce0834 100644
--- a/fetchOfflineData.py
+++ b/fetchOfflineData.py
@@ -82,23 +82,13 @@ rateLimiter.__call__(0,0,0);
 
 configFilePath = os.path.join(rootPath,"config");
     
-configFile = open(configFilePath,"r");
-for line in configFile.readlines():
-  if(line.startswith("cachePath=")):
-    archivePath = line.replace("cachePath=","").rstrip();
-  if(line.startswith("downloadCats=")):
-    line = line.replace("downloadCats=","");
-    for cat in line.split(";"):
-      try:
-        cats.append(int(cat));
-      except:
-        pass;
-        
 gui = OfflineGui(archivePath,rateLimiter);
 webSite=GamestarWeb(gui);
-for cat in cats:
-  category = webSite.categories[6];
-  print "Fetching: "+category.title
-  webSite.builCategoryMenu(category.url, False);
+addon = xbmcAddon.Addon("plugin.video.gamestar")
+for cat in 0..11:
+  if addon.getSetting(str(cat)) > 1:
+    category = webSite.categories[cat];
+    print "Fetching: "+category.title
+    webSite.builCategoryMenu(category.url, False);
   
 gui.cleanUp();
diff --git a/gamestar.py b/gamestar.py
index 6a1f88a..20da01c 100644
--- a/gamestar.py
+++ b/gamestar.py
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
-import urllib, re
+import urllib, re, xbmcaddon
 from ui import *;
 
 class GamestarWeb(object):
@@ -42,19 +42,21 @@ class GamestarWeb(object):
     ##end setup
     
     ##setup categories
+    addon = xbmcaddon.Addon("plugin.video.gamestar")
+    GetString = addon.getLocalizedString
     self.categories = (
-      GalleryObject(0,"Neuste Videos","http://www.gamestar.de/index.cfm?pid=1589&ci=latest","http://images.gamestar.de/images/idgwpgsgp/bdb/2018270/b144x81.jpg";, self.rootLinkGS),
-      GalleryObject(1,"Test-Videos","http://www.gamestar.de/index.cfm?pid=1589&ci=17","http://images.gamestar.de/images/idgwpgsgp/bdb/2018272/b144x81.jpg";, self.rootLinkGS),
-      GalleryObject(2,"Preview-Videos","http://www.gamestar.de/index.cfm?pid=1589&ci=18","http://images.gamestar.de/images/idgwpgsgp/bdb/2018269/b144x81.jpg";, self.rootLinkGS),
-      GalleryObject(3,"Video-Specials","http://www.gamestar.de/index.cfm?pid=1589&ci=20","http://images.gamestar.de/images/idgwpgsgp/bdb/2018270/b144x81.jpg";, self.rootLinkGS),
-      GalleryObject(4,"Quickplay","http://www.gamestar.de/index.cfm?pid=1589&ci=19","http://images.gamestar.de/images/idgwpgsgp/bdb/2016676/b144x81.jpg";, self.rootLinkGS),
-      GalleryObject(5,"Multiplayer-Duelle","http://www.gamestar.de/index.cfm?pid=1589&ci=22","http://images.gamestar.de/images/idgwpgsgp/bdb/2016431/b144x81.jpg";, self.rootLinkGS),
-      GalleryObject(6,"Server Down Show","http://www.gamestar.de/index.cfm?pid=1589&ci=15","http://images.gamestar.de/images/idgwpgsgp/bdb/2018271/b144x81.jpg";, self.rootLinkGS),
-      GalleryObject(7,"Public Viewing","http://www.gamestar.de/index.cfm?pid=1589&ci=37","http://images.idgentertainment.de/images/idgwpgsgp/bdb/2121485/b144x81.jpg";, self.rootLinkGS),
-      GalleryObject(8,"Technik-Checks","http://www.gamestar.de/index.cfm?pid=1589&ci=32","http://images.gamestar.de/images/idgwpgsgp/bdb/2018270/b144x81.jpg";, self.rootLinkGS),
-      GalleryObject(9,"Boxenstopp","http://www.gamestar.de/index.cfm?pid=1589&ci=2","http://images.gamestar.de/images/idgwpgsgp/bdb/2018274/b144x81.jpg";, self.rootLinkGS),
-      GalleryObject(10,"Gamestar TV","http://www.gamestar.de/index.cfm?pid=1589&ci=1","http://images.gamestar.de/images/idgwpgsgp/bdb/2016821/b144x81.jpg";, self.rootLinkGS),
-      GalleryObject(11,"Gamepro Videos","http://www.gamepro.de/videos/","";, self.rootLinkGP)
+      GalleryObject(0,GetString(30001),"http://www.gamestar.de/index.cfm?pid=1589&ci=latest","http://images.gamestar.de/images/idgwpgsgp/bdb/2018270/b144x81.jpg";, self.rootLinkGS),
+      GalleryObject(1,GetString(30002),"http://www.gamestar.de/index.cfm?pid=1589&ci=17","http://images.gamestar.de/images/idgwpgsgp/bdb/2018272/b144x81.jpg";, self.rootLinkGS),
+      GalleryObject(2,GetString(30003),"http://www.gamestar.de/index.cfm?pid=1589&ci=18","http://images.gamestar.de/images/idgwpgsgp/bdb/2018269/b144x81.jpg";, self.rootLinkGS),
+      GalleryObject(3,GetString(30004),"http://www.gamestar.de/index.cfm?pid=1589&ci=20","http://images.gamestar.de/images/idgwpgsgp/bdb/2018270/b144x81.jpg";, self.rootLinkGS),
+      GalleryObject(4,GetString(30005),"http://www.gamestar.de/index.cfm?pid=1589&ci=19","http://images.gamestar.de/images/idgwpgsgp/bdb/2016676/b144x81.jpg";, self.rootLinkGS),
+      GalleryObject(5,GetString(30006),"http://www.gamestar.de/index.cfm?pid=1589&ci=22","http://images.gamestar.de/images/idgwpgsgp/bdb/2016431/b144x81.jpg";, self.rootLinkGS),
+      GalleryObject(6,GetString(30007),"http://www.gamestar.de/index.cfm?pid=1589&ci=15","http://images.gamestar.de/images/idgwpgsgp/bdb/2018271/b144x81.jpg";, self.rootLinkGS),
+      GalleryObject(7,GetString(30008),"http://www.gamestar.de/index.cfm?pid=1589&ci=37","http://images.idgentertainment.de/images/idgwpgsgp/bdb/2121485/b144x81.jpg";, self.rootLinkGS),
+      GalleryObject(8,GetString(30009),"http://www.gamestar.de/index.cfm?pid=1589&ci=32","http://images.gamestar.de/images/idgwpgsgp/bdb/2018270/b144x81.jpg";, self.rootLinkGS),
+      GalleryObject(9,GetString(30010),"http://www.gamestar.de/index.cfm?pid=1589&ci=2","http://images.gamestar.de/images/idgwpgsgp/bdb/2018274/b144x81.jpg";, self.rootLinkGS),
+      GalleryObject(10,GetString(30011),"http://www.gamestar.de/index.cfm?pid=1589&ci=1","http://images.gamestar.de/images/idgwpgsgp/bdb/2016821/b144x81.jpg";, self.rootLinkGS),
+      GalleryObject(11,GetString(30012),"http://www.gamepro.de/videos/","";, self.rootLinkGP)
       )
     ##endregion
     
diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml
new file mode 100644
index 0000000..84ddfa3
--- /dev/null
+++ b/resources/language/English/strings.xml
@@ -0,0 +1,18 @@
+<strings>
+    <string id="30000">Cache folder</string>
+    <string id="30001">Newest videos</string>
+    <string id="30002">Reviews</string>
+    <string id="30003">Previews</string>
+    <string id="30004">Specials</string>
+    <string id="30005">Quickplay</string>
+    <string id="30006">Multiplayer duels</string>
+    <string id="30007">Server down show</string>
+    <string id="30008">Public viewing</string>
+    <string id="30009">Technique checks</string>
+    <string id="30010">Boxenstops</string>
+    <string id="30011">Gamestar TV</string>
+    <string id="30012">Gamepro videos</string>
+    <string id="30013">Don't cache</string>
+    <string id="30014">Precache</string>
+    <string id="30015">Cache</string>
+</strings>
diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml
new file mode 100644
index 0000000..25c90bf
--- /dev/null
+++ b/resources/language/German/strings.xml
@@ -0,0 +1,18 @@
+<strings>
+    <string id="30000">Cache folder</string>
+    <string id="30001">Neuste videos</string>
+    <string id="30002">Test-videos</string>
+    <string id="30003">Preview-videos</string>
+    <string id="30004">Video-specials</string>
+    <string id="30005">Quickplay</string>
+    <string id="30006">Multiplayer-duelle</string>
+    <string id="30007">Server down show</string>
+    <string id="30008">Public viewing</string>
+    <string id="30009">Technik-checks</string>
+    <string id="30010">Boxenstopp</string>
+    <string id="30011">Gamestar TV</string>
+    <string id="30012">Gamepro videos</string>
+    <string id="30013">Don't cache</string>
+    <string id="30014">Precache</string>
+    <string id="30015">Cache</string>
+</strings>
diff --git a/resources/settings.xml b/resources/settings.xml
new file mode 100644
index 0000000..041e2f6
--- /dev/null
+++ b/resources/settings.xml
@@ -0,0 +1,15 @@
+<settings>
+   <setting id="path" type="folder" label="30000" option="writeable" default=""/>
+   <setting id="0" type="labelenum" label="30001" lvalues="30013|30014|30015" default="1" enable="!eq(-1,)"/> 
+   <setting id="1" type="labelenum" label="30002" lvalues="30013|30014|30015" default="1" enable="!eq(-2,)"/> 
+   <setting id="2" type="labelenum" label="30003" lvalues="30013|30014|30015" default="1" enable="!eq(-3,)"/> 
+   <setting id="3" type="labelenum" label="30004" lvalues="30013|30014|30015" default="1" enable="!eq(-4,)"/> 
+   <setting id="4" type="labelenum" label="30005" lvalues="30013|30014|30015" default="1" enable="!eq(-5,)"/> 
+   <setting id="5" type="labelenum" label="30006" lvalues="30013|30014|30015" default="1" enable="!eq(-6,)"/> 
+   <setting id="6" type="labelenum" label="30007" lvalues="30013|30014|30015" default="1" enable="!eq(-7,)"/> 
+   <setting id="7" type="labelenum" label="30008" lvalues="30013|30014|30015" default="1" enable="!eq(-8,)"/> 
+   <setting id="8" type="labelenum" label="30009" lvalues="30013|30014|30015" default="1" enable="!eq(-9,)"/> 
+   <setting id="9" type="labelenum" label="30010" lvalues="30013|30014|30015" default="1" enable="!eq(-10,)"/> 
+   <setting id="10" type="labelenum" label="30011" lvalues="30013|30014|30015" default="1" enable="!eq(-11,)"/> 
+   <setting id="11" type="labelenum" label="30012" lvalues="30013|30014|30015" default="1" enable="!eq(-12,)"/> 
+</settings>
-- 
1.7.0.4

------------------------------------------------------------------------------
Forrester recently released a report on the Return on Investment (ROI) of
Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
within 7 months.  Over 3 million businesses have gone Google with Google Apps:
an online email calendar, and document program that's accessible from your 
browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to