From a020a0dc20ced6468ec46214c394f6f360735b1d Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Mon, 15 Sep 2014 15:10:24 +0200 Subject: [facebook] Fix support for untitled videos (Fixes #3757) --- youtube_dl/utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'youtube_dl/utils.py') diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 247788078..3ac0f1f54 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1571,3 +1571,13 @@ except AttributeError: if ret: raise subprocess.CalledProcessError(ret, p.args, output=output) return output + + +def limit_length(s, length): + """ Add ellipses to overly long strings """ + if s is None: + return None + ELLIPSES = '...' + if len(s) > length: + return s[:length - len(ELLIPSES)] + ELLIPSES + return s -- cgit v1.2.3