Skip to content

Commit

Permalink
Add youtube colors. Fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
paris-ci committed Oct 3, 2015
1 parent 5a14508 commit a332daf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from cloudbot import hook
from cloudbot.util import timeformat
from cloudbot.util.formatting import pluralize
from cloudbot.util.colors import parse

youtube_re = re.compile(r'(?:youtube.*?(?:v=|/v/)|youtu\.be/|yooouuutuuube.*?id=)([-_a-zA-Z0-9]+)', re.I)

Expand Down Expand Up @@ -47,6 +48,8 @@ def get_video_description(video_id):
dislikes = pluralize(int(statistics['dislikeCount']), "dislike")

percent = 100 * float(statistics['likeCount']) / total_votes
likes = parse("$(dark_green)" + likes + "$(clear)")
dislikes = parse("$(dark_red)" + dislikes + "$(clear)")
out += ' - {}, {} (\x02{:.1f}\x02%)'.format(likes,
dislikes, percent)

Expand Down

0 comments on commit a332daf

Please sign in to comment.