| 54 | |
| 55 | |
| 56 | class Config(object): |
| 57 | |
| 58 | def __init__(self, plugin): |
| 59 | self.plugin = plugin |
| 60 | |
| 61 | def set(self, option, value, plugin=None): |
| 62 | """ |
| 63 | Set config value for current plugin |
| 64 | |
| 65 | :param option: |
| 66 | :param value: |
| 67 | :return: |
| 68 | """ |
| 69 | self.plugin.pyload.api.setConfigValue(plugin or self.plugin.classname, option, value, section="plugin") |
| 70 | |
| 71 | def get(self, option, default=None, plugin=None): |
| 72 | """ |
| 73 | Returns config value for current plugin |
| 74 | |
| 75 | :param option: |
| 76 | :return: |
| 77 | """ |
| 78 | try: |
| 79 | return self.plugin.pyload.config.getPlugin(plugin or self.plugin.classname, option) |
| 80 | |
| 81 | except KeyError: |
| 82 | self.plugin.log_debug("Config option `%s` not found, use default `%s`" % (option, default)) # @TODO: Restore to `log_warning` in 0.4.10 |
| 83 | return default |
| 84 | |
| 85 | |
| 86 | class DB(object): |