maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   Reading contacts from command line? (https://talk.maemo.org/showthread.php?t=60526)

jvesiluoma 2010-08-17 11:43

Reading contacts from command line?
 
Hi,

I'm trying to do a simple script that reads and lists contacts from osso-abook. So far I have found that the contacts are in /home/user/.osso-abook\db - file wich is a Berkley database file. But I haven't found any tool to read that, any suggestions how to do that? Is it possible to read contacts via dbus? If yes, then how? =)

I'm doing some nice little web interface to control N900, so far I have made a simple web interface (lighttpd + PHP) and I can read my messages and check calls via that web interface. I can also do everything that Phone_control (thanks to MohammadAG, made my scripts much simpler :D) does and some tricks more via that web interface. Oh, and of course that interface is heavily password protected :)


// Jarkko

ossipena 2010-08-17 11:48

Re: Reading contacts from command line?
 
rtcom probably is just too much for a script:
http://wiki.maemo.org/Documentation/...itecture/RTCOM

have you tried reading the db with sqlite?

jvesiluoma 2010-08-17 15:13

Re: Reading contacts from command line?
 
Quote:

Originally Posted by ossipena (Post 789225)
rtcom probably is just too much for a script:
http://wiki.maemo.org/Documentation/...itecture/RTCOM

have you tried reading the db with sqlite?

Dunno about rtcom, would have to read more about it, but sqlite won't read that db. But thanks anyway.

I found that there is a program called db4.7_dump that reads that db, but haven't found it for arm thought...


// Jarkko

schettj 2010-08-17 17:33

Re: Reading contacts from command line?
 
is the tcl api available?

http://download.oracle.com/docs/cd/E...tcl_using.html

jvesiluoma 2010-08-18 11:27

Re: Reading contacts from command line?
 
Quote:

Originally Posted by schettj (Post 789598)


Thanks, but I can't find a working version anywhere...

Here are some screenshots what have done so far with lighttpd + php:

http://www.jmv.fi/N900/

ossipena 2010-08-18 11:53

Re: Reading contacts from command line?
 
in backup zip there are all the contacts within one backup.vcf -file.

don't know though if the backup thing can be run within command line.

but that would be one way to do it.

dchky 2010-08-18 14:30

Re: Reading contacts from command line?
 
Quote:

Originally Posted by schettj (Post 789598)
is the tcl api available?

Unfortunately not : (

Looks like the only way is to write a small C / C++ application using libdb or libebook to get at the contacts.

jvesiluoma 2010-08-19 05:27

Re: Reading contacts from command line?
 
Quote:

Originally Posted by dchky (Post 790554)
Unfortunately not : (

Looks like the only way is to write a small C / C++ application using libdb or libebook to get at the contacts.


Ok, have to do that then. Thanks.

gkuenning 2010-08-19 05:42

Re: Reading contacts from command line?
 
Since I back up with rsync to my desktop and laptop, I have a copy of the DB on a machine that has db_dump. I found that "db_dump -p" gives a series of vcards encoded one per line. It wouldn't be hard to parse those further using a tool like awk or python.

Now that I think about it, Python has a Berkeley DB access library (bsddb), although I don't know if it's available for Maemo.

Jarkko, what kind of tool are you imagining? I.e., are you thinking "lookup_contact --home-phone Joe" would print out Joe's home phone number? (I'm thinking that if somebody writes a tool, it would be good to try to make it flexible so other people can use it in unanticipated ways.)

jvesiluoma 2010-08-19 06:22

Re: Reading contacts from command line?
 
Quote:

Originally Posted by gkuenning (Post 791359)
Since I back up with rsync to my desktop and laptop, I have a copy of the DB on a machine that has db_dump. I found that "db_dump -p" gives a series of vcards encoded one per line. It wouldn't be hard to parse those further using a tool like awk or python.

Now that I think about it, Python has a Berkeley DB access library (bsddb), although I don't know if it's available for Maemo.

Jarkko, what kind of tool are you imagining? I.e., are you thinking "lookup_contact --home-phone Joe" would print out Joe's home phone number? (I'm thinking that if somebody writes a tool, it would be good to try to make it flexible so other people can use it in unanticipated ways.)

Yeah, I found that I can make that dump on my desktop computer, but I would like to make this dynamic, so I can fetch contacts on the fly.

As far as I know, bsddb is not available for maemo. At least it is not included as default and quick search didn't give any results either.

Just simple export, like "dump_contacs -name -phonenumber -email -db addressbook.db" that exports contacts, for example "John Doe 123456789 john.doe@something.com". That way output could be parsed and maybe some other ppl would find some other use to that tool also.

If I have time, I'll start to write that kind of app...but I'll guess it will take some time. Busy at work nowdays...

Regards,
Jarkko


All times are GMT. The time now is 00:01.

vBulletin® Version 3.8.8