Go Back   maemo.org - Talk > Devices > Nokia N900
 
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
  #1  
Old 2010-08-17, 11:43
jvesiluoma's Avatar
jvesiluoma jvesiluoma is offline
 
Join Date: Jan 2010
Posts: 28
Thanks!: 4
Thanked 58 Times in 6 Posts
Default 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 ) does and some tricks more via that web interface. Oh, and of course that interface is heavily password protected


// Jarkko
Reply With Quote
  #2  
Old 2010-08-17, 11:48
ossipena's Avatar
ossipena ossipena is offline
 
Join Date: Feb 2008
Location: Finland
Posts: 3,159
Thanks!: 3,087
Thanked 2,023 Times in 993 Posts
Default 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?
__________________
Want to know something?
K.I.S.S. approach:
wiki category:beginners. Browse it through and you'll be much wiser!
If the link doesn't help, just use
Google Custom Search
Reply With Quote
  #3  
Old 2010-08-17, 15:13
jvesiluoma's Avatar
jvesiluoma jvesiluoma is offline
 
Join Date: Jan 2010
Posts: 28
Thanks!: 4
Thanked 58 Times in 6 Posts
Default Re: Reading contacts from command line?

Quote:
Originally Posted by ossipena View Post
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
Reply With Quote
  #4  
Old 2010-08-17, 17:33
schettj's Avatar
schettj schettj is offline
 
Join Date: Nov 2009
Posts: 501
Thanks!: 29
Thanked 292 Times in 148 Posts
Default Re: Reading contacts from command line?

is the tcl api available?

http://download.oracle.com/docs/cd/E...tcl_using.html
Reply With Quote
  #5  
Old 2010-08-18, 11:27
jvesiluoma's Avatar
jvesiluoma jvesiluoma is offline
 
Join Date: Jan 2010
Posts: 28
Thanks!: 4
Thanked 58 Times in 6 Posts
Default Re: Reading contacts from command line?

Quote:
Originally Posted by schettj View Post

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/
Reply With Quote
  #6  
Old 2010-08-18, 11:53
ossipena's Avatar
ossipena ossipena is offline
 
Join Date: Feb 2008
Location: Finland
Posts: 3,159
Thanks!: 3,087
Thanked 2,023 Times in 993 Posts
Default 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.
__________________
Want to know something?
K.I.S.S. approach:
wiki category:beginners. Browse it through and you'll be much wiser!
If the link doesn't help, just use
Google Custom Search
Reply With Quote
  #7  
Old 2010-08-18, 14:30
dchky's Avatar
dchky dchky is offline
 
Join Date: Jun 2010
Location: Australian in the Philippines
Posts: 549
Thanks!: 115
Thanked 299 Times in 160 Posts
Send a message via ICQ to dchky Send a message via Yahoo to dchky Send a message via Skype™ to dchky
Default Re: Reading contacts from command line?

Quote:
Originally Posted by schettj View Post
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.
Reply With Quote
  #8  
Old 2010-08-19, 05:27
jvesiluoma's Avatar
jvesiluoma jvesiluoma is offline
 
Join Date: Jan 2010
Posts: 28
Thanks!: 4
Thanked 58 Times in 6 Posts
Default Re: Reading contacts from command line?

Quote:
Originally Posted by dchky View Post
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.
Reply With Quote
  #9  
Old 2010-08-19, 05:42
gkuenning gkuenning is offline
 
Join Date: May 2010
Location: Claremont (LA), California
Posts: 67
Thanks!: 4
Thanked 36 Times in 21 Posts
Send a message via AIM to gkuenning
Default 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.)
Reply With Quote
The Following User Says Thank You to gkuenning For This Useful Post:
  #10  
Old 2010-08-19, 06:22
jvesiluoma's Avatar
jvesiluoma jvesiluoma is offline
 
Join Date: Jan 2010
Posts: 28
Thanks!: 4
Thanked 58 Times in 6 Posts
Default Re: Reading contacts from command line?

Quote:
Originally Posted by gkuenning View Post
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

Last edited by jvesiluoma; 2010-08-19 at 07:16.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 18:52.