diff options
author | epitron <chris@ill-logic.com> | 2014-01-02 07:47:28 -0500 |
---|---|---|
committer | epitron <chris@ill-logic.com> | 2014-01-02 07:47:28 -0500 |
commit | e63fc1bed423e7b84e257000d7d25bb812d37685 (patch) | |
tree | 346b662307a9bb67cadf275e31b189005a22a352 /youtube_dl/utils.py | |
parent | 1b969041d701e2fb7ff106476b91084dbc67332a (diff) |
Added '--xattrs' option which writes metadata to the file's extended attributes using a youtube-dl postprocessor.
Works on Linux, OSX, and Windows.
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r-- | youtube_dl/utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 2e48f187e..20ebea38c 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -809,6 +809,15 @@ def date_from_str(date_str): return today + delta return datetime.datetime.strptime(date_str, "%Y%m%d").date() +def hyphenate_date(date_str): + """ + Convert a date in 'YYYYMMDD' format to 'YYYY-MM-DD' format""" + match = re.match(r'^(\d\d\d\d)(\d\d)(\d\d)$', date_str) + if match is not None: + return '-'.join(match.groups()) + else: + return date_str + class DateRange(object): """Represents a time interval between two dates""" def __init__(self, start=None, end=None): |