support single ebook harvest

pull/94/head
eric 2020-07-29 13:34:11 -04:00
parent 73b863450e
commit 6566afd92f
1 changed files with 5 additions and 1 deletions

View File

@ -9,10 +9,14 @@ class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('limit', nargs='?', type=int, default=0, help="max to harvest")
parser.add_argument('--ebook', nargs='?', type=int, default=0, help="ebook to harvest")
def handle(self, limit=0, **options):
limit = int(limit) if limit else 0
rl = RateLimiter()
if options.get('ebook'):
onlines = Ebook.objects.filter(id=options.get('ebook'))
else:
onlines = Ebook.objects.filter(format='online')
done = 0
for online in onlines: