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
|
|
|
|
|
|
|
|
2019-03-28 12:21:15 +02:00
|
|
|
DATE_DEFAULTS = {'format': '%c'}
|
|
|
|
|
|
|
|
|
2016-11-28 13:48:11 +02:00
|
|
|
class PluginThread(plugins.PluginThreadCommon):
|
2017-12-16 01:55:28 +02:00
|
|
|
def __init__(self, config):
|
2019-03-28 12:21:15 +02:00
|
|
|
super(PluginThread, self).__init__(config, DATE_DEFAULTS)
|
2017-12-16 01:55:28 +02:00
|
|
|
self.timezone = None
|
2019-03-28 12:21:15 +02:00
|
|
|
if 'tz' in self.conf:
|
2017-11-30 00:20:35 +02:00
|
|
|
import pytz
|
2017-12-16 01:55:28 +02:00
|
|
|
self.timezone = pytz.timezone(self.conf['tz'])
|
2016-10-22 05:50:11 +03:00
|
|
|
|
2016-10-22 19:27:28 +03:00
|
|
|
def main(self):
|
2017-12-16 01:55:28 +02:00
|
|
|
now = datetime.datetime.now(tz=self.timezone)
|
2019-07-05 18:24:46 +03:00
|
|
|
self.format_status(now.strftime(self.conf['format']))
|