added more books to be processed

This commit is contained in:
Jacob Haddon 2024-09-13 20:16:55 -04:00
parent 40683f61c1
commit 038bb5e641

View File

@ -32,7 +32,7 @@ use DateTime;
# While these have json formatting, they are JS files # While these have json formatting, they are JS files
my $complete_books_js = "complete_books.js"; my $complete_books_js = "complete_books.js";
my $book_pages_js = "book_pages2.js"; my $book_pages_js = "book_pages.js";
# number of lines in a page # number of lines in a page
my $number_of_lines = 31; my $number_of_lines = 31;
@ -68,6 +68,34 @@ my @books = (
url => "https://www.gutenberg.org/ebooks/121", url => "https://www.gutenberg.org/ebooks/121",
file => "books/northangerabbey.txt", file => "books/northangerabbey.txt",
chapter_marker => "CHAPTER" chapter_marker => "CHAPTER"
},
{
title => "The Picture of Dorian Gray",
author => "Oscar Wilde",
url => "https://www.gutenberg.org/ebooks/174",
file => "books/doriangray.txt",
chapter_marker => "CHAPTER"
},
{
title => "The Mysteries of Udolpho",
author => "Ann Ward Radcliffe",
url => "https://www.gutenberg.org/ebooks/3268",
file => "books/udolpho.txt",
chapter_marker => "CHAPTER"
},
{
title => "The Enchanted Castle",
author => "E. Nesbit",
url => "https://www.gutenberg.org/ebooks/34219",
file => "books/enchantedcastle.txt",
chapter_marker => "CHAPTER"
},
{
title => "Frankenstein",
author => "Mary Wollstonecraft Shelley",
url => "https://www.gutenberg.org/ebooks/84",
file => "books/frankenstein.txt",
chapter_marker => "Chapter"
} }
); # books hash ); # books hash
@ -77,6 +105,7 @@ my $json = new JSON;
# Make the books into pages # Make the books into pages
################################### ###################################
# iterate over books
my $k = 0; my $k = 0;
foreach (@books) { foreach (@books) {
@ -89,8 +118,10 @@ foreach (@books) {
# go through each chapter and make pages based on number of desired lines # go through each chapter and make pages based on number of desired lines
#iterate over chapters
my $j = 0; my $j = 0;
my @page_text; my @page_text;
foreach (@chapters) { foreach (@chapters) {
my @chapter_lines = split(/\r\n/, $chapters[$j]); my @chapter_lines = split(/\r\n/, $chapters[$j]);