1
0
mirror of https://github.com/l1ving/youtube-dl synced 2026-06-08 07:23:33 +08:00

Option --lastrun is now more tolerant for errors.

Uses now .readline() and .strip() on date file.
This commit is contained in:
Viktor Lindgren
2013-09-21 20:56:03 +02:00
Unverified
parent e071e4cb8f
commit f4cb904a5e
+4 -3
View File
@@ -56,6 +56,7 @@ from .FileDownloader import *
from .extractor import gen_extractors
from .YoutubeDL import YoutubeDL
from .PostProcessor import *
from datetime import date as dateh
def parseOpts(overrideArguments=None):
def _readOptions(filename_bytes):
@@ -536,10 +537,10 @@ def _real_main(argv=None):
if opts.lastrun:
if not os.path.exists(opts.lastrun):
with open(opts.lastrun, "w") as conf:
conf.write(date_from_str("now"))
conf.write(dateh.today().strftime("%Y%m%d"))
with open(opts.lastrun, "r") as conf:
date = DateRange(conf.read(), opts.datebefore)
date = DateRange(conf.readline().strip(), opts.datebefore)
else:
date = DateRange(opts.dateafter, opts.datebefore)
@@ -680,7 +681,7 @@ def _real_main(argv=None):
if opts.lastrun and retcode is 0:
with open(opts.lastrun, "w") as conf:
conf.write(date_from_str("now"))
conf.write(dateh.today().strftime("%Y%m%d"))
sys.exit(retcode)