mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-24 09:44:28 +01:00
Add r_anthmax/n_anthmax options for custom_columns_settings
This commit is contained in:
parent
6695f23079
commit
3b703da1f3
2 changed files with 15 additions and 7 deletions
|
|
@ -2337,9 +2337,11 @@ class FanFicFarePlugin(InterfaceAction):
|
|||
(meta,custcol) = [ x.strip() for x in line.split("=>") ]
|
||||
flag='r'
|
||||
anthaver=False
|
||||
anthmax=False
|
||||
if "," in custcol:
|
||||
(custcol,flag) = [ x.strip() for x in custcol.split(",") ]
|
||||
anthaver = 'anthaver' in flag
|
||||
anthmax = 'anthmax' in flag
|
||||
flag=flag[0] # first char only.
|
||||
|
||||
if meta not in book['all_metadata']:
|
||||
|
|
@ -2369,13 +2371,14 @@ class FanFicFarePlugin(InterfaceAction):
|
|||
if 'anthology_meta_list' in book and meta in book['anthology_meta_list']:
|
||||
# re-split list, strip commas, convert to floats
|
||||
items = [ float(x.replace(",","")) for x in val.split(", ") ]
|
||||
if anthaver:
|
||||
if items:
|
||||
val = 0
|
||||
if items:
|
||||
if anthaver:
|
||||
val = sum(items) / float(len(items))
|
||||
elif anthmax:
|
||||
val = max(items)
|
||||
else:
|
||||
val = 0
|
||||
else:
|
||||
val = sum(items)
|
||||
val = sum(items)
|
||||
else:
|
||||
val = unicode(val).replace(",","")
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -347,8 +347,13 @@ conditionals_use_lists:true
|
|||
## 'r' and 'n' for normal downloads, but to average the metadata for
|
||||
## the differents story in an anthology before setting in integer and
|
||||
## float type custom columns. This can be useful for a averrating
|
||||
## column, for example. Default is to sum the values of all stories,
|
||||
## and numChapters and numWords are always summed.
|
||||
## column, for example.
|
||||
## 'r_anthmax' and 'n_anthmax' indicate 'r' and 'n' for normal
|
||||
## downloads, but to use the highest value for the metadata from the
|
||||
## differents story in an anthology in integer and float type custom
|
||||
## columns.
|
||||
## Default is to sum the values of all stories, and numChapters and
|
||||
## numWords are always summed.
|
||||
|
||||
#custom_columns_settings:
|
||||
# cliches=>#acolumn
|
||||
|
|
|
|||
Loading…
Reference in a new issue