Add centeredcat_to_characters, pairingcat_to_characters_ships, romancecat_to_characters_ships features to TtH adapter.

This commit is contained in:
Jim Miller
2015-12-18 15:54:33 -06:00
parent 7986fcbb97
commit 2b623ed429
3 changed files with 65 additions and 2 deletions
+22
View File
@@ -2131,6 +2131,28 @@ collect_series: false
#username:YourName
#password:yourpassword
## TtH uses 'category' Buffy-Centered, Xander-Centered, etc. If
## centeredcat_to_characters:true, they will not be included in the
## category list and Buffy, Xander, etc will instead be included in
## the characters list.
centeredcat_to_characters:true
## TtH uses 'category' Pairing: Dawn, Pairing: Willow, etc, but only
## if there's already been a -Centered category, like Xander-Centered.
## If pairingcat_to_characters_ships:true, Pairing: Whomever will not
## be included in the category list and Dawn, Willow, etc will instead
## be included in the characters list *and* an entry added to the
## ships list for Centered character / Pairing character. IE,
## category: Xander-Centered, Pairing: Dawn becomes characters:
## Xander, Dawn and ships: Xander/Dawn.
pairingcat_to_characters_ships:true
## TtH uses 'category' Romance followed by a pairing 'category', such
## as Romance > Buffy/Spike. If romancecat_to_characters_ships:true,
## Romance will still be added to category, but Buffy/Spike will
## instead be added to characters Buffy, Spike and ships Buffy/Spike
romancecat_to_characters_ships:true
[www.twilightarchives.com]
## Site dedicated to these categories/characters/ships
extracategories:Twilight
+21 -2
View File
@@ -247,9 +247,28 @@ class TwistingTheHellmouthSiteAdapter(BaseSiteAdapter):
BtVS = True
BtVSNonX = False
char=None
romance=False
for cat in verticaltable.findAll('a', href=re.compile(r"^/Category-")):
if cat.string not in ['General', 'Non-BtVS/AtS Stories', 'Non-BTVS/AtS Stories', 'BtVS/AtS Non-Crossover', 'Non-BtVS Crossovers']:
self.story.addToList('category',cat.string)
# assumes only one -Centered and one Pairing: cat can ever
# be applied to one story.
if self.getConfig('centeredcat_to_characters') and cat.string.endswith('-Centered'):
char = cat.string[:-len('-Centered')]
self.story.addToList('characters',char)
elif self.getConfig('pairingcat_to_characters_ships') and cat.string.startswith('Pairing: '):
pair = cat.string[len('Pairing: '):]
self.story.addToList('characters',pair)
self.story.addToList('ships',char+'/'+pair)
elif cat.string not in ['General', 'Non-BtVS/AtS Stories', 'Non-BTVS/AtS Stories', 'BtVS/AtS Non-Crossover', 'Non-BtVS Crossovers']:
# assumed only ship category after Romance cat.
if self.getConfig('romancecat_to_characters_ships') and romance:
self.story.addToList('ships',cat.string)
for c in cat.string.split('/'):
self.story.addToList('characters',c)
else:
self.story.addToList('category',cat.string)
if cat.string == 'Romance':
romance=True
else:
if 'Non-BtVS' in cat.string or 'Non-BTVS' in cat.string:
BtVS = False
+22
View File
@@ -2113,6 +2113,28 @@ collect_series: false
#username:YourName
#password:yourpassword
## TtH uses 'category' Buffy-Centered, Xander-Centered, etc. If
## centeredcat_to_characters:true, they will not be included in the
## category list and Buffy, Xander, etc will instead be included in
## the characters list.
centeredcat_to_characters:true
## TtH uses 'category' Pairing: Dawn, Pairing: Willow, etc, but only
## if there's already been a -Centered category, like Xander-Centered.
## If pairingcat_to_characters_ships:true, Pairing: Whomever will not
## be included in the category list and Dawn, Willow, etc will instead
## be included in the characters list *and* an entry added to the
## ships list for Centered character / Pairing character. IE,
## category: Xander-Centered, Pairing: Dawn becomes characters:
## Xander, Dawn and ships: Xander/Dawn.
pairingcat_to_characters_ships:true
## TtH uses 'category' Romance followed by a pairing 'category', such
## as Romance > Buffy/Spike. If romancecat_to_characters_ships:true,
## Romance will still be added to category, but Buffy/Spike will
## instead be added to characters Buffy, Spike and ships Buffy/Spike
romancecat_to_characters_ships:true
[www.twilightarchives.com]
## Site dedicated to these categories/characters/ships
extracategories:Twilight