View Single Post
Old 06-10-2017, 09:03 PM   #2197
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,009
Karma: 4604635
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by bugstomper View Post
...
Or is there already an adapter for locally stored books in some defined format?
I had to stop and think about it for a while, but in point of fact, there is!

FanFicFare has a fake site, test1.com, that I use to generate stories with different attributes without needing to hit anyone's site.

The test1.com adapter has a teststory feature where you can construct whatever metadata you like with storyId >= 1000.

And at one point, for my own purposes, I extended that feature to also have a 'chapter_urls' setting that will pull a page from a URL for each chapter (which can be a file:// URL) and look for a <blockquote> tag inside it. The blockquote will be changed to a div (because reasons), and it and everything inside it will used for the chapter text.

personal.ini section:
Spoiler:
Code:
# make a new section and change 1000 to other 1000+ numbers for other stories.
[teststory:1000]
title:Your Story Name
author_list:Author Name
authorUrl_list:https://author.url
datePublished:2015-07-26
dateUpdated:2015-10-02
category_list:Harry Potter,Superman
genre_list:Action/Adventure,Drama
# leave numWords empty and, depending on other setting, FanFicFare
# will use Calibre's code to count words.
numWords:
description:<p>A HP x Superman story with a description!</p>
 <p>'Make using' line below isn't required, but I find it handy.</p>
 <p>Made using [teststory:{{storyId}}] in personal.ini.</p>
status:Completed

# file URL,chapter name
chapter_urls:
 file:///C:/Users/user/Desktop/storysrc/chap01.html,Chapter 1
 file:///C:/Users/user/Desktop/storysrc/chap02.html,Chapter 2


Example chap01.html (Use UTF8 if encoding needed.):
Spoiler:
Code:
<html>
  <body>
    <blockquote>
<div>
<h3 extra="value">Chapter title from site chapter 1</h3>
br breaks<br><br>
Puella Magi Madoka Magica/魔法少女まどか★マギカ
<p>
  Chapter 2 text...
</p>
br breaks<br><br>
Don't—e;ver—d;o—that—a;gain, 法 &#xE9;
<hr>
horizontal rules
<hr size=1 noshade>
<p>"Lorem ipsum dolor sit amet", consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore--et dolore magna aliqua. 'Ut enim ad minim veniam', quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
    </blockquote>
  </body>
</html>


Then, after setting personal.ini and creating the chapter files, give FanFicFare the story URL: http://test1.com?sid=1000

Warning:

This is an existing undocumented feature. I have no issues with someone who can write their own page scrape scripts using it--something bugstomper specifically mentioned being able to do.

But I'm not going to be interested in expending much energy on either enhancing or supporting it. It's a dev tool for my use.
JimmXinu is offline   Reply With Quote