Refactor MassEffect2.in adapter and improve it.

Refactoring:
    * New `Chapter' class extracted to separate HTML parsing from
      adapter output preparation and story-wide metadata collection.
    * Lazy-parsing and fragments caching is done at Chapter level.

Improvements:
    * Rating "adultness" and label-to-title mapping made configurable.
    * Fix chapter number detection when title contains large numbers
      (ex.: http://www.masseffect2.in/publ/19-1-0-2934).
    * Add mechanism for detecting series-like stories with no chapter
      numbering and extracting correct titles.
    * Fix number format for generated chapter titles.
This commit is contained in:
Dmitry Kozliuk
2015-07-23 02:44:03 +03:00
parent 6a13323c92
commit 79b56c872f
4 changed files with 577 additions and 398 deletions
+5 -2
View File
@@ -1230,8 +1230,11 @@ extracategories: Mass Effect
## May be adjusted in `personal.ini' on per-story basis.
never_make_cover: true
my_custom_label: Some text
my_custom_setting: true
## Titles for ratings identified by 1- or 2-letter codes from `ERATING system'
## (`система Р.Е.Й.Т.И.Н.Г.'). MassEffect2.in and some other sites adopted it,
## but changed titles and update them occasionally.
rating_titles: R=RESTRICTED (16+), E=EXEMPT (18+), I=ART HOUSE, T=To every, A=IN=Иной мир, Nn=Новый мир, G=О\, Господи!
adult_ratings: E,R
[merlinfic.dtwins.co.uk]
## Some sites require login (or login for some rated stories) The
File diff suppressed because it is too large Load Diff
+2
View File
@@ -205,6 +205,7 @@ def get_valid_keywords():
return list(['(in|ex)clude_metadata_(pre|post)',
'add_chapter_numbers',
'add_genre_when_multi_category',
'adult_ratings',
'allow_unsafe_filename',
'always_overwrite',
'anthology_tags',
@@ -285,6 +286,7 @@ def get_valid_keywords():
'output_filename_safepattern',
'password',
'post_process_cmd',
'rating_titles',
'remove_transparency',
'replace_br_with_p',
'replace_hr',
+6 -3
View File
@@ -1825,14 +1825,17 @@ extracategories:Lord of the Rings
[www.masseffect2.in]
## Site dedicated to this fandom.
extracategories:Mass Effect
extracategories: Mass Effect
## Stories on the site almost never have cover image.
## May be adjusted in `personal.ini' on per-story basis.
never_make_cover: true
my_custom_label:Some text
my_custom_setting:true
## Titles for ratings identified by 1- or 2-letter codes from `ERATING system'
## (`система Р.Е.Й.Т.И.Н.Г.'). MassEffect2.in and some other sites adopted it,
## but changed titles and update them occasionally.
rating_titles: R=RESTRICTED (16+), E=EXEMPT (18+), I=ART HOUSE, T=To every, A=IN=Иной мир, Nn=Новый мир, G=О\, Господи!
adult_ratings: E,R
[www.mediaminer.org]