|
2010-08-19
, 07:44
|
|
Posts: 28 |
Thanked: 58 times |
Joined on Jan 2010
|
#12
|
|
2011-04-17
, 12:36
|
|
Posts: 1,090 |
Thanked: 476 times |
Joined on Jan 2010
@ Ingolstadt, Germany
|
#13
|
|
2011-04-17
, 14:51
|
|
Posts: 1,090 |
Thanked: 476 times |
Joined on Jan 2010
@ Ingolstadt, Germany
|
#14
|
|
2011-04-17
, 16:22
|
|
Posts: 1,637 |
Thanked: 4,424 times |
Joined on Apr 2009
@ Germany
|
#15
|
import evolution
import sys
from optparse import OptionParser
def search_contact(options):
ebook = evolution.ebook.open_addressbook("default")
if not options.contact is None:
contacts = ebook.search(options.contact)
elif not options.full_name is None:
contacts = []
for c in ebook.get_all_contacts():
if c.get_name() == options.full_name:
contacts.append(c)
elif not options.nick_name is None:
contacts = []
for c in ebook.get_all_contacts():
if c.get_property("nickname") == options.nick_name:
contacts.append(c)
if (not options.attributes is None) and (len(options.attributes) > 0):
for contact in contacts:
print contact.get_property("full-name")
for a in options.attributes:
print contact.get_property(a)
if options.list:
for contact in contacts:
for p in contact.props:
value = contact.get_property(p.name)
if not value is None:
print p.name, value
if options.export:
for contact in contacts:
print contact.get_vcard_string()
def main():
parser = OptionParser()
parser.add_option("-c", "--contact", help="contact name to search for", action="store", type="string", dest="contact")
parser.add_option("-f", "--full-name", help="select contact with this name", action="store", type="string", dest="full_name")
parser.add_option("-n", "--nickname", help="select contact with this nickname", action="store", type="string", dest="nick_name")
parser.add_option("-a", "--attribute", help="contact attributes -a attribute1 -a attribute2 ..", action="append", type="string", dest="attributes")
parser.add_option("-e", "--export", help="print vcard string", action="store_true", dest="export", default=False)
parser.add_option("-l", "--list-attributes", help="list vcard attributes", action="store_true", dest="list", default=False)
(options, args) = parser.parse_args(sys.argv)
if len(sys.argv) <= 1:
parser.print_help()
else:
search_contact(options)
if __name__ == "__main__":
main()
|
2011-04-17
, 17:56
|
|
Posts: 1,090 |
Thanked: 476 times |
Joined on Jan 2010
@ Ingolstadt, Germany
|
#16
|
The Following User Says Thank You to b666m For This Useful Post: | ||
|
2011-04-17
, 21:16
|
|
Posts: 1,637 |
Thanked: 4,424 times |
Joined on Apr 2009
@ Germany
|
#17
|
|
2011-04-17
, 21:32
|
Posts: 291 |
Thanked: 398 times |
Joined on Jan 2011
@ USA
|
#18
|
|
2011-04-17
, 22:01
|
Posts: 435 |
Thanked: 769 times |
Joined on Apr 2010
|
#19
|
./contactretrieve Marco
|
2011-04-18
, 02:13
|
Posts: 67 |
Thanked: 36 times |
Joined on May 2010
@ Claremont (LA), California
|
#20
|
That bus is marked as fixed, but can't find libdb4.2 package for maemo(arm)?
Well, have to keep digging...
// Jarkko