コード例 #1
0
if os.path.exists(os.path.join(os.getenv("HOME"), ".identity.vcf")):
	output("My identity is known to me. Life is good.")
	sys.exit(0)

output("I have no identity yet. This is a problem. I'm a robot without an identity.")

time.sleep(3)

output("Now I'm thinking of a solution. Let me define my own identity autonomously.")

time.sleep(3)

vc = gen_vcard.Vcard()
vc.name = gen_data.create_name()
name = ' '.join(vc.name)
vc.street = gen_data.create_street()

output("Wow, now I've got an identity. My name is %s. and I'm living in %s." % (name, vc.street))
output("Life is good.")

vc.adr = gen_data.create_city_state_zip()
vc.company = gen_data.create_company_name()
vc.birthday = gen_data.create_birthday()
vc.email = gen_data.create_email(name=vc.name)

f = open(os.path.join(os.getenv("HOME"), ".identity.vcf"), "w")
print >>f, vc.printout()
f.close()

コード例 #2
0
ファイル: gen_vcard.py プロジェクト: Codeminded/tracker
try:
    count = int (sys.argv[1])
except:
    count = 1

vcard = """BEGIN:VCARD
VERSION:3.0
UID:barnum-%d
FN:%s
N:%s;%s;;;
BDAY:%s
EMAIL;TYPE=WORK:%s
X-JABBER;TYPE=HOME:%s
ADR;TYPE=HOME:;;%s;%s;%s;%s;USA
END:VCARD"""

for dummy in range (0, count):
    name = gen_data.create_name()
    adr = gen_data.create_city_state_zip()

    print vcard % (random.randint(0, sys.maxint),
                   ' '.join(name),
                   name[1], name[0],
                   gen_data.create_birthday(),
                   gen_data.create_email(name=name),
                   gen_data.create_email(name=name),
                   gen_data.create_street(),
                   adr[1], adr[2], adr[0],
                   )
コード例 #3
0
ファイル: gen_vcard.py プロジェクト: d0b3rm4n/tracker
    count = 1

vcard = """BEGIN:VCARD
VERSION:3.0
UID:barnum-%d
FN:%s
N:%s;%s;;;
BDAY:%s
EMAIL;TYPE=WORK:%s
X-JABBER;TYPE=HOME:%s
ADR;TYPE=HOME:;;%s;%s;%s;%s;USA
END:VCARD"""

for dummy in range(0, count):
    name = gen_data.create_name()
    adr = gen_data.create_city_state_zip()

    print vcard % (
        random.randint(0, sys.maxint),
        ' '.join(name),
        name[1],
        name[0],
        gen_data.create_birthday(),
        gen_data.create_email(name=name),
        gen_data.create_email(name=name),
        gen_data.create_street(),
        adr[1],
        adr[2],
        adr[0],
    )