assente Guru


Joined: 12 Apr 2004 Posts: 570 Location: Torino, italia, New Europe
|
Posted: Sat Dec 04, 2004 2:56 pm Post subject: [TIP] Esportare i contatti da Evolution a GMail |
|
|
Non ho trovato uno script che mi permettesse di farlo, quindi me ne sono fatto uno io; ho notato che l'email viene scritta nel vcf da evo con tag diversi, a seconda della versione di Evolution, quindi il mio consiglio è controllare che sia sempre lo stesso: EMAIL;TYPE=WORK;X-EVOLUTION-UI-SLOT=1: oppure EMAIL:
Spero che questo script possa servire anche a qualcun'altro.
Non è molto che uso Ruby, ma sono sicuro che si può fare la stessa cosa in maniera più elegante e compatta.. Se avete qualche idea, fatemelo sapere!
Code: |
#! /usr/bin/ruby
=begin
vcf2csf - Export vcffile to csvfile
$Author: Assente $
Copyright (C) 2004 assente.altervista.org
This program is free software.
You can distribute/modify this program under
the terms of the GPL License.
=end
# CONFIG ME
vcfwords=["FN:","EMAIL;TYPE=WORK;X-EVOLUTION-UI-SLOT=1:","TEL;TYPE=CELL;X-EVOLUTION-UI-SLOT=3:"]
csvwords=["Full Name","Email Address","Mobile"]
#
if (ARGV[0]=="--help" || ARGV[0]==nil || ARGV[1]==nil)
puts "Usage: ./vcf2csf.rb [] []
Function: Convert a vcffile to csvfile, usefull to export contacts from Evolution to GMail"
else
vcffile=ARGV[0]
csvfile=ARGV[1]
csv=""
rows=open(vcffile).readlines
for i in 0..rows.length-1
if rows[i].slice(0,5)=='BEGIN'
csv << "\n"
end
for j in 0..vcfwords.length-1
if rows[i].slice(0,vcfwords[j].length)==vcfwords[j]
csv << rows[i].slice(vcfwords[j].length,30).chomp
csv << ","
end
end
end
c=open(csvfile,'w+');
c.write(csvwords.join(",")+csv)
c.close
end
|
_________________ Blog
E8400, 4850, P5q |
|