projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
752c8c9
)
[YoutubeDL] Avoid negative timestamps on Windows
author
Sergey M․
<dstftw@gmail.com>
Tue, 2 Dec 2014 15:18:07 +0000
(21:18 +0600)
committer
Sergey M․
<dstftw@gmail.com>
Tue, 2 Dec 2014 15:18:07 +0000
(21:18 +0600)
youtube_dl/YoutubeDL.py
patch
|
blob
|
history
diff --git
a/youtube_dl/YoutubeDL.py
b/youtube_dl/YoutubeDL.py
index 21c7c298a830dd8b4a1b4651419506aaa8c8a8bc..f89ac4e1de513330467e3569a17ef624f2abc736 100755
(executable)
--- a/
youtube_dl/YoutubeDL.py
+++ b/
youtube_dl/YoutubeDL.py
@@
-787,6
+787,10
@@
class YoutubeDL(object):
info_dict['display_id'] = info_dict['id']
if info_dict.get('upload_date') is None and info_dict.get('timestamp') is not None:
info_dict['display_id'] = info_dict['id']
if info_dict.get('upload_date') is None and info_dict.get('timestamp') is not None:
+ # Working around negative timestamps in Windows
+ # (see http://bugs.python.org/issue1646728)
+ if info_dict['timestamp'] < 0 and os.name == 'nt':
+ info_dict['timestamp'] = 0
upload_date = datetime.datetime.utcfromtimestamp(
info_dict['timestamp'])
info_dict['upload_date'] = upload_date.strftime('%Y%m%d')
upload_date = datetime.datetime.utcfromtimestamp(
info_dict['timestamp'])
info_dict['upload_date'] = upload_date.strftime('%Y%m%d')