add movie support

This commit is contained in:
David Rose 2004-03-17 07:02:38 +00:00
parent 1573ff1f73
commit a1bf8000e8
15 changed files with 412 additions and 211 deletions

View File

@ -18,11 +18,32 @@
#include "default_index_icons.h" #include "default_index_icons.h"
// This file was generated from left.png, right.png, and up.png; it // This file was generated from left.png, right.png, up.png, and
// provides data for default navigation icons if the -i parameter is // movie.png; it provides data for default navigation icons if the -i
// supplied on the command line. // parameter is supplied on the command line.
const char *default_left_icon_filename = "left.png"; const char *default_left_icon_filename = "left.png";
const char *default_right_icon_filename = "right.png";
const char *default_up_icon_filename = "up.png";
const char *default_movie_icon_filename = "movie.png";
/*
Use this series of commands to regenerate the tables:
bin2c -n default_left_icon left.png >> default_index_icons.cxx
bin2c -n default_right_icon right.png >> default_index_icons.cxx
bin2c -n default_up_icon up.png >> default_index_icons.cxx
bin2c -n default_movie_icon movie.png >> default_index_icons.cxx
*/
/*
* This table was generated by the command:
*
* bin2c -n default_left_icon left.png
*/
const unsigned char default_left_icon[] = { const unsigned char default_left_icon[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00,
0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00,
@ -72,11 +93,18 @@ const unsigned char default_left_icon[] = {
0xcf, 0xc2, 0x0b, 0xac, 0xa1, 0x03, 0xf8, 0xcc, 0xce, 0x69, 0xa3, 0xcf, 0xc2, 0x0b, 0xac, 0xa1, 0x03, 0xf8, 0xcc, 0xce, 0x69, 0xa3,
0x89, 0xc9, 0xd1, 0x9a, 0xc0, 0x73, 0x9e, 0x8d, 0xad, 0x7f, 0xbd, 0x89, 0xc9, 0xd1, 0x9a, 0xc0, 0x73, 0x9e, 0x8d, 0xad, 0x7f, 0xbd,
0xcf, 0x11, 0xe9, 0xc6, 0x04, 0xc1, 0x3d, 0x00, 0x00, 0x00, 0x00, 0xcf, 0x11, 0xe9, 0xc6, 0x04, 0xc1, 0x3d, 0x00, 0x00, 0x00, 0x00,
0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
}; };
const int default_left_icon_size = sizeof(default_left_icon);
const char *default_right_icon_filename = "right.png"; const int default_left_icon_len = 536;
/*
* This table was generated by the command:
*
* bin2c -n default_right_icon right.png
*/
const unsigned char default_right_icon[] = { const unsigned char default_right_icon[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00,
0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00,
@ -125,11 +153,18 @@ const unsigned char default_right_icon[] = {
0xcf, 0x75, 0x9f, 0x85, 0x3f, 0xa9, 0xb5, 0x43, 0xf9, 0xd1, 0x1a, 0xcf, 0x75, 0x9f, 0x85, 0x3f, 0xa9, 0xb5, 0x43, 0xf9, 0xd1, 0x1a,
0xab, 0x89, 0xc9, 0x79, 0x6f, 0x78, 0x6e, 0xac, 0x2f, 0xe3, 0x17, 0xab, 0x89, 0xc9, 0x79, 0x6f, 0x78, 0x6e, 0xac, 0x2f, 0xe3, 0x17,
0x29, 0xef, 0x0f, 0xde, 0x36, 0xeb, 0x43, 0xec, 0x00, 0x00, 0x00, 0x29, 0xef, 0x0f, 0xde, 0x36, 0xeb, 0x43, 0xec, 0x00, 0x00, 0x00,
0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
}; };
const int default_right_icon_size = sizeof(default_right_icon);
const char *default_up_icon_filename = "up.png"; const int default_right_icon_len = 526;
/*
* This table was generated by the command:
*
* bin2c -n default_up_icon up.png
*/
const unsigned char default_up_icon[] = { const unsigned char default_up_icon[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00,
0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00,
@ -180,6 +215,44 @@ const unsigned char default_up_icon[] = {
0x1c, 0xea, 0xf1, 0x27, 0xc9, 0x72, 0xe5, 0x83, 0xc5, 0xad, 0x16, 0x1c, 0xea, 0xf1, 0x27, 0xc9, 0x72, 0xe5, 0x83, 0xc5, 0xad, 0x16,
0x43, 0x98, 0x78, 0xd5, 0xc6, 0x2b, 0x14, 0xf3, 0x1c, 0x5c, 0xfd, 0x43, 0x98, 0x78, 0xd5, 0xc6, 0x2b, 0x14, 0xf3, 0x1c, 0x5c, 0xfd,
0x01, 0x56, 0x35, 0x13, 0x9e, 0xbd, 0x4e, 0x62, 0x4e, 0x00, 0x00, 0x01, 0x56, 0x35, 0x13, 0x9e, 0xbd, 0x4e, 0x62, 0x4e, 0x00, 0x00,
0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
}; };
const int default_up_icon_size = sizeof(default_up_icon);
const int default_up_icon_len = 549;
/*
* This table was generated by the command:
*
* bin2c -n default_movie_icon movie.png
*/
const unsigned char default_movie_icon[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00,
0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00,
0x00, 0x16, 0x04, 0x03, 0x00, 0x00, 0x00, 0x32, 0x6f, 0xa1, 0x35,
0x00, 0x00, 0x00, 0x15, 0x50, 0x4c, 0x54, 0x45, 0xcc, 0xff, 0xff,
0xff, 0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x99, 0x99, 0x99, 0x66, 0x66,
0x66, 0x33, 0x33, 0x33, 0x00, 0x00, 0x00, 0x89, 0x10, 0x3a, 0x6d,
0x00, 0x00, 0x00, 0x01, 0x62, 0x4b, 0x47, 0x44, 0x06, 0x61, 0x66,
0xb8, 0x7d, 0x00, 0x00, 0x00, 0x39, 0x49, 0x44, 0x41, 0x54, 0x78,
0xda, 0x63, 0x48, 0x83, 0x82, 0x04, 0x06, 0x86, 0x24, 0x35, 0x30,
0x4b, 0x29, 0x15, 0xc4, 0x74, 0x01, 0x02, 0x31, 0x10, 0x33, 0x2d,
0xcd, 0xd9, 0xd8, 0xd8, 0x58, 0x2c, 0x0d, 0x2c, 0x0a, 0x66, 0x2a,
0xa1, 0x32, 0x89, 0x50, 0x20, 0x08, 0x04, 0x50, 0x05, 0xf4, 0xb5,
0x02, 0xce, 0x64, 0x0d, 0x85, 0x02, 0x06, 0x00, 0x66, 0x25, 0x34,
0xea, 0x21, 0xc4, 0xeb, 0x5e, 0x00, 0x00, 0x00, 0x56, 0x74, 0x45,
0x58, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x54,
0x68, 0x69, 0x73, 0x20, 0x61, 0x72, 0x74, 0x20, 0x69, 0x73, 0x20,
0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x62, 0x6c,
0x69, 0x63, 0x20, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x20,
0x4b, 0x65, 0x76, 0x69, 0x6e, 0x20, 0x48, 0x75, 0x67, 0x68, 0x65,
0x73, 0x2c, 0x20, 0x6b, 0x65, 0x76, 0x69, 0x6e, 0x68, 0x40, 0x65,
0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x20, 0x53, 0x65, 0x70,
0x74, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x31, 0x39, 0x39, 0x35,
0x4c, 0xe8, 0xf4, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
0x44, 0xae, 0x42, 0x60, 0x82
};
const int default_movie_icon_len = 258;

View File

@ -20,16 +20,18 @@
#define DEFAULT_INDEX_ICONS_H #define DEFAULT_INDEX_ICONS_H
extern const char *default_left_icon_filename; extern const char *default_left_icon_filename;
extern const unsigned char default_left_icon[];
extern const int default_left_icon_size;
extern const char *default_right_icon_filename; extern const char *default_right_icon_filename;
extern const unsigned char default_right_icon[];
extern const int default_right_icon_size;
extern const char *default_up_icon_filename; extern const char *default_up_icon_filename;
extern const char *default_movie_icon_filename;
extern const unsigned char default_left_icon[];
extern const int default_left_icon_len;
extern const unsigned char default_right_icon[];
extern const int default_right_icon_len;
extern const unsigned char default_up_icon[]; extern const unsigned char default_up_icon[];
extern const int default_up_icon_size; extern const int default_up_icon_len;
extern const unsigned char default_movie_icon[];
extern const int default_movie_icon_len;
#endif #endif

View File

@ -307,9 +307,19 @@ generate_images(const Filename &archive_dir, PNMTextMaker *text_maker) {
pinfo._y_place + y_center); pinfo._y_place + y_center);
if (text_maker != (PNMTextMaker *)NULL) { if (text_maker != (PNMTextMaker *)NULL) {
int label_x = pinfo._x_place + thumb_width / 2;
int label_y = pinfo._y_place + thumb_height + thumb_caption_height;
int width =
text_maker->generate_into(photo->get_frame_number(), index_image, text_maker->generate_into(photo->get_frame_number(), index_image,
pinfo._x_place + thumb_width / 2, label_x, label_y);
pinfo._y_place + thumb_height + thumb_caption_height); if (photo->_has_movie && get_movie_icon().is_valid()) {
const PNMImage &movie_icon_image = get_movie_icon();
int icon_x = label_x - width / 2 - movie_icon_image.get_x_size();
int icon_y = label_y - movie_icon_image.get_y_size();
index_image.blend_sub_image(movie_icon_image, icon_x, icon_y);
}
} }
} }
} }
@ -430,6 +440,7 @@ generate_reduced_html(ostream &html, Photo *photo, int photo_index, int pi,
compose_href("../..", roll_dir_root, _dir->get_basename()); compose_href("../..", roll_dir_root, _dir->get_basename());
} }
Filename full(full_dir, photo->get_basename()); Filename full(full_dir, photo->get_basename());
Filename movie(full_dir, photo->get_movie());
Filename reduced_dir("../../reduced", _dir->get_basename()); Filename reduced_dir("../../reduced", _dir->get_basename());
Filename reduced(reduced_dir, photo->get_basename()); Filename reduced(reduced_dir, photo->get_basename());
@ -536,7 +547,18 @@ generate_reduced_html(ostream &html, Photo *photo, int photo_index, int pi,
if (!omit_full_links && photo->_has_reduced) { if (!omit_full_links && photo->_has_reduced) {
html html
<< "<p><a href=\"" << full << "\">View full size image (" << "<p><a href=\"" << full << "\">View full size image ("
<< photo->_full_x_size << " x " << photo->_full_y_size << ")</a></p>"; << photo->_full_x_size << " x " << photo->_full_y_size << ")</a></p>\n";
}
if (photo->_has_movie) {
html << "<p>";
if (!movie_icon.empty()) {
// Show the movie icon if we got one.
Filename movie_icon_href = compose_href("../..", movie_icon);
html << "<img src=\"" << movie_icon_href << "\" alt=\"\">";
}
html
<< "<a href=\"" << movie << "\">Play movie</a></p>\n";
} }
generate_nav_buttons(html, prev_photo_filename, next_photo_filename, generate_nav_buttons(html, prev_photo_filename, next_photo_filename,

View File

@ -38,9 +38,35 @@ int frame_inner_bevel = 1;
int reduced_width = 800; int reduced_width = 800;
int reduced_height = 700; int reduced_height = 700;
Filename archive_dir;
Filename prev_icon; Filename prev_icon;
Filename next_icon; Filename next_icon;
Filename up_icon; Filename up_icon;
Filename movie_icon;
////////////////////////////////////////////////////////////////////
// Function: get_movie_icon
// Description: Reads the movie icon filename and returns it as an
// image, if possible. Returns a valid image if
// successful, an invalid one otherwise.
////////////////////////////////////////////////////////////////////
const PNMImage &
get_movie_icon() {
static PNMImage movie_icon_image;
static bool got_image = false;
if (!got_image) {
if (!movie_icon.empty()) {
Filename icon_filename(archive_dir, movie_icon);
nout << "Reading " << icon_filename << "\n";
movie_icon_image.read(icon_filename);
}
got_image = true;
}
return movie_icon_image;
}
bool force_regenerate = false; bool force_regenerate = false;
bool format_rose = false; bool format_rose = false;

View File

@ -70,11 +70,18 @@ extern int frame_inner_bevel;
extern int reduced_width; extern int reduced_width;
extern int reduced_height; extern int reduced_height;
// The directory at the root of the output hierarchy (or as specified
// by -a on the command line).
extern Filename archive_dir;
// The filenames (or URLS) to the icon images for navigating the // The filenames (or URLS) to the icon images for navigating the
// individual image pages. // individual image pages.
extern Filename prev_icon; extern Filename prev_icon;
extern Filename next_icon; extern Filename next_icon;
extern Filename up_icon; extern Filename up_icon;
extern Filename movie_icon;
const PNMImage &get_movie_icon();
// True to regenerate every image, whether it appears to need it or // True to regenerate every image, whether it appears to need it or
// not. // not.

View File

@ -86,7 +86,7 @@ Indexify() {
("a", "archive-dir", 0, ("a", "archive-dir", 0,
"Write the generated files to the indicated directory, instead of " "Write the generated files to the indicated directory, instead of "
"the directory above roll1-dir.", "the directory above roll1-dir.",
&Indexify::dispatch_filename, NULL, &_archive_dir); &Indexify::dispatch_filename, NULL, &archive_dir);
add_option add_option
("r", "relative-dir", 0, ("r", "relative-dir", 0,
@ -135,12 +135,21 @@ Indexify() {
"photo files within the roll directories. This is normally jpg.", "photo files within the roll directories. This is normally jpg.",
&Indexify::dispatch_string, NULL, &_photo_extension); &Indexify::dispatch_string, NULL, &_photo_extension);
add_option
("m", "extension", 0,
"Specifies the filename extension (without a leading dot) to identify "
"movie files within the roll directories. This is normally mov. If "
"a file exists with the same name as a given photo but with this "
"extension, it is taken to be a movie associated with the photo, and "
"a link will be generated to play the movie.",
&Indexify::dispatch_string, NULL, &_movie_extension);
add_option add_option
("i", "", 0, ("i", "", 0,
"Indicates that default navigation icon images should be generated " "Indicates that default navigation icon images should be generated "
"into a directory called \"icons\" which will be created within the " "into a directory called \"icons\" which will be created within the "
"directory named by -a. This is meaningful only if -prev, -next, and " "directory named by -a. This is meaningful only if -iprev, -inext, "
"-up are not explicitly specified.", "-iup, and -imovie are not explicitly specified.",
&Indexify::dispatch_none, &_generate_icons); &Indexify::dispatch_none, &_generate_icons);
add_option add_option
@ -214,24 +223,32 @@ Indexify() {
&Indexify::dispatch_int_pair, NULL, &max_index_width); &Indexify::dispatch_int_pair, NULL, &max_index_width);
add_option add_option
("prev", "filename", 0, ("iprev", "filename", 0,
"Specifies the relative pathname from the archive directory (or " "Specifies the relative pathname from the archive directory (or "
"absolute pathname) to the \"previous\" photo icon.", "absolute pathname) to the \"previous\" icon.",
&Indexify::dispatch_filename, NULL, &prev_icon); &Indexify::dispatch_filename, NULL, &prev_icon);
add_option add_option
("next", "filename", 0, ("inext", "filename", 0,
"Specifies the relative pathname from the archive directory (or " "Specifies the relative pathname from the archive directory (or "
"absolute pathname) to the \"next\" photo icon.", "absolute pathname) to the \"next\" icon.",
&Indexify::dispatch_filename, NULL, &next_icon); &Indexify::dispatch_filename, NULL, &next_icon);
add_option add_option
("up", "filename", 0, ("iup", "filename", 0,
"Specifies the relative pathname from the archive directory (or " "Specifies the relative pathname from the archive directory (or "
"absolute pathname) to the \"up\" photo icon.", "absolute pathname) to the \"up\" icon.",
&Indexify::dispatch_filename, NULL, &up_icon); &Indexify::dispatch_filename, NULL, &up_icon);
add_option
("imovie", "filename", 0,
"Specifies the relative pathname from the archive directory (or "
"absolute pathname) to the \"movie\" icon. This is used only if "
"there are one or more movie files found in the directory.",
&Indexify::dispatch_filename, NULL, &movie_icon);
_photo_extension = "jpg"; _photo_extension = "jpg";
_movie_extension = "mov";
_text_maker = (PNMTextMaker *)NULL; _text_maker = (PNMTextMaker *)NULL;
_font_aa_factor = 4.0; _font_aa_factor = 4.0;
} }
@ -320,20 +337,20 @@ post_command_line() {
return false; return false;
} }
if (_archive_dir.empty()) { if (archive_dir.empty()) {
// Choose a default archive directory, above the first roll directory. // Choose a default archive directory, above the first roll directory.
_archive_dir = _roll_dirs.front()->get_dir().get_dirname(); archive_dir = _roll_dirs.front()->get_dir().get_dirname();
string parent_dirname = _archive_dir.get_basename(); string parent_dirname = archive_dir.get_basename();
if (parent_dirname == "full" || parent_dirname == "reduced") { if (parent_dirname == "full" || parent_dirname == "reduced") {
// As a special case, if the subdirectory name is "full" or // As a special case, if the subdirectory name is "full" or
// "reduced", use the directory above that. // "reduced", use the directory above that.
_archive_dir = _archive_dir.get_dirname(); archive_dir = archive_dir.get_dirname();
} }
if (_archive_dir.empty()) { if (archive_dir.empty()) {
_archive_dir = "."; archive_dir = ".";
} }
} }
_archive_dir.standardize(); archive_dir.standardize();
if (!_roll_dir_root.empty()) { if (!_roll_dir_root.empty()) {
_roll_dir_root.standardize(); _roll_dir_root.standardize();
@ -395,7 +412,7 @@ post_command_line() {
if (_generate_icons) { if (_generate_icons) {
if (prev_icon.empty()) { if (prev_icon.empty()) {
prev_icon = Filename("icons", default_left_icon_filename); prev_icon = Filename("icons", default_left_icon_filename);
Filename icon_filename(_archive_dir, prev_icon); Filename icon_filename(archive_dir, prev_icon);
if (force_regenerate || !icon_filename.exists()) { if (force_regenerate || !icon_filename.exists()) {
nout << "Generating " << icon_filename << "\n"; nout << "Generating " << icon_filename << "\n";
@ -407,12 +424,12 @@ post_command_line() {
nout << "Unable to write to " << icon_filename << "\n"; nout << "Unable to write to " << icon_filename << "\n";
exit(1); exit(1);
} }
output.write((const char *)default_left_icon, default_left_icon_size); output.write((const char *)default_left_icon, default_left_icon_len);
} }
} }
if (next_icon.empty()) { if (next_icon.empty()) {
next_icon = Filename("icons", default_right_icon_filename); next_icon = Filename("icons", default_right_icon_filename);
Filename icon_filename(_archive_dir, next_icon); Filename icon_filename(archive_dir, next_icon);
if (force_regenerate || !icon_filename.exists()) { if (force_regenerate || !icon_filename.exists()) {
nout << "Generating " << icon_filename << "\n"; nout << "Generating " << icon_filename << "\n";
icon_filename.make_dir(); icon_filename.make_dir();
@ -423,12 +440,12 @@ post_command_line() {
nout << "Unable to write to " << icon_filename << "\n"; nout << "Unable to write to " << icon_filename << "\n";
exit(1); exit(1);
} }
output.write((const char *)default_right_icon, default_right_icon_size); output.write((const char *)default_right_icon, default_right_icon_len);
} }
} }
if (up_icon.empty()) { if (up_icon.empty()) {
up_icon = Filename("icons", default_up_icon_filename); up_icon = Filename("icons", default_up_icon_filename);
Filename icon_filename(_archive_dir, up_icon); Filename icon_filename(archive_dir, up_icon);
if (force_regenerate || !icon_filename.exists()) { if (force_regenerate || !icon_filename.exists()) {
nout << "Generating " << icon_filename << "\n"; nout << "Generating " << icon_filename << "\n";
icon_filename.make_dir(); icon_filename.make_dir();
@ -439,7 +456,23 @@ post_command_line() {
nout << "Unable to write to " << icon_filename << "\n"; nout << "Unable to write to " << icon_filename << "\n";
exit(1); exit(1);
} }
output.write((const char *)default_up_icon, default_up_icon_size); output.write((const char *)default_up_icon, default_up_icon_len);
}
}
if (movie_icon.empty()) {
movie_icon = Filename("icons", default_movie_icon_filename);
Filename icon_filename(archive_dir, movie_icon);
if (force_regenerate || !icon_filename.exists()) {
nout << "Generating " << icon_filename << "\n";
icon_filename.make_dir();
icon_filename.set_binary();
ofstream output;
if (!icon_filename.open_write(output)) {
nout << "Unable to write to " << icon_filename << "\n";
exit(1);
}
output.write((const char *)default_movie_icon, default_movie_icon_len);
} }
} }
} }
@ -500,7 +533,7 @@ run() {
RollDirs::iterator di; RollDirs::iterator di;
for (di = _roll_dirs.begin(); di != _roll_dirs.end(); ++di) { for (di = _roll_dirs.begin(); di != _roll_dirs.end(); ++di) {
RollDirectory *roll_dir = (*di); RollDirectory *roll_dir = (*di);
if (!roll_dir->scan(_photo_extension)) { if (!roll_dir->scan(_photo_extension, _movie_extension)) {
nout << "Unable to read " << *roll_dir << "\n"; nout << "Unable to read " << *roll_dir << "\n";
all_ok = false; all_ok = false;
} }
@ -514,7 +547,7 @@ run() {
// First, generate all the images. // First, generate all the images.
for (di = _roll_dirs.begin(); di != _roll_dirs.end(); ++di) { for (di = _roll_dirs.begin(); di != _roll_dirs.end(); ++di) {
RollDirectory *roll_dir = (*di); RollDirectory *roll_dir = (*di);
if (!roll_dir->generate_images(_archive_dir, _text_maker)) { if (!roll_dir->generate_images(archive_dir, _text_maker)) {
nout << "Failure.\n"; nout << "Failure.\n";
exit(1); exit(1);
} }
@ -523,7 +556,7 @@ run() {
// Then go back and generate the HTML. // Then go back and generate the HTML.
for (di = _roll_dirs.begin(); di != _roll_dirs.end(); ++di) { for (di = _roll_dirs.begin(); di != _roll_dirs.end(); ++di) {
RollDirectory *roll_dir = (*di); RollDirectory *roll_dir = (*di);
if (!roll_dir->generate_html(_archive_dir, _roll_dir_root)) { if (!roll_dir->generate_html(archive_dir, _roll_dir_root)) {
nout << "Failure.\n"; nout << "Failure.\n";
exit(1); exit(1);
} }
@ -531,7 +564,7 @@ run() {
// Generate the complete index that browses all the roll directories // Generate the complete index that browses all the roll directories
// at once. // at once.
Filename complete_filename(_archive_dir, "html/complete.htm"); Filename complete_filename(archive_dir, "html/complete.htm");
nout << "Generating " << complete_filename << "\n"; nout << "Generating " << complete_filename << "\n";
complete_filename.set_text(); complete_filename.set_text();
ofstream complete_html; ofstream complete_html;
@ -575,7 +608,7 @@ run() {
// And finally, generate the index HTML file that sits on the top of // And finally, generate the index HTML file that sits on the top of
// all of this. // all of this.
Filename index_filename(_archive_dir, "index.htm"); Filename index_filename(archive_dir, "index.htm");
nout << "Generating " << index_filename << "\n"; nout << "Generating " << index_filename << "\n";
index_filename.set_text(); index_filename.set_text();
ofstream index_html; ofstream index_html;

View File

@ -50,9 +50,9 @@ public:
void run(); void run();
string _front_title; string _front_title;
Filename _archive_dir;
Filename _roll_dir_root; Filename _roll_dir_root;
string _photo_extension; string _photo_extension;
string _movie_extension;
Filename _font_filename; Filename _font_filename;
bool _generate_icons; bool _generate_icons;
double _font_aa_factor; double _font_aa_factor;

BIN
pandaapp/src/indexify/left.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

View File

@ -27,9 +27,10 @@
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
Photo:: Photo::
Photo(RollDirectory *dir, const Filename &basename) : Photo(RollDirectory *dir, const Filename &basename, const Filename &movie) :
_dir(dir), _dir(dir),
_basename(basename) _basename(basename),
_movie(movie)
{ {
_name = _basename.get_basename_wo_extension(); _name = _basename.get_basename_wo_extension();
_frame_number = _name; _frame_number = _name;
@ -51,6 +52,7 @@ Photo(RollDirectory *dir, const Filename &basename) :
_reduced_x_size = 0; _reduced_x_size = 0;
_reduced_y_size = 0; _reduced_y_size = 0;
_has_reduced = false; _has_reduced = false;
_has_movie = !_movie.empty();
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -64,6 +66,17 @@ get_basename() const {
return _basename; return _basename;
} }
////////////////////////////////////////////////////////////////////
// Function: Photo::get_movie
// Access: Public
// Description: Returns the filename of the movie associated with the
// photo, if any.
////////////////////////////////////////////////////////////////////
const Filename &Photo::
get_movie() const {
return _movie;
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: Photo::get_name // Function: Photo::get_name
// Access: Public // Access: Public

View File

@ -31,9 +31,11 @@ class RollDirectory;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class Photo { class Photo {
public: public:
Photo(RollDirectory *dir, const Filename &basename); Photo(RollDirectory *dir, const Filename &basename,
const Filename &movie = Filename());
const Filename &get_basename() const; const Filename &get_basename() const;
const Filename &get_movie() const;
const string &get_name() const; const string &get_name() const;
const string &get_frame_number() const; const string &get_frame_number() const;
@ -45,10 +47,12 @@ public:
int _reduced_x_size; int _reduced_x_size;
int _reduced_y_size; int _reduced_y_size;
bool _has_reduced; bool _has_reduced;
bool _has_movie;
private: private:
RollDirectory *_dir; RollDirectory *_dir;
Filename _basename; Filename _basename;
Filename _movie;
string _name; string _name;
string _frame_number; string _frame_number;
}; };

BIN
pandaapp/src/indexify/right.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

View File

@ -117,7 +117,7 @@ get_desc() const {
// Description: Scans the directory for all the listed photos. // Description: Scans the directory for all the listed photos.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
bool RollDirectory:: bool RollDirectory::
scan(const string &extension) { scan(const string &photo_extension, const string &movie_extension) {
bool reverse_order = false; bool reverse_order = false;
bool explicit_list = false; bool explicit_list = false;
@ -176,16 +176,16 @@ scan(const string &extension) {
any_words = true; any_words = true;
Filename try_filename(_dir, word); Filename try_filename(_dir, word);
if (!try_filename.exists()) { if (!try_filename.exists()) {
try_filename = Filename(_dir, word + "." + extension); try_filename = Filename(_dir, word + "." + photo_extension);
} }
if (!try_filename.exists()) { if (!try_filename.exists()) {
try_filename = Filename(_dir, _basename + word + "." + extension); try_filename = Filename(_dir, _basename + word + "." + photo_extension);
} }
if (!try_filename.exists()) { if (!try_filename.exists()) {
try_filename = Filename(_dir, _basename + "0" + word + "." + extension); try_filename = Filename(_dir, _basename + "0" + word + "." + photo_extension);
} }
if (try_filename.exists()) { if (try_filename.exists()) {
_photos.push_back(new Photo(this, try_filename.get_basename())); add_photo(try_filename.get_basename(), movie_extension);
} else { } else {
nout << "Frame " << word << " not found in " << _name << "\n"; nout << "Frame " << word << " not found in " << _name << "\n";
} }
@ -224,8 +224,8 @@ scan(const string &extension) {
vector_string::iterator ci; vector_string::iterator ci;
for (ci = contents.begin(); ci != contents.end(); ++ci) { for (ci = contents.begin(); ci != contents.end(); ++ci) {
Filename basename = (*ci); Filename basename = (*ci);
if (basename.get_extension() == extension) { if (basename.get_extension() == photo_extension) {
_photos.push_back(new Photo(this, basename)); add_photo(basename, movie_extension);
} }
} }
} }
@ -631,6 +631,25 @@ insert_html_comment(ostream &html, Filename cm_filename) {
return true; return true;
} }
////////////////////////////////////////////////////////////////////
// Function: RollDirectory::add_photo
// Access: Private
// Description: Adds the photo with the indicated basename to the
// list.
////////////////////////////////////////////////////////////////////
void RollDirectory::
add_photo(const Filename &basename, const string &movie_extension) {
Photo *photo = NULL;
Filename movie_filename(_dir, basename);
movie_filename.set_extension(movie_extension);
if (movie_filename.exists()) {
photo = new Photo(this, basename, movie_filename.get_basename());
} else {
photo = new Photo(this, basename);
}
_photos.push_back(photo);
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: RollDirectory::add_contributing_filename // Function: RollDirectory::add_contributing_filename
// Access: Private // Access: Private
@ -810,3 +829,4 @@ compare_filenames(const string &a, const string &b) {
return a.length() < b.length(); return a.length() < b.length();
} }

View File

@ -42,7 +42,7 @@ public:
const string &get_basename() const; const string &get_basename() const;
const string &get_name() const; const string &get_name() const;
const string &get_desc() const; const string &get_desc() const;
bool scan(const string &extension); bool scan(const string &photo_extension, const string &movie_extension);
void collect_index_images(); void collect_index_images();
bool sort_date_before(const RollDirectory &other) const; bool sort_date_before(const RollDirectory &other) const;
@ -68,6 +68,7 @@ public:
static bool insert_html_comment(ostream &html, Filename cm_filename); static bool insert_html_comment(ostream &html, Filename cm_filename);
private: private:
void add_photo(const Filename &basename, const string &movie_extension);
void add_contributing_filename(const Filename &filename); void add_contributing_filename(const Filename &filename);
static bool insert_html_comment_body(ostream &html, istream &cm); static bool insert_html_comment_body(ostream &html, istream &cm);
static string format_basename(const string &basename); static string format_basename(const string &basename);

BIN
pandaapp/src/indexify/up.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B