diff options
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 | 
