1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# -*- coding: utf-8 *-*
try:
from qrtools import debug, QRCode
except:
debug(u"Can't locate base data type. Aborting 'mecard' plugin.")
import re
class MeCard(QRCode):
"""meCard Data Type"""
name = u'mecard'
def __init__(self):
QRCode.__init__(self)
def recognise(self, data):
return data.lower().startswith(u"mecard:")
def encode(self, data):
return "MECARD:" + ";".join([":".join(i) for i in data]) + ";"
def decode(self, data_string):
return dict(re.findall("(.*?):(.*?);", data.replace("MECARD:",""), re.IGNORECASE))
|