View Single Post
Old 02-11-2012, 03:05 PM   #94
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: 6,329
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
FanFictionDownLoader Version 1.4.0

Testing on this version has been finished.

I'm again looking for some people to beta test the attached newest version before I put it out for everyone.

This version contains:
  • New feature - Allow user to set custom CSS in personal.ini for HTML and EPUB output.
  • New feature - Allow user to set custom regular expressions in personal.ini to modify metadata.
  • New feature - Use Accept-Encoding=gzip to speed download. (Not sites will use it--it's common for sites to block gzip based on User-Agent.)
  • Add progress bars while collecting URLs from stories for list and for updates.

Here's an example of what the default output_css parameter for epub looks like:
Spoiler:
Code:
## output background color--only used by html and epub (and ignored in
## epub by many readers).  Included below in output_css--will be
## ignored if not in output_css.
background_color: ffffff

## Allow customization of CSS.  Make sure to keep at least one space
## at the start of each line and to escape % to %%.  Also need
## background_color to be in the same section, if included in CSS.
output_css: 
 body { background-color: #%(background_color)s;
        text-align: justify;
        margin: 2%%; }
 pre { font-size: x-small; }
 sml { font-size: small; }
 h1 { text-align: center; }
 h2 { text-align: center; }
 h3 { text-align: center; }
 h4 { text-align: center; }
 h5 { text-align: center; }
 h6 { text-align: center; }
 .CI {
     text-align:center;
     margin-top:0px;
     margin-bottom:0px;
     padding:0px;
     }
 .center   {text-align: center;}
 .cover    {text-align: center;}
 .full     {width: 100%%; }
 .quarter  {width: 25%%; }
 .smcap    {font-variant: small-caps;}
 .u        {text-decoration: underline;}
 .bold     {font-weight: bold;}

Here's an example of what some replace_metadata lines might look like.
Spoiler:
Code:
## Use regular expressions to find and replace (or remove) metadata.
## For example, you could change Sci-Fi=>SF, remove *-Centered tags,
## etc.  See http://docs.python.org/library/re.html (look for re.sub)
## for regexp details.
## Make sure to keep at least one space at the start of each line and
## to escape % to %%, if used.
replace_metadata:
 (.*)-Centered=>
 Magical Girl Lyrical Nanoha=>Nanoha
 Puella Magi Madoka Magica.*=>Madoka
 (Friend)(ship)=>\2\1
 (.*)Great(.*)=>\1Moderate\2
 (?s)(.*)suck(.*)=>\1kcus\2
  • "(.*)-Centered=>" removes all Name-Centered tags entirely (TTH).
  • "Puella Magi Madoka Magica.* =>Madoka" changes ffnet's "Puella Magi Madoka Magica/魔法少女まどか★マギカ" to just Madoka.
  • "(Friend)(ship)=> \2\1" changes Friendship to shipFriend. Not useful, but demonstrates regular expression group substitution.
  • "(.*)Great(.*)=>\1Moderate\2" shows changing one word in the middle of a tag, such as a series name.
  • "(?s)(.*)suck(.*)=>\1kcus\2" (?s) tells the regexp engine to allow . to make newlines, too. Needed to affect many descriptions/summaries.
The replacement pattern must match the entire string for a piece of metadata to be changed. "Friend" will not match category "Friendship", but "F.*" will. Replacements are applied to all metadata, so be careful to be specific.

You can have different lists of replacements for different sites. One use could be to normalize the rating tags different sites use to all be the same.

Last edited by JimmXinu; 02-12-2012 at 04:32 PM. Reason: Remove obsolete beta versions
JimmXinu is online now