View previous topic :: View next topic |
Author |
Message |
egolf Tux's lil' helper
Joined: 27 Feb 2004 Posts: 116 Location: CH
|
Posted: Thu Jul 01, 2004 9:37 pm Post subject: [Howto] Da Evolution a Thunderbird (contatti, folder locali) |
|
|
Ho appena cambiato Email client, da evolution a Thunderbird, e subito mi sono trovato davanti a un problema, Evolution esporta i contatti solo come Vcard, formato che Thunderbird non vuole sapere d' importare: ho fatto una piccola ricerca su internet, (visto che non ho ancora iniziato a scriptare ) il risultato è stato questo sito. La soluzione al mio problema sono due script:
per il primo server aver installato python2 e bsddb3 per il secondo perl
Code: | emerge python2 bsddb3 perl -v |
exportevolution.py
Code: | #!/usr/bin/python2
import bsddb, os, re
home = os.getenv('HOME')
# This is the only variable you should change. If you do not know the
# location of your evloution address book, use `locate addressbook.db`
# to find it
#Quella che segue è l' unica variabile che bisogna cambiare (magari)
#indica il posto dove si trova addressbook.db.
#Si puo trovare con il comando: "locate addressbook.db"
dbname = '%s/evolution/local/Contacts/addressbook.db' % home
db = bsddb.hashopen(dbname, 'r')
for k in db.keys():
for line in db[k].split('\n'):
print line
db.close() |
vcard2tab.pl
Code: | #!/usr/bin/perl
use strict;
my $line;
my $name;
my $tel_work_voice;
my $tel_work_fax;
my $tel_home;
my $tel_pager;
my $tel_cell;
my $tel_voice;
my $email;
while ( $line = <STDIN> ) {
chomp ($line);
chop ($line) ; # trailing ^M
#BEGIN:VCARD
if ( $line eq "BEGIN:VCARD" ) {
$name = "";
$tel_work_voice = "";
$tel_work_fax = "";
$tel_home = "";
$tel_pager = "";
$tel_cell = "";
$tel_voice = "";
$email = "";
}
#X-EVOLUTION-FILE-AS:
if ( $line =~ /^X-EVOLUTION-FILE-AS\:.*/ ) {
$line =~ s/^X-EVOLUTION-FILE-AS://g;
$name = $line;
print $name." ";
print "\t";
}
#TEL;WORK;VOICE;
if ( $line =~ /^TEL;WORK;VOICE:.*/ ) {
$line =~ s/^TEL;WORK;VOICE://g;
$tel_work_voice = $line;
}
#TEL;WORK;FAX;
if ( $line =~ /^TEL;WORK;FAX:.*/ ) {
$line =~ s/^TEL;WORK;FAX://g;
$tel_work_fax = $line;
}
#TEL;HOME;
if ( $line =~ /^TEL;HOME:.*/ ) {
$line =~ s/^TEL;HOME://g;
$tel_home = $line;
}
#TEL;PAGER;
if ( $line =~ /^TEL;PAGER:.*/ ) {
$line =~ s/^TEL;PAGER://g;
$tel_pager = $line;
}
#TEL;CELL;
if ( $line =~ /^TEL;CELL:.*/ ) {
$line =~ s/^TEL;CELL://g;
$tel_cell = $line;
}
#TEL;VOICE;
if ( $line =~ /^TEL;VOICE:.*/ ) {
$line =~ s/^TEL;VOICE://g;
$tel_voice = $line;
}
#EMAIL;INTERNET;
if ( $line =~ /^EMAIL;INTERNET:.*/ ) {
$line =~ s/^EMAIL;INTERNET://g;
$email = $email.$line;
}
#EMAIL;QUOTED-PRINTABLE;INTERNET;
if ( $line =~ /^EMAIL;QUOTED-PRINTABLE;INTERNET:.*/ ) {
$line =~ s/^EMAIL;QUOTED-PRINTABLE;INTERNET://g;
$line =~ s/=0A/ /g; #=0A make it a space
$email = $email.$line;
}
#END:VCARD
if ( $line eq "END:VCARD" )
{
if ( $tel_work_voice eq "" )
{ print "\t";}
else
{ print "wk=".$tel_work_voice."\t"; }
if ( $tel_work_fax eq "" )
{ print "\t"; }
else
{print "fx=".$tel_work_fax."\t"; }
if ( $tel_home eq "" )
{ print "\t"; }
else
{ print "hm=".$tel_home."\t"; }
if ( $tel_pager eq "" )
{ print "\t"; }
else { print "pg=".$tel_pager."\t"; }
if ( $tel_cell eq "" )
{ print "\t"; }
else { print "cel=".$tel_cell."\t"; }
if ( $tel_voice eq "" )
{ print "\t"; }
else
{ print "alt=".$tel_voice."\t"; }
if ( $email eq "" )
{print "\t";}
else { print $email; }
print "\n";
}
}
|
basta mettere i due script nella stessa cartella, renderli eseguibili:
Code: | chmod a+x exportevolution.py
chmod a+x vcard2csv.pl |
e usarli:
Code: | ./exportevolution.py|./vcard2tab.pl >addressbook.tab |
Nel file ottenuto "addressbook.tab" ci sono ancora due o tre cose da mettere aposto, quindi apritelo con gvim o un altro editor:
1) staccate le email primarie dalle secondarie con una tabulazione
2) cancellate "hm=" e "cel="
Infine salvate e importate il file in Thunderbird.
Ci sono ancora un paio di cose che non mi piacciono molto,
1) che si usa no due linguaggi diversi (ma magari è bene cosi, visto che non mene intendo)
2) il lavoro che resta alla fine
ma questo procedimento risparmia un bel po' di lavoro, come già detto non mene intendo di scripting, ma magari c' è qualcuno che mi puo dare dei consigli per migliorare il procedimento (sarò contento di cambiare l' howto)
Infine spero che l' howto potrà servire a qualche n00b come me! _________________ Everything has its beauty but not everyone sees it.
-Confucius-
Last edited by egolf on Thu Jul 01, 2004 10:11 pm; edited 1 time in total |
|
Back to top |
|
|
egolf Tux's lil' helper
Joined: 27 Feb 2004 Posts: 116 Location: CH
|
Posted: Thu Jul 01, 2004 9:40 pm Post subject: |
|
|
Altro piccolo tip (trovato nel forum inglese):
per migrare le mail locali:
non dimenticate di sostituire <your_account>
Code: | cp ~/evolution/local/Inbox/mbox ~/.thunderbird/default.1vq/Mail/<your_account>/Inbox |
_________________ Everything has its beauty but not everyone sees it.
-Confucius- |
|
Back to top |
|
|
CarloJekko Veteran
Joined: 31 Mar 2005 Posts: 1315 Location: Baia Domizia :-)
|
Posted: Sun Jul 03, 2005 8:37 pm Post subject: |
|
|
grazie _________________ C. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|