projects
/
bookreader.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
51238ee
)
tweaks for missing pages
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sat, 23 Jun 2012 22:56:29 +0000
(
00:56
+0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sat, 23 Jun 2012 22:56:29 +0000
(
00:56
+0200)
plack/lib/Plack/App/BookReader.pm
patch
|
blob
|
history
diff --git
a/plack/lib/Plack/App/BookReader.pm
b/plack/lib/Plack/App/BookReader.pm
index
8cc9422
..
f3f26f3
100644
(file)
--- a/
plack/lib/Plack/App/BookReader.pm
+++ b/
plack/lib/Plack/App/BookReader.pm
@@
-108,6
+108,7
@@
br.getPageHeight = function(index) {
// We load the images from archive.org -- you can modify this function to retrieve images
// using a different URL structure
br.getPageURI = function(index, reduce, rotate) {
// We load the images from archive.org -- you can modify this function to retrieve images
// using a different URL structure
br.getPageURI = function(index, reduce, rotate) {
+ if ( ! pages[index] ) return;
// reduce and rotate are ignored in this simple implementation, but we
// could e.g. look at reduce and load images from a different directory
// or pass the information to an image server
// reduce and rotate are ignored in this simple implementation, but we
// could e.g. look at reduce and load images from a different directory
// or pass the information to an image server
@@
-167,7
+168,7
@@
br.getPageNum = function(index) {
br.numLeafs = pages.length;
// Book title and the URL used for the book title link
br.numLeafs = pages.length;
// Book title and the URL used for the book title link
-br.bookTitle= '
Open Library BookReader Presentation
';
+br.bookTitle= '
%s
';
br.bookUrl = 'http://openlibrary.org';
// Override the path used to find UI images
br.bookUrl = 'http://openlibrary.org';
// Override the path used to find UI images
@@
-306,9
+307,10
@@
sub serve_path {
$pages = decode_json read_file $pages_path;
} else {
$pages = [
$pages = decode_json read_file $pages_path;
} else {
$pages = [
+ grep { defined $_ }
map {
my ( $w, $h ) = imgsize("$path/$_");
map {
my ( $w, $h ) = imgsize("$path/$_");
- $w && $h ? [ "$dir_url/$_", $w, $h ] :
[]
+ $w && $h ? [ "$dir_url/$_", $w, $h ] :
undef
} sort { $a <=> $b } @page_files
];
make_basedir $pages_path;
} sort { $a <=> $b } @page_files
];
make_basedir $pages_path;
@@
-316,7
+318,7
@@
sub serve_path {
warn "# created $pages_path ", -s $pages_path, " bytes\n";
}
warn "# pages = ",dump($pages);
warn "# created $pages_path ", -s $pages_path, " bytes\n";
}
warn "# pages = ",dump($pages);
- $page = sprintf $reader_page, $dir, encode_json( $pages )
;
+ $page = sprintf $reader_page, $dir, encode_json( $pages )
, $dir; # FIXME: title
} else {
} else {