aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-09-15 15:10:24 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-09-15 15:10:24 +0200
commita020a0dc20ced6468ec46214c394f6f360735b1d (patch)
treef37221707ea88f2cbb0d3325f76658369148b65a /youtube_dl/utils.py
parentb04c8f735805ea2671429ac8d683c2887a6b4db8 (diff)
[facebook] Fix support for untitled videos (Fixes #3757)
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py10
1 files changed, 10 insertions, 0 deletions
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