diff options
author | dakkar <dakkar@luxion> | 2005-11-09 17:14:54 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2005-11-09 17:14:54 +0000 |
commit | 27cff350e9e5fb832185bc14dee35b5b8f942a81 (patch) | |
tree | e89f9b5d457b711cce6d908ef0b33792cab20e75 /script/check_icons.pl | |
parent | ora il BookmarksManager gestisce per bene i tag multipli, e i template sono f... (diff) | |
download | Bookmarks-27cff350e9e5fb832185bc14dee35b5b8f942a81.tar.gz Bookmarks-27cff350e9e5fb832185bc14dee35b5b8f942a81.tar.bz2 Bookmarks-27cff350e9e5fb832185bc14dee35b5b8f942a81.zip |
* passati i template a HTML4, altrimenti l'autocompletamento non va
* aggiunto autocompletamento per i nomi di tag
* migliorato il caricatore da YAML
* aggiunto un convertitore XBEL -> YAML
* aggiunto campo 'tipo icona'
* aggiunta funzionalità di edit e delete di link
* dopo ogni update di un link, i tag non più riferiti vengono cancellati
* migliorato il recupero favicon, con tipo
Diffstat (limited to 'script/check_icons.pl')
-rw-r--r-- | script/check_icons.pl | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/script/check_icons.pl b/script/check_icons.pl new file mode 100644 index 0000000..2afdc7d --- /dev/null +++ b/script/check_icons.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl +use strict; +use warnings; +use FindBin; +use DBI; +use MIME::Base64; +use File::MMagic; +use Path::Class; + +my $DBHOME=dir($FindBin::Bin)->parent->file('bookmarks.db'); +my $db=DBI->connect("dbi:SQLite:$DBHOME"); + +my $magic=File::MMagic->new(); + +my $sth=$db->prepare('select pk,icon from links'); +$sth->execute(); +my ($pk,$icon,$type); +my @to_clean=();my %to_update; +while (($pk,$icon)=$sth->fetchrow_array()) { + $icon=decode_base64($icon); + $type=$magic->checktype_contents($icon); + if ($type =~ /^text/) { + push @to_clean,$pk; + } + else { + $to_update{$pk}=$type; + } +} + +$sth=$db->prepare(q{update links set icon='' where pk=?}); +for $pk (@to_clean) { + $sth->execute($pk); +} +$sth=$db->prepare(q{update links set icon_type=? where pk=?}); +while (($pk,$type)=each %to_update) { + $sth->execute($type,$pk); +} + +$db->disconnect; |