X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=youtube_dl%2Futils.py;h=2b05fd7b7f4076a7d934033ceaeb116f6f8491ca;hb=8d31fa3cce47a7c9d932b872e277cf89eb3441a2;hp=42ad520f9cac27581aa4edbc3606a702f3376b82;hpb=c71dfccc98208be44b1f639af72a257dae34d966;p=youtube-dl.git diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 42ad520f9..2b05fd7b7 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -192,6 +192,13 @@ try: except ImportError: # Python 2.6 from xml.parsers.expat import ExpatError as compat_xml_parse_error +try: + from shlex import quote as shlex_quote +except ImportError: # Python < 3.3 + def shlex_quote(s): + return "'" + s.replace("'", "'\"'\"'") + "'" + + def compat_ord(c): if type(c) is int: return c else: return ord(c) @@ -855,6 +862,7 @@ def unified_strdate(date_str): '%Y/%m/%d', '%d.%m.%Y', '%d/%m/%Y', + '%d/%m/%y', '%Y/%m/%d %H:%M:%S', '%Y-%m-%d %H:%M:%S', '%d.%m.%Y %H:%M', @@ -1285,6 +1293,12 @@ def remove_start(s, start): return s +def remove_end(s, end): + if s.endswith(end): + return s[:-len(end)] + return s + + def url_basename(url): path = compat_urlparse.urlparse(url).path return path.strip(u'/').split(u'/')[-1]