def host(email, file): ql._checkdata(email, 'string', 'EMAIL DATA FOR QR') ql._checkdata(file, 'string', 'FILE NAME DATA FOR QR') ql._verifyemail(str(email)) url = ql._host(email, file) host = 'URL:' + str(ql._shorturl(url)) return host
def url(qrdata, short=False): ql._checkdata(qrdata, 'string', 'URL DATA FOR QR') ql._checkdata(short, False, 'URL SHORTNING OPTION') if (short): return ('URL:' + str(ql._shorturl(qrdata))) else: return ('URL:' + str(qrdata))
def transparent(qrdata, name, img="", size=100): for per in ql._percentbar([1, 2, 3, 4, 5, 6, 7, 8], 'transparent'): if per == 1: ql._checkdata(qrdata, 'string', 'DATA FOR QR') if per == 2: ql._checkdata(name, 'string', 'NAME FOR QR') if per == 3: ql._checkdata(img, 'string', 'IMAGEURL') if per == 4: ql._checkdata(size, 0, 'SIZE FOR QR', _less=100, _more=1000) if per == 5: configration = { "data": str(qrdata), "image": str(img), "x": 0, "y": 0, "size": int(size), "crop": True, "download": False, "file": "svg" } if per == 6: svg = ql._reqmonkeyQR(url=1, data=configration) if per == 7: ql._writesvg(svg, str(name)) if per == 8: ql._svg2png((str(name) + '.svg'), (str(name)))
def wifi(ssid, password, encryption=0): ql._checkdata(ssid, 'string', 'SSID FOR QR') ql._checkdata(password, 'string', 'PASSWORD FOR QR') ql._checkdata(encryption, 0, 'ENCRYPTION FOR QR', _more=2) enc = {'0': 'nopass', '1': 'WPA', '2': 'WEP'} wifi = f'''WIFI:S:{ssid};T:{enc[str(encryption)]};P:{password};;''' return wifi
def classic(qrdata, name, size=1000): for per in ql._percentbar([1, 2, 3, 4, 5, 6, 7], 'classic'): if per == 1: ql._checkdata(qrdata, 'string', 'DATA FOR QR') if per == 2: ql._checkdata(name, 'string', 'NAME FOR QR') if per == 3: ql._checkdata(size, 0, 'SIZE FOR QR', _more=2000, _less=200) if per == 4: configration = { "data": str(qrdata), "config": { "body": "square", "logo": "" }, "size": int(size), "download": False, "file": "svg" } if per == 5: svg = ql._reqmonkeyQR(url=0, data=configration) if per == 6: ql._writesvg(svg, str(name)) if per == 7: ql._svg2png((str(name) + '.svg'), (str(name)))
def web(qrdata, name, tittle=''): for per in ql._percentbar( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], 'web'): if per == 1: ql._checkdata(qrdata, ['q', 'r'], 'WEB TEXT DATA FOR QR') if per == 2: ql._checkdata(name, 'string', 'NAME FOR QR') if per == 3: ql._checkdata(tittle, 'string', 'TITTLE FOR YOUR WEB TEXT') if per == 4: temp0 = 0 if per == 5: for temp1 in qrdata: temp0 = temp0 + 1 if per == 6: if (temp0 > 15): print( f"ERROR: webQR can't contain more than 15 lines and 1 tittle but you have given {str(temp0)} lines" ) sys.exit() if per == 7: url = '''https://mjfv74xauzaho1ipyjadzg-on.drv.tw/QRlib/QRlib.html?''' if per == 8: temp3 = 1 if per == 9: for temp2 in qrdata: url = (str(url) + 'text' + str(temp3) + '=' + ql._urlencode(str(temp2)) + '&') temp3 = temp3 + 1 if per == 10: url = str(url) + 'text=' + str(tittle) if per == 11: weburl = ('URL:' + str(url)) if per == 12: configration = { "data": str(weburl), "image": str("https://mjfv74xauzaho1ipyjadzg-on.drv.tw/QRlib/QRlib.png" ), "x": 0, "y": 0, "size": 500, "crop": True, "download": False, "file": "svg" } if per == 13: svg = ql._reqmonkeyQR(url=1, data=configration) if per == 14: ql._writesvg(svg, str(name)) if per == 15: ql._svg2png((str(name) + '.svg'), (str(name)))
def fast_design(qrdata, name, json): ql._checkdata(qrdata, 'string', 'DATA FOR QR') ql._checkdata(name, 'string', 'NAME FOR QR') ql._checkdata(json, 'string', 'JSON FILE PATH') read = open(json, "r") jd = ql._readjson(read) designQR(qrdata, name, body=jd['body'], frame=jd['frame'], ball=jd['ball'], bodycolor=jd['bodycolor'], bgcolor=jd['bgcolor'], ballcolor=jd['ballcolor'], framecolor=jd['framecolor'], shadecolor=jd['shadecolor'], shadeonball=jd['shadeonball'], shadetype=jd['shadetype'], logo=jd['logo'], size=jd['size'])
def vcard3(firstname, lastname='', position='', work='', org='', website='', email='', phone='', homephone='', workphone='', homefax='', workfax='', city='', state='', country='', zipcode='', street=''): ql._checkdata(firstname, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(lastname, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(position, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(work, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(org, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(website, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(email, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(phone, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(homephone, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(workphone, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(homefax, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(workfax, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(city, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(state, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(country, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(zipcode, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(street, 'string', 'VCARD2 DATA FOR QR') vcard3 = f'''BEGIN:VCARD VERSION:3.0 N:{lastname};{firstname} FN:{firstname} {lastname} TITLE:{position} {work} ORG:{org} URL:{website} EMAIL;TYPE=INTERNET:{email} TEL;TYPE=voice,work,pref:1 TEL;TYPE=voice,home,pref:2 TEL;TYPE=voice,cell,pref:{phone} TEL;TYPE=fax,work,pref:4 TEL;TYPE=fax,home,pref:5 ADR:;;{street};{city};{state};{zipcode};{country} END:VCARD''' return vcard3
def text(qrdata): ql._checkdata(qrdata, 'string', 'TEXT DATA FOR QR') return str(qrdata)
def vcard2(firstname, lastname='', position='', work='', org='', website='', email='', phone='', homephone='', workphone='', homefax='', workfax='', city='', state='', country='', zipcode='', street=''): ql._checkdata(firstname, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(lastname, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(position, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(work, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(org, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(website, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(email, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(phone, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(homephone, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(workphone, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(homefax, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(workfax, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(city, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(state, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(country, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(zipcode, 'string', 'VCARD2 DATA FOR QR') ql._checkdata(street, 'string', 'VCARD2 DATA FOR QR') vcard2 = f'''BEGIN:VCARD VERSION:2.1 N:{lastname};{firstname} TITLE:{position} {work} ORG:{org} URL:{website} EMAIL;TYPE=INTERNET:{email} TEL;CELL:{phone} TEL;WORK;VOICE:{workphone} TEL;HOME;VOICE:{homephone} TEL;WORK;FAX:{workfax} TEL;HOME;FAX:{homefax} ADR:;;{street};{city};{state};{zipcode};{country} END:VCARD''' return vcard2
def location(Latitude, Longitude): ql._checkdata(Latitude, 0, 'LATITUDE FOR QR', _less=0) ql._checkdata(Longitude, 0, 'LONGITUFE FOR QR', _less=0) url = f'''https://maps.google.com/local?q={float(Latitude)},{float(Longitude)}''' web = ql._shorturl(url) return str(web)
def phone(qrdata): ql._checkdata(qrdata, 'string', 'PHONE DATA FOR QR') return f'''tel:{qrdata}'''
def mecard(firstname, lastname='', nickname='', email='', phone1='', phone2='', phone3='', dob=ql._nowtimedate(), note='', city='', state='', country='', zipcode='', street=''): ql._checkdata(firstname, 'string', 'MECARD DATA FOR QR') ql._checkdata(lastname, 'string', 'MECARD DATA FOR QR') ql._checkdata(nickname, 'string', 'MECARD DATA FOR QR') ql._checkdata(city, 'string', 'MECARD DATA FOR QR') ql._checkdata(state, 'string', 'MECARD DATA FOR QR') ql._checkdata(country, 'string', 'MECARD DATA FOR QR') ql._checkdata(zipcode, 'string', 'MECARD DATA FOR QR') ql._checkdata(street, 'string', 'MECARD DATA FOR QR') ql._checkdata(email, 'string', 'MECARD DATA FOR QR') ql._checkdata(phone1, 'string', 'MECARD DATA FOR QR') ql._checkdata(phone3, 'string', 'MECARD DATA FOR QR') ql._checkdata(phone3, 'string', 'MECARD DATA FOR QR') ql._checkdata(note, 'string', 'MECARD DATA FOR QR') ql._checkdata(dob, ['Q', 'R'], 'MECARD DATA FOR QR') ql._checkdata(dob[0], 0, 'MECARD DATA FOR QR') ql._checkdata(dob[1], 0, 'MECARD DATA FOR QR') ql._checkdata(dob[2], 0, 'MECARD DATA FOR QR') return f'''MECARD:N:{lastname},{firstname};NICKNAME:{nickname};TEL:{phone1};TEL:{phone2};TEL:{phone3};EMAIL:{email};BDAY:{dob[0]}/{dob[1]}/{dob[2]};NOTE:{note};ADR:,,{street},{city},{state},{zipcode},{country};;'''
def email(email, subject='', message=''): ql._checkdata(email, 'string', 'EMAIL DATA FOR QR') ql._checkdata(subject, 'string', 'SUBJECT DATA FOR QR') ql._checkdata(message, 'string', 'MESSAGE DATA FOR QR') ql._verifyemail(str(email)) return f'''mailto:{email}?subject={subject}&body={message}'''
def event(tittle, location='', start=ql._nowtimedate(), end=ql._nowtimedate()): ql._checkdata(tittle, 'string', 'TITTLE FOR QR') ql._checkdata(location, 'string', 'LOCATION FOR QR') ql._checkdata(start, ['Q', 'R'], 'START TIME AND DATE FOR QR') ql._checkdata(end, ['Q', 'R'], 'END TIME AND DATE FOR QR') ql._checkdata(start[0], 0, 'YEAR DATA IN START FIELD OF EVENT', _less=ql._nowtimedate()) ql._checkdata(start[1], 0, 'MONTH DATA IN START FIELD OF EVENT', _more=12, _less=0) ql._checkdata(start[2], 0, 'DATE DATA IN START FIELD OF EVENT', _more=31, _less=0) ql._checkdata(start[3], 0, 'HOUR DATA IN START FIELD OF EVENT', _more=24, _less=0) ql._checkdata(start[4], 0, 'MINUTE DATA IN START FIELD OF EVENT', _more=60, _less=0) ql._checkdata(end[0], 0, 'YEAR DATA IN END FIELD OF EVENT', _less=ql._nowtimedate()) ql._checkdata(end[1], 0, 'MONTH DATA IN END FIELD OF EVENT', _more=12, _less=0) ql._checkdata(end[2], 0, 'DATE DATA IN END FIELD OF EVENT', _more=31, _less=0) ql._checkdata(end[3], 0, 'HOUR DATA IN END FIELD OF EVENT', _more=24, _less=0) ql._checkdata(end[4], 0, 'MINUTE DATA IN END FIELD OF EVENT', _more=60, _less=0) if (len(str(start[1])) == 1): sm = '0' + str(start[1]) else: sm = str(start[1]) if (len(str(start[2])) == 1): sd = '0' + str(start[2]) else: sd = str(start[2]) if (len(str(start[3])) == 1): sh = '0' + str(start[3]) else: sh = str(start[3]) if (len(str(start[4])) == 1): smi = '0' + str(start[4]) else: smi = str(start[4]) if (len(str(end[1])) == 1): em = '0' + str(end[1]) else: em = str(end[1]) if (len(str(end[2])) == 1): ed = '0' + str(end[2]) else: ed = str(end[2]) if (len(str(end[3])) == 1): eh = '0' + str(end[3]) else: eh = str(end[3]) if (len(str(end[4])) == 1): emi = '0' + str(end[4]) else: emi = str(end[4]) sy = str(start[0]) ey = str(end[0]) event = f'''BEGIN:VEVENT SUMMARY:{tittle} LOCATION:{location} DTSTART:{sy}{sm}{sd}T{sh}{smi}00 DTEND:{ey}{em}{ed}T{eh}{emi}00 END:VEVENT''' return event
def custom(qrdata, name, body=5, frame=13, ball=15, bodycolor=(148, 143, 32), bgcolor=(255, 255, 255), ballcolor=(26, 26, 56), framecolor=(3, 190, 242), shadecolor=(41, 136, 161), shadeonball=True, shadetype=0, logo='', size=200): for per in ql._percentbar([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 ], 'custom'): if per == 1: ql._checkdata(qrdata, 'string', 'DATA FOR QR') if per == 2: ql._checkdata(name, 'string', 'NAME FOR QR') if per == 3: ql._checkdata(body, 0, 'BODY FOR QR', _less=0, _more=21) if per == 4: ql._checkdata(frame, 0, 'FRAME FOR QR', _less=0, _more=16) if per == 5: ql._checkdata(ball, 0, 'BALL FOR QR', _less=0, _more=19) if per == 6: ql._checkdata(bodycolor, (0, 0, 0), 'BODY COLOUR FOR QR') if per == 7: ql._checkdata(bgcolor, (0, 0, 0), 'BACK GROUND COLOUR FOR QR') if per == 8: ql._checkdata(ballcolor, (0, 0, 0), 'BALL COLOUR FOR QR') if per == 9: ql._checkdata(framecolor, (0, 0, 0), 'FRAME COLOUR FOR QR') if per == 10: ql._checkdata(shadecolor, (0, 0, 0), 'SHADING COLOUR FOR QR') if per == 11: ql._checkdata(shadeonball, True, 'IF WANT SHADE ON BALL') if per == 12: ql._checkdata(logo, 'string', 'LOGO') if per == 13: ql._checkdata(size, 0, 'SIZE FOR QR', _less=200, _more=2000) if per == 14: ql._checkdata(shadetype, 0, 'TYPE OF SHADEING', _less=0, _more=1) if per == 15: shadeformat = {'0': 'radial', '1': 'linear'} if per == 16: shadetype1 = shadeformat[str(shadetype)] if per == 17: design = { '0': 'square', '1': 'mosaic', '2': 'dot', '3': 'circle', '4': 'circle-zebra', '5': 'circle-zebra-vertical', '6': 'circular', '7': 'edge-cut', '8': 'edge-cut-smooth', '9': 'japnese', '10': 'leaf', '11': 'pointed', '12': 'pointed-edge-cut', '13': 'pointed-in', '14': 'pointed-in-smooth', '15': 'pointed-smooth', '16': 'round', '17': 'rounded-in', '18': 'rounded-in-smooth', '19': 'rounded-pointed', '20': 'star', '21': 'diamond' } if per == 18: _body = design[str(body)] if per == 19: _frame = ('frame' + str(frame)) if per == 20: _ball = ('ball' + str(ball)) if per == 21: _bodycolor = ql._rgb2hex(bodycolor) if per == 22: _bgcolor = ql._rgb2hex(bgcolor) if per == 23: _framecolor = ql._rgb2hex(framecolor) if per == 24: _ballcolor = ql._rgb2hex(ballcolor) if per == 25: _shadecolor = ql._rgb2hex(shadecolor) if per == 26: configration = { "data": str(qrdata), "config": { "body": str(_body), "eye": str(_frame), "eyeBall": str(_ball), "erf1": [], "erf2": ["fh"], "erf3": ["fv"], "brf1": [], "brf2": ["fh"], "brf3": ["fv"], "bodyColor": str(_bodycolor), "bgColor": str(_bgcolor), "eye1Color": str(_framecolor), "eye2Color": str(_framecolor), "eye3Color": str(_framecolor), "eyeBall1Color": str(_ballcolor), "eyeBall2Color": str(_ballcolor), "eyeBall3Color": str(_ballcolor), "gradientColor1": str(_bodycolor), "gradientColor2": str(_shadecolor), "gradientType": str(shadetype1), "gradientOnEyes": shadeonball, "logo": str(logo) }, "size": int(size), "download": False, "file": "svg" } if per == 27: svg = ql._reqmonkeyQR(url=0, data=configration) if per == 28: ql._writesvg(svg, str(name)) if per == 29: ql._svg2png((str(name) + '.svg'), (str(name)))
def sms(qrdata, message=''): ql._checkdata(qrdata, 'string', 'PHONE DATA FOR QR') ql._checkdata(message, 'string', 'MESSAGE DATA FOR QR') return f'''SMSTO:{qrdata}:{message}'''