diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-09-15 15:10:24 +0200 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-09-15 15:10:24 +0200 |
commit | a020a0dc20ced6468ec46214c394f6f360735b1d (patch) | |
tree | f37221707ea88f2cbb0d3325f76658369148b65a /youtube_dl/utils.py | |
parent | b04c8f735805ea2671429ac8d683c2887a6b4db8 (diff) |
[facebook] Fix support for untitled videos (Fixes #3757)
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r-- | youtube_dl/utils.py | 10 |
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 |