from django.core.management.base import BaseCommand

from owltail.qrcode_reader import QRCodeReader


class Command(BaseCommand):
    help = 'Launch the qrcode reader with the cam'

    def handle(self, *args, **options):
        reader = QRCodeReader()
        print('QRCodeReader started')
        try:
            reader.run()
        except KeyboardInterrupt:
            reader.close_cam()
