sort_ships option. Ship b/a is changed to a/b, etc.

This commit is contained in:
Jim Miller 2013-07-15 14:17:52 -05:00
parent b3c30f6a21
commit 54ae77082a
2 changed files with 12 additions and 3 deletions

View file

@ -213,13 +213,13 @@ Some more longer description. "I suck at summaries!" "Better than it sounds!"
self.story.addToList('warnings','Violence')
if idstr == '80':
self.story.addToList('category',u'Rizzoli & Isles')
self.story.addToList('category',u'Rizzoli & Isles')
self.story.addToList('characters','J. Rizzoli')
elif idstr == '81':
self.story.addToList('category',u'Pitch Perfect')
self.story.addToList('characters','Chloe B.')
elif idstr == '83':
self.story.addToList('category',u'Rizzoli & Isles')
self.story.addToList('category',u'Rizzoli & Isles')
self.story.addToList('characters','J. Rizzoli')
self.story.addToList('category',u'Pitch Perfect')
self.story.addToList('characters','Chloe B.')
@ -237,6 +237,9 @@ Some more longer description. "I suck at summaries!" "Better than it sounds!"
self.story.addToList('characters','Bob Smith')
self.story.addToList('characters','George Johnson')
self.story.addToList('characters','Fred Smythe')
self.story.addToList('ships','Harry Potter/Ginny Weasley')
self.story.addToList('ships','Harry Potter/Ginny Weasley/Albus Dumbledore')
self.story.addToList('ships','Harry Potter & Hermione Granger')
self.story.addToList('genre','Fantasy')
self.story.addToList('genre','Comedy')

View file

@ -448,8 +448,14 @@ class Story(Configurable):
retlist = filter( lambda x : x!=None and x!='' ,
map(removeAllEntities,retlist) )
# reorder ships so b/a and c/b/a become a/b and a/b/c. Only on '/',
# use replace_metadata to change separator first if needed.
# ships=>[ ]*(/|&|&)[ ]*=>/
if listname == 'ships' and self.getConfig('sort_ships'):
retlist = [ '/'.join(sorted(x.split('/'))) for x in retlist ]
if retlist:
if listname in ('author','authorUrl') or self.getConfig('keep_in_order_'+listname):
if listname in ('author','authorUrl','authorId') or self.getConfig('keep_in_order_'+listname):
# need to retain order for author & authorUrl so the
# two match up.
return retlist