From 3affdc830a10adfcee549b6eab6967fabc4c7cff Mon Sep 17 00:00:00 2001 From: Nitesh Sawant Date: Mon, 15 Jan 2018 23:50:19 +0530 Subject: [PATCH] Tell the user to install `unicode-slugify` in case of ImportError --- core/internals.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/core/internals.py b/core/internals.py index ca7f6ed..800567f 100755 --- a/core/internals.py +++ b/core/internals.py @@ -1,6 +1,10 @@ -from slugify import SLUG_OK, slugify from core.const import log +try: + from slugify import SLUG_OK, slugify +except ImportError: + log.warning('Remove any other slugifies and install unicode-slugify') + import os @@ -68,11 +72,11 @@ def filter_path(path): def videotime_from_seconds(time): - if time<60: + if time < 60: return str(time) - if time<3600: - return '{}:{}'.format(str(time//60), str(time%60).zfill(2)) + if time < 3600: + return '{}:{}'.format(str(time // 60), str(time % 60).zfill(2)) - return '{}:{}:{}'.format(str(time//60), - str((time%60)//60).zfill(2), - str((time%60)%60).zfill(2)) + return '{}:{}:{}'.format(str(time // 60), + str((time % 60) // 60).zfill(2), + str((time % 60) % 60).zfill(2))