summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-06-09 17:52:42 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2010-06-09 17:52:42 +0200
commitcecdf90f8b4c76aa1f580f0b250dd5a0fd50b4b8 (patch)
tree3fdf2793b283346be4079342d2071ba839e75d7b /modules
parent25096a81665435a3a6f630315af9b5fcdb45973a (diff)
anidb: Don't display number of eps of total when not ongoing.
Diffstat (limited to 'modules')
-rw-r--r--modules/anidb.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/modules/anidb.py b/modules/anidb.py
index fbc9e11..ddd0289 100644
--- a/modules/anidb.py
+++ b/modules/anidb.py
@@ -21,7 +21,8 @@ class Module:
def __init__(self, bot):
self.irc = bot
self.db = PgSQL.connect(database = 'fot')
- self.irc.register_keyword('!anidb', self)
+ if self.irc:
+ self.irc.register_keyword('!anidb', self)
def get_aid(self, msg, short = False):
if msg.isdigit():
@@ -68,16 +69,21 @@ class Module:
catn = 10
rating = float(rating) / 100
temprating = float(temprating) / 100
+
+ epcount = int(epcount)
+ normalep = int(normalep)
+ specialep = int(specialep)
+
catl = ', '.join(catlist[:catn] + (['+%d more' % (len(catlist)-catn)] if len(catlist) > catn else []))
- return '%s%s is: %s, year %s, %s%s%s eps%s, cats: %s | rating: %.2f (%s), temp: %.2f (%s) | http://anidb.net/a%d' % (
+ return '%s%s is: %s, year %s, %d%s%s eps%s, cats: %s | rating: %.2f (%s), temp: %.2f (%s) | http://anidb.net/a%d' % (
romaji,
' aka. %s' % english if english else '',
type,
year,
normalep,
- '/%s' % epcount if int(epcount) > 0 else '',
- '+%s' % specialep if int(specialep) > 0 else '',
- ' (ongoing)' if (int(epcount) == 0 or normalep < epcount) else '',
+ '/%d' % epcount if epcount > 0 and normalep != epcount else '',
+ '+%d' % specialep if specialep > 0 else '',
+ ' (ongoing)' if epcount == 0 or normalep < epcount else '',
catl or '(None)',
rating,
ratingcount,