mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-06 00:43:00 +01:00
adapter_literotica: Fix for one-shot aver_rating #1285
This commit is contained in:
parent
46293f2d02
commit
af6695e27f
1 changed files with 7 additions and 5 deletions
|
|
@ -276,6 +276,12 @@ class LiteroticaSiteAdapter(BaseSiteAdapter):
|
|||
self.story.setMetadata('datePublished', dateval)
|
||||
self.story.setMetadata('dateUpdated', dateval)
|
||||
|
||||
## one-shots don't have same json data to get aver_rating
|
||||
## from below. This kludge matches the data_approve
|
||||
rateall = re.search(r'rate_all:([\d\.]+)',data)
|
||||
if rateall:
|
||||
self.story.setMetadata('averrating', '%4.2f' % float(rateall.group(1)))
|
||||
|
||||
## one-shots assumed completed.
|
||||
self.story.setMetadata('status','Completed')
|
||||
|
||||
|
|
@ -345,11 +351,7 @@ class LiteroticaSiteAdapter(BaseSiteAdapter):
|
|||
json_state = json.loads(state)
|
||||
# logger.debug(json.dumps(json_state, sort_keys=True,indent=2, separators=(',', ':')))
|
||||
all_rates = []
|
||||
## one-shot
|
||||
if 'story' in json_state:
|
||||
all_rates = [ float(json_state['story']['data']['rate_all']) ]
|
||||
## series
|
||||
elif 'series' in json_state:
|
||||
if 'series' in json_state:
|
||||
all_rates = [ float(x['rate_all']) for x in json_state['series']['works'] ]
|
||||
|
||||
## Extract dates from chapter approval dates if dates_from_chapters is enabled
|
||||
|
|
|
|||
Loading…
Reference in a new issue