From fb63a76e6dcde2df627e34941cf310eb1fbf4244 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Thu, 18 Dec 2014 17:45:55 -0500 Subject: [PATCH 1/2] use integer division for python 3 compatibility --- willie/modules/youtube.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/willie/modules/youtube.py b/willie/modules/youtube.py index ec3679bfe4..afdb4dc3d1 100644 --- a/willie/modules/youtube.py +++ b/willie/modules/youtube.py @@ -84,8 +84,8 @@ def ytget(bot, trigger, uri): if duration < 1: vid_info['length'] = 'LIVE' else: - hours = duration / (60 * 60) - minutes = duration / 60 - (hours * 60) + hours = duration // (60 * 60) + minutes = duration // 60 - (hours * 60) seconds = duration % 60 vid_info['length'] = '' if hours: From fbccd8a3ea611a68fc490a23fb185cb3c14ce598 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Thu, 18 Dec 2014 18:19:43 -0500 Subject: [PATCH 2/2] make sure integer division is handled properly by older versions --- willie/modules/youtube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/willie/modules/youtube.py b/willie/modules/youtube.py index afdb4dc3d1..096a0fdda1 100644 --- a/willie/modules/youtube.py +++ b/willie/modules/youtube.py @@ -10,7 +10,7 @@ This module will respond to .yt and .youtube commands and searches the youtubes. """ -from __future__ import unicode_literals +from __future__ import unicode_literals, division from willie import web, tools from willie.module import rule, commands, example