mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-03-18 22:12:21 +09:00
Option --lastrun is now more tolerant for errors.
Uses now .readline() and .strip() on date file.
This commit is contained in:
parent
e071e4cb8f
commit
f4cb904a5e
@ -56,6 +56,7 @@ from .FileDownloader import *
|
|||||||
from .extractor import gen_extractors
|
from .extractor import gen_extractors
|
||||||
from .YoutubeDL import YoutubeDL
|
from .YoutubeDL import YoutubeDL
|
||||||
from .PostProcessor import *
|
from .PostProcessor import *
|
||||||
|
from datetime import date as dateh
|
||||||
|
|
||||||
def parseOpts(overrideArguments=None):
|
def parseOpts(overrideArguments=None):
|
||||||
def _readOptions(filename_bytes):
|
def _readOptions(filename_bytes):
|
||||||
@ -536,10 +537,10 @@ def _real_main(argv=None):
|
|||||||
if opts.lastrun:
|
if opts.lastrun:
|
||||||
if not os.path.exists(opts.lastrun):
|
if not os.path.exists(opts.lastrun):
|
||||||
with open(opts.lastrun, "w") as conf:
|
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:
|
with open(opts.lastrun, "r") as conf:
|
||||||
date = DateRange(conf.read(), opts.datebefore)
|
date = DateRange(conf.readline().strip(), opts.datebefore)
|
||||||
else:
|
else:
|
||||||
date = DateRange(opts.dateafter, opts.datebefore)
|
date = DateRange(opts.dateafter, opts.datebefore)
|
||||||
|
|
||||||
@ -680,7 +681,7 @@ def _real_main(argv=None):
|
|||||||
|
|
||||||
if opts.lastrun and retcode is 0:
|
if opts.lastrun and retcode is 0:
|
||||||
with open(opts.lastrun, "w") as conf:
|
with open(opts.lastrun, "w") as conf:
|
||||||
conf.write(date_from_str("now"))
|
conf.write(dateh.today().strftime("%Y%m%d"))
|
||||||
|
|
||||||
sys.exit(retcode)
|
sys.exit(retcode)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user