2017-11-30 00:20:35 +02:00
|
|
|
import datetime
|
2016-11-28 13:48:11 +02:00
|
|
|
import plugins
|
2016-10-18 20:00:43 +03:00
|
|
|
|
|
|
|
|
2016-11-28 13:48:11 +02:00
|
|
|
class PluginThread(plugins.PluginThreadCommon):
|
2016-11-21 12:34:32 +02:00
|
|
|
def __init__(self, section, config):
|
2016-11-19 17:44:40 +02:00
|
|
|
super(PluginThread, self).__init__(section, config)
|
2016-10-22 19:27:28 +03:00
|
|
|
self.date_format = config.get(section, 'format', fallback='%c')
|
2017-11-30 00:20:35 +02:00
|
|
|
tz = config.get(section, 'TZ', fallback=None)
|
|
|
|
if tz:
|
|
|
|
import pytz
|
|
|
|
self.tz = pytz.timezone(tz)
|
|
|
|
else:
|
|
|
|
self.tz = None
|
2016-10-22 05:50:11 +03:00
|
|
|
|
2016-10-22 19:27:28 +03:00
|
|
|
def main(self):
|
2017-11-30 00:20:35 +02:00
|
|
|
now = datetime.datetime.now(tz=self.tz)
|
|
|
|
self.status['full_text'] = now.strftime(self.date_format)
|