aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-01-07 05:44:44 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-01-07 05:44:44 +0100
commit5f263296eaa72ddca232d734a2625bcd85771908 (patch)
tree20be6ebdfb0b1f36c789c7f0cf86f70b0a5c2e69 /youtube_dl/utils.py
parent89650ea3a680a383d7e6129e9c11b129a23e9150 (diff)
parente63fc1bed423e7b84e257000d7d25bb812d37685 (diff)
Merge remote-tracking branch 'epitron/metadata-pp'
Conflicts: youtube_dl/PostProcessor.py
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 0b0d1eb90..a509f8e2f 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -818,6 +818,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):