calibre 'series' metadata fixes (#3349)

Decode XML entities in series metadata and display decimal in series number
if any.
This commit is contained in:
poire-z
2017-10-13 00:31:40 +02:00
committed by Frans de Jonge
parent 7461e396dd
commit efd0d4f0de
4 changed files with 12 additions and 2 deletions

2
base

Submodule base updated: 5a83793b8b...709ca9e1e0

View File

@@ -121,7 +121,11 @@ function BookInfo:show(file, book_props)
table.insert(kv_pairs, { _("Authors:"), authors })
local series = book_props.series
if series == "" or series == nil then series = _("N/A") end
if series == "" or series == nil then
series = _("N/A")
else -- Shorten calibre series decimal number (#4.0 => #4)
series = series:gsub("(#%d+)%.0$", "%1")
end
table.insert(kv_pairs, { _("Series:"), series })
local pages = book_props.pages

View File

@@ -392,6 +392,8 @@ function ListMenuItem:update()
-- add Series metadata if requested
if bookinfo.series then
if BookInfoManager:getSetting("append_series_to_title") then
-- Shorten calibre series decimal number (#4.0 => #4)
bookinfo.series = bookinfo.series:gsub("(#%d+)%.0$", "%1")
if title then
title = title .. " - " .. bookinfo.series
else
@@ -399,6 +401,7 @@ function ListMenuItem:update()
end
end
if BookInfoManager:getSetting("append_series_to_authors") then
bookinfo.series = bookinfo.series:gsub("(#%d+)%.0$", "%1")
if authors then
authors = authors .. " - " .. bookinfo.series
else

View File

@@ -481,6 +481,8 @@ function MosaicMenuItem:update()
-- add Series metadata if requested
if bookinfo.series then
if BookInfoManager:getSetting("append_series_to_title") then
-- Shorten calibre series decimal number (#4.0 => #4)
bookinfo.series = bookinfo.series:gsub("(#%d+)%.0$", "%1")
if bookinfo.title then
bookinfo.title = bookinfo.title .. " - " .. bookinfo.series
else
@@ -488,6 +490,7 @@ function MosaicMenuItem:update()
end
end
if BookInfoManager:getSetting("append_series_to_authors") then
bookinfo.series = bookinfo.series:gsub("(#%d+)%.0$", "%1")
if bookinfo.authors then
bookinfo.authors = bookinfo.authors .. " - " .. bookinfo.series
else