Finish doTopic work and pluralize minute and day correctly
This commit is contained in:
@ -32,7 +32,7 @@ def _event_to_string(event, timezone):
|
|||||||
def diff(delta):
|
def diff(delta):
|
||||||
s = ''
|
s = ''
|
||||||
if delta.days:
|
if delta.days:
|
||||||
if delta.days > 1:
|
if delta.days != 1:
|
||||||
s = 's'
|
s = 's'
|
||||||
return '%d day%s' % (delta.days, s)
|
return '%d day%s' % (delta.days, s)
|
||||||
h = ''
|
h = ''
|
||||||
@ -42,7 +42,7 @@ def diff(delta):
|
|||||||
h = '%d hour%s ' % (int(delta.seconds/3600),s)
|
h = '%d hour%s ' % (int(delta.seconds/3600),s)
|
||||||
s = ''
|
s = ''
|
||||||
seconds = delta.seconds % 3600
|
seconds = delta.seconds % 3600
|
||||||
if seconds > 120:
|
if seconds > 120 or seconds < 60:
|
||||||
s = 's'
|
s = 's'
|
||||||
return '%s%d minute%s' % (h,(seconds/60),s)
|
return '%s%d minute%s' % (h,(seconds/60),s)
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ class Webcal(callbacks.Plugin):
|
|||||||
def _autotopics(self):
|
def _autotopics(self):
|
||||||
for c in self.irc.state.channels:
|
for c in self.irc.state.channels:
|
||||||
url = self.registryValue('url', c)
|
url = self.registryValue('url', c)
|
||||||
if url:
|
if url and self.registryValue('doTopic', c):
|
||||||
newtopic = self._gettopic(url, c)
|
newtopic = self._gettopic(url, c)
|
||||||
if newtopic and not (newtopic.strip() == self.irc.state.getTopic(c).strip()):
|
if newtopic and not (newtopic.strip() == self.irc.state.getTopic(c).strip()):
|
||||||
self.irc.queueMsg(ircmsgs.topic(c, newtopic))
|
self.irc.queueMsg(ircmsgs.topic(c, newtopic))
|
||||||
@ -128,7 +128,7 @@ class Webcal(callbacks.Plugin):
|
|||||||
|
|
||||||
def topic(self, irc, msg, args):
|
def topic(self, irc, msg, args):
|
||||||
url = self.registryValue('url', msg.args[0])
|
url = self.registryValue('url', msg.args[0])
|
||||||
if not url:
|
if not url or not self.registryValue('doTopic'):
|
||||||
return
|
return
|
||||||
self._refresh_cache(url)
|
self._refresh_cache(url)
|
||||||
newtopic = self._gettopic(url, msg.args[0])
|
newtopic = self._gettopic(url, msg.args[0])
|
||||||
|
Reference in New Issue
Block a user