diff options
| author | 2011-12-20 21:35:43 +0100 | |
|---|---|---|
| committer | 2011-12-20 21:35:43 +0100 | |
| commit | c9a359b75905d4910e42127cef8cbe62d4a13657 (patch) | |
| tree | 28f878ece7c333f19d163ae698202c88bd2297f5 | |
| parent | Merged in hzpz/pyload (pull request #10) (diff) | |
| download | pyload-c9a359b75905d4910e42127cef8cbe62d4a13657.tar.xz | |
some bugfixes
| -rw-r--r-- | module/config/ConfigParser.py | 11 | ||||
| -rw-r--r-- | module/database/FileDatabase.py | 2 | ||||
| -rw-r--r-- | module/remote/thriftbackend/pyload.thrift | 18 | ||||
| -rwxr-xr-x | pyLoadCore.py | 20 | 
4 files changed, 20 insertions, 31 deletions
| diff --git a/module/config/ConfigParser.py b/module/config/ConfigParser.py index 01f4268cb..33b3d26b6 100644 --- a/module/config/ConfigParser.py +++ b/module/config/ConfigParser.py @@ -102,7 +102,7 @@ class ConfigParser:                      continue                  if name in self.config[section].config: -                    self.set(section, name, value) +                    self.set(section, name, value, sync=False)                  else:                      print "Unrecognized option", section, name @@ -147,7 +147,7 @@ class ConfigParser:          else:              return self.config[section].config[option].default -    def set(self, section, option, value): +    def set(self, section, option, value, sync=True):          """set value"""          data = self.config[section].config[option] @@ -156,8 +156,9 @@ class ConfigParser:          # only save when different to defaul values          if value != data.default or (option in self.values[section] and value != self.values[section][option]):              self.values[section][option] = value -            if self.changeCB: self.changeCB(section, option, value) -            self.save() +            if sync: +                if self.changeCB: self.changeCB(section, option, value) +                self.save()      def getPlugin(self, *args):          """gets a value for a plugin""" @@ -204,7 +205,7 @@ class ConfigParser:              d[conf_name] = ConfigData(gettext(conf_desc), type, gettext(conf_verbose), from_string(default, type))          if base: -            self.baseSections.append(section) +            if section not in self.baseSections: self.baseSections.append(section)          else:              if section in self.config:                  print "Section already exists", section diff --git a/module/database/FileDatabase.py b/module/database/FileDatabase.py index 895e0de65..4084c46f7 100644 --- a/module/database/FileDatabase.py +++ b/module/database/FileDatabase.py @@ -340,7 +340,7 @@ class FileHandler:          if "decrypt" in self.jobCache:              return None -        plugins = self.core.pluginManager.crypterPlugins.keys() + self.core.pluginManager.containerPlugins.keys() +        plugins = self.core.pluginManager.getPlugins("crypter").keys() + self.core.pluginManager.getPlugins("container").keys()          plugins = str(tuple(plugins))          jobs = self.db.getPluginJob(plugins) diff --git a/module/remote/thriftbackend/pyload.thrift b/module/remote/thriftbackend/pyload.thrift index ace24e709..c498ef8bf 100644 --- a/module/remote/thriftbackend/pyload.thrift +++ b/module/remote/thriftbackend/pyload.thrift @@ -34,11 +34,6 @@ enum Destination {    Queue  } -enum ElementType { -  Package, -  File -} -  // types for user interaction  // some may only be place holder currently not supported  // also all input - output combination are not reasonable, see InteractionManager for further info @@ -162,9 +157,7 @@ struct CaptchaTask {  struct EventInfo {    1: string eventname, -  2: optional i32 id, -  3: optional ElementType type, -  4: optional Destination destination +  2: list<string> args,  }  struct UserData { @@ -176,14 +169,15 @@ struct UserData {  }  struct AccountInfo { -  1: i64 validuntil, +  1: PluginName plugin,    2: string login, -  3: map<string, list<string>> options, -  4: bool valid, +  3: bool valid, +  4: i64 validuntil,    5: i64 trafficleft,    6: i64 maxtraffic,    7: bool premium, -  8: string type, +  8: bool activated, +  9: map<string list<string>> options,  }  struct ServiceCall { diff --git a/pyLoadCore.py b/pyLoadCore.py index 7efab1061..3bf742310 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -25,7 +25,6 @@ CURRENT_VERSION = '0.4.9.9-dev'  import __builtin__  from getopt import getopt, GetoptError -import module.common.pylgettext as gettext  from imp import find_module  import logging  import logging.handlers @@ -33,12 +32,17 @@ import os  from os import _exit, execl, getcwd, makedirs, remove, sep, walk, chdir, close  from os.path import exists, join  import signal -import subprocess  import sys  from sys import argv, executable, exit  from time import time, sleep  from traceback import print_exc +import locale +locale.locale_alias = locale.windows_locale = {} #save ~100kb ram, no known sideeffects for now + +import subprocess +subprocess.__doc__ = None # the module with the largest doc we are using +  from module import InitHomeDir  from module.plugins.AccountManager import AccountManager  from module.interaction.CaptchaManager import CaptchaManager @@ -53,6 +57,7 @@ from module import remote  from module.remote.RemoteManager import RemoteManager  from module.database import DatabaseBackend, FileHandler +import module.common.pylgettext as gettext  from module.utils import freeSpace, formatSize, get_console_encoding  from codecs import getwriter @@ -460,7 +465,6 @@ class Core(object):          locals().clear() -#        dump = False          while True:              sleep(2)              if self.do_restart: @@ -475,15 +479,6 @@ class Core(object):              self.threadManager.work()              self.scheduler.work() -#            if not dump: -#                sleep(10) -#                print "dump objs" -#                from meliae import scanner -#                scanner.dump_all_objects(join(pypath, "objs.json")) -#                dump = True - -    import locale -      def setupDB(self):          self.db = DatabaseBackend(self) # the backend          self.db.setup() @@ -622,7 +617,6 @@ class Core(object):      def path(self, *args):          return join(pypath, *args) -  def deamon():      try:          pid = os.fork() | 
