mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2026-05-06 03:20:24 +02:00
Add calibre_series_meta optional feature to include series metadata like calibre in epubs.
This commit is contained in:
parent
fec9241932
commit
178c207c19
4 changed files with 40 additions and 1 deletions
|
|
@ -778,6 +778,13 @@ nook_img_fix:true
|
|||
## with this.
|
||||
#internalize_text_links:false
|
||||
|
||||
## Some ebook readers (Moon+ Reader was reported) read <meta
|
||||
## name="calibre:series"...> and <meta name="calibre:series_index"...>
|
||||
## for series info. This is not epub standard, but not an
|
||||
## unreasonable thing for FanFicFare to emulate. This is primarily
|
||||
## useful for CLI and web service--the calibre plugin doesn't need it.
|
||||
#calibre_series_meta:false
|
||||
|
||||
[mobi]
|
||||
## mobi TOC cannot be turned off right now.
|
||||
#include_tocpage: true
|
||||
|
|
|
|||
|
|
@ -224,6 +224,8 @@ def get_valid_set_options():
|
|||
'include_logpage':(None,['epub'],boollist+['smart']),
|
||||
'logpage_at_end':(None,['epub'],boollist),
|
||||
|
||||
'calibre_series_meta':(None,['epub'],boollist),
|
||||
|
||||
'windows_eol':(None,['txt'],boollist),
|
||||
|
||||
'include_images':(None,['epub','html'],boollist),
|
||||
|
|
@ -346,6 +348,7 @@ def get_valid_keywords():
|
|||
'include_images',
|
||||
'include_logpage',
|
||||
'logpage_at_end',
|
||||
'calibre_series_meta',
|
||||
'include_subject_tags',
|
||||
'include_titlepage',
|
||||
'include_tocpage',
|
||||
|
|
|
|||
|
|
@ -827,6 +827,13 @@ nook_img_fix:true
|
|||
## with this.
|
||||
#internalize_text_links:false
|
||||
|
||||
## Some ebook readers (Moon+ Reader was reported) read <meta
|
||||
## name="calibre:series"...> and <meta name="calibre:series_index"...>
|
||||
## for series info. This is not epub standard, but not an
|
||||
## unreasonable thing for FanFicFare to emulate. This is primarily
|
||||
## useful for CLI and web service--the calibre plugin doesn't need it.
|
||||
#calibre_series_meta:false
|
||||
|
||||
[mobi]
|
||||
## mobi TOC cannot be turned off right now.
|
||||
#include_tocpage: true
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2011 Fanficdownloader team, 2016 FanFicFare team
|
||||
# Copyright 2011 Fanficdownloader team, 2017 FanFicFare team
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
|
@ -399,6 +399,28 @@ div { margin: 0pt; padding: 0pt; }
|
|||
attrs={"name":"calibre:timestamp",
|
||||
"content":self.story.getMetadataRaw('dateUpdated').strftime("%Y-%m-%dT%H:%M:%S")}))
|
||||
|
||||
series = self.story.getMetadataRaw('series')
|
||||
if series and self.getConfig('calibre_series_meta'):
|
||||
series_index = "0.0"
|
||||
if '[' in series:
|
||||
logger.debug(series)
|
||||
## assumed "series [series_index]"
|
||||
series_index = series[series.index(' [')+2:-1]
|
||||
series = series[:series.index(' [')]
|
||||
|
||||
## calibre always outputs a series_index and it's
|
||||
## always a float with 1 or 2 decimals. FFF usually
|
||||
## has either an integer or no index. (injected
|
||||
## calibre series is the only float at this time)
|
||||
series_index = "%.2f" % float(series_index)
|
||||
|
||||
metadata.appendChild(newTag(contentdom,"meta",
|
||||
attrs={"name":"calibre:series",
|
||||
"content":series}))
|
||||
metadata.appendChild(newTag(contentdom,"meta",
|
||||
attrs={"name":"calibre:series_index",
|
||||
"content":series_index}))
|
||||
|
||||
if self.getMetadata('description'):
|
||||
metadata.appendChild(newTag(contentdom,"dc:description",text=
|
||||
self.getMetadata('description')))
|
||||
|
|
|
|||
Loading…
Reference in a new issue