Skip to content

Commit

Permalink
youtube: remove channel name, use number format
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigge committed May 22, 2021
1 parent b522d14 commit fc5c8e8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plugins/youtube/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import plugin

from utils import number_utils


class Youtube(plugin.Plugin):

Expand Down Expand Up @@ -59,19 +61,18 @@ def process(self, id, server, channel):
logging.info("Youtube.process json %s", data)

title = data["snippet"]["title"]
channelTitle = data["snippet"]["channelTitle"]
duration = Youtube.durationToTimeDelta(data["contentDetails"]["duration"])
views = int(data["statistics"]["viewCount"])

logging.info(
"Youtube.process msg %s",
"{} - {} [{}] ({:n} views)".format(channelTitle, title, duration, views),
"{} [{}] ({} views)".format(title, duration, number_utils.format(views)),
)

self.privmsg(
server,
channel,
"{} - {} [{}] ({:n} views)".format(channelTitle, title, duration, views),
"{} [{}] ({} views)".format(title, duration, number_utils.format(views)),
)

def on_pubmsg(self, server, user, channel, message):
Expand Down

0 comments on commit fc5c8e8

Please sign in to comment.