diff options
author | dakkar <dakkar@luxion> | 2005-10-20 13:06:51 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2005-10-20 13:06:51 +0000 |
commit | ca92ca7ec5a2e5b348e259583e0dda6b7571fcf9 (patch) | |
tree | dd3a30544f6b77dffec502eaa6b5e805089c7f23 | |
parent | comincia a far finta di andare. le icone non vengono caricate, non so perché (diff) | |
download | Bookmarks-ca92ca7ec5a2e5b348e259583e0dda6b7571fcf9.tar.gz Bookmarks-ca92ca7ec5a2e5b348e259583e0dda6b7571fcf9.tar.bz2 Bookmarks-ca92ca7ec5a2e5b348e259583e0dda6b7571fcf9.zip |
ancora non inserisce le icone: se si fa bind_param($pos,$blob_data,DBI::SQL_BLOB) funziona, ma se fa bind_param($pos,undef,DBI::SQL_BLOB);execute($blob_data) non va. Peccato che Class::DBI faccia la seconda cosa...
-rw-r--r-- | lib/Bookmarks/M/DB/Links.pm | 2 | ||||
-rw-r--r-- | lib/Bookmarks/M/DB/Tags.pm | 6 | ||||
-rw-r--r-- | root/links | 2 | ||||
-rwxr-xr-x | script/bookmarks_load.pl | 18 | ||||
-rw-r--r-- | test.yaml | 2 |
5 files changed, 21 insertions, 9 deletions
diff --git a/lib/Bookmarks/M/DB/Links.pm b/lib/Bookmarks/M/DB/Links.pm index 3ae761d..92fd74b 100644 --- a/lib/Bookmarks/M/DB/Links.pm +++ b/lib/Bookmarks/M/DB/Links.pm @@ -11,7 +11,7 @@ for my $col_name (qw(add_date last_access_date)) { __PACKAGE__->has_many( tags => ['Bookmarks::M::DB::LinksTags' => 'tag'] ); -__PACKAGE__->data_type( icon => DBI::SQL_BINARY ); +__PACKAGE__->data_type( icon => DBI::SQL_BLOB ); =head1 NAME diff --git a/lib/Bookmarks/M/DB/Tags.pm b/lib/Bookmarks/M/DB/Tags.pm index c1e1f0b..732c8b7 100644 --- a/lib/Bookmarks/M/DB/Tags.pm +++ b/lib/Bookmarks/M/DB/Tags.pm @@ -40,7 +40,11 @@ sub get_all_tags_by_popularity { sub ordered_links { my ($self)=@_; my @links=$self->links(); - return sort {$a->access_count <=> $b->access_count} @links; + return sort { + ($a->access_count || 0) + <=> + ($b->access_count || 0) + } @links; } =head1 NAME @@ -6,7 +6,7 @@ <p>Tag: [% tag.name %] ( [% tag.descr %] )</p> <ol> [% FOR link IN links %] -<li><img src="[% base _ 'icon?link=' _ link.pk %]" /> <a href="[% link.url %]">»[% link.title %]«</a></li> +<li><img src="[% base _ 'icon?link=' _ link.pk %]" /> <a href="[% link.url %]">»[% link.title %]«</a> (creato: [% link.add_date() %])</li> [% END %] </ol> </body> diff --git a/script/bookmarks_load.pl b/script/bookmarks_load.pl index 2687684..8535348 100755 --- a/script/bookmarks_load.pl +++ b/script/bookmarks_load.pl @@ -14,6 +14,8 @@ my $links; $yaml = <>; $links=YAML::Load($yaml); } +my $icon=do {local $/;open my $fh,'<:raw','favicon.ico';<$fh>}; +print "Icon is $icon\n"; my %fields=( description => 'title', @@ -22,22 +24,28 @@ my %fields=( modified => 'last_access_date', ); +Bookmarks::M::DB::Links->db_Main()->{sqlite_handle_binary_nulls} = 1; +Bookmarks::M::DB::Links->autoupdate(0); + for my $link (@$links) { print "Loading $link->{href}\n"; my $dblink=Bookmarks::M::DB::Links->find_or_create({ url => $link->{href}, }); - if (!Bookmarks::Utils::check_link($link->{href})) { - warn "Link $link->{href} non valido, marco come tale\n"; - $link->{title}.=' [INVALID]'; - } +# if (!Bookmarks::Utils::check_link($link->{href})) { +# warn "Link $link->{href} non valido, marco come tale\n"; +# $link->{title}.=' [INVALID]'; +# } $link->{created}||=time(); $link->{modified}||=time(); while (my ($f1,$f2) = each %fields) { $dblink->$f2($link->{$f1}); } - $dblink->icon(Bookmarks::Utils::get_site_icon($link->{href})); +# $dblink->icon(Bookmarks::Utils::get_site_icon($link->{href})); + $dblink->icon($icon); + print 'Set icon to: ',$dblink->icon(),"\n"; $dblink->update(); + print 'Set icon to: ',$dblink->icon(),"\n"; for my $tagname (@{$link->{tags}}) { my $dbtag=Bookmarks::M::DB::Tags->find_or_create({ name => $tagname, @@ -21,7 +21,7 @@ - OS - Mac OS X - created: 1096216689 - description: '' + description: 'SlashDot' href: http://slashdot.org/ modified: 1129213810 tags: |