Vcard2people bash script

Preface: I really have only a very slight clue of what I am doing.

I think I confused Pete’s app and this

which I think? is a bash script?

I have both installed and haven’t got either to work, most likely operator(user) error !

vcard -A -a -d /boot/home/people /boot/home/Downloads/contacts.vcf

OK this worked to to some degree with that bash script.

Yep, that’s a script and something else than Pete’s tools which are available at HaikuDepot.

1 Like

Well, I have to say I haven’t made either of these scripts work at all.
If you enter just their filename, they print an appropriate help message, but trying any seemingly appropriate command does nothing – not even an error message. I’m not particularly motivated to investigate because my apps still work exactly as advertised! (Though I guess they’re just vcard 2.x. Don’t know anything about the vcard protocols.)

BTW I’m confused by the command line you give above because, again, “vcard” is not the name of either script! (An equivalent doesn’t work for me, either.)

Thanks Pete .

As stated earlier I’m not well versed in any of this.

The script did Populate files in my people folder with the file names as the contacts name and phone numbers and addresses in file attributes. If there were multiple phone numbers or address associated with a particular vcard there was prompt asking which I would like to use . My vcard version was 3.0 exported from my gmail contacts.

So thanks for the reply and the work you do/did for BeOS and Haiku !

OK, I’m afraid my confusion continues. :slightly_smiling_face:
If the above was the exact command you entered, and it did what you say – and you didn’t change any script names – then if you just have the apps you claim, you should just see "bash: vcard: command not found". (I just copied the two scripts over from the github site you gave and made them executable. There is no “vcard” script on the site.)

Can you give some more details? If you just type “vcard”, what do you see?

~> vcard
usage: vcard vcard [-h] [-A|a] [-d dir|-o path] file

People files will be created using the data from a vcard. Each vcard defined
by a given vcf/vcard file have its person file be named after the vcard's
full-name.
-o      changes the output person filename
-d      outputs all people files to a given directory-- useful if a file
        defines multiple vcards.
-A      saves vcard to the 'META:vcard' attribute of the person file
-a      writes vcard to the person file (disables usage of a photo)
-h      prints this message.
------------------------------------------------

this is the header to the file in /boot/home/config/non-packaged/bin:

#!/boot/system/bin/bash
# --------------------------------------
# VCARD2PERSON
# simple script for convertining a vcard
# into a haiku person file.
# CC0, jadedctrl@teknik.io
# --------------------------------------


# VCARD INPUT


Ran it again to test.

Duhh, this is frustrating… I think I need more details of how you acquired the files originally. I had to copy/paste them from the web page you specified, where they are named ‘vcard2person’ and ‘person2vcard’. There is no file on the site named ‘vcard’.

If I simply type ‘vcard2person’, I get the same help message you do, with one difference: where yours says ‘vcard…’ mine says ‘vcard2person…’. I see, though, from looking at the script that that is derived from the basename, so that’s expected.

If I add any arguments it just runs and exits without creating any files or printing an error – even if the arguments are nonsense.
I’ve never seen any query response like you did in the test above. Again, looking at the script, I see he uses a lot of shell commands. My OS version is a couple of years old, but I don’t think the Terminal environment has changed much. Possible, I suppose.

It seems the file you are running may be subtly different from the one I got. How exactly did you acquire it?

From this thread is where I started.

Sorry to keep at it. I feel I’m being obtuse, but what’s bothering me is how you ended up with a script named ‘vcard’ rather than ‘vcard2person’. (And also of course why it seems to work on your system but not mine!) As there is no Release on that page, I had to rather hackily display the raw script, select it all and copy it, then paste into a Haiku editor and save it. Is there an easier way I don’t know about?

@Pete If he pasted the script from the screen to the text editor like you did, he might have called the script something other than vcard2people and then the script may have used argv[0] to identify itself when the filename -h command was executed from the script.

@pete Sorry to have drug you into this rabbit hole and not being much help !

It took me some time to figure out the correct path format ! That’s how inexperienced I am in the terminal .

Here is the contents of my /boot/home/config/non-packaged/bin

screenshot2

Yeh, as I sort of noted in my last post, I figured that out as soon as I actually looked at the script. But it’s worse than that(!) as I will explain in my next post! :frowning_face: :frowning_face: :frowning_face:

AAARRRGGGHHH!! I am so sorry everybody!! I took a closer look at my copies,and both of them were missing just the very last line!! That of course was the action-line that invokes the real code, so it wasn’t surprising that nothing happened!! :frowning_face: :frowning_face: I have no idea how that happened – and in both scripts!! I fixed that and now it’s actually doing something! Not quite the right thing yet, but I thought I’d better note my foul-up right away. [Hangs head in deep shame…]

2 Likes

Welcome to the club :sunglasses:

I love this idea - I have been laboriously entering contacts, some of them with a lot of data, from my collection of hundreds, as i need them (if I have time when I need them),

2 Likes

:slightly_smiling_face: :slightly_smiling_face:
meanwhile I’ve discovered why it’s still not quite working for me. The scripts rely on an ‘FN’ (Full Name) field in the vcard which was never in my code, so the vcards I create don’t have it. I forget what’s mandatory and what’s not in a vcard, but I’ll dig into it. And of course my old code never handled fancy stuff like photos.

EDIT: OK,there’s a nice table in Wikipedia that makes it all clear.
When I wrote vcard2people the VCard version was 2.1, where the ‘N’ field was required, as it was in 3.0. It is now optional. ‘FN’ was optional there, but now in 3.0 and 4.0 it is required! The ‘VERSION’ key has apparently always been mandatory, but I ignore it. Some updating is obviously needed!

3 Likes

Well thanks again. And I appreciate your original coding efforts and contributions here. Also looking forward to the updated app !

Thanks to SamuraiCrow and the others that chimed in.

Oh and Jaidedcd for the script that I ended up using!

Making it easier to import contacts will bring in more Haiku users !

3 Likes

@bronzie94 : Already working on it :wink:

4 Likes

There is a revamped People app on HaikuPorts called Mr. Peeps. If you want to add a full featured importer to the latest VCard format, maybe using its expanded mime type would be advisable.

Also, the code license is the same if you wanted to implement it or any parts of it into the official People app or just replace the People app with it, that would just be a matter of giving credit where credit is due.