diff options
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r-- | youtube_dl/utils.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 64300d8e0..0dab9fcc5 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1045,3 +1045,15 @@ def get_term_width(): except: pass return None + + +def month_by_name(name): + """ Return the number of a month by (locale-independently) English name """ + + ENGLISH_NAMES = [ + u'Januar', u'February', u'March', u'April', u'May', u'June', + u'July', u'August', u'September', u'October', u'November', u'December'] + try: + return ENGLISH_NAMES.index(name) + 1 + except ValueError: + return None |