Fixes #1968897 [Edit Metadata: Google identifiers paste as url:](https://bugs.launchpad.net/calibre/+bug/1968897)
This commit is contained in:
Kovid Goyal 2022-04-15 08:24:37 +05:30
parent 2b40d1dbfb
commit 205db05475
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 31 additions and 27 deletions

View File

@ -3223,14 +3223,15 @@ class KOBOTOUCH(KOBO):
debug_print("KoboTouch:generate_update_from_template template error - template='%s'" % template)
debug_print("KoboTouch:generate_update_from_template - new_value=", new_value)
debug_print(f"KoboTouch:generate_update_from_template - {book.title} - column_name='{column_name}', current_value='{current_value}', new_value='{new_value}'")
if (new_value is not None and \
debug_print(
f"KoboTouch:generate_update_from_template - {book.title} - column_name='{column_name}',"
f" current_value='{current_value}', new_value='{new_value}'")
if (new_value is not None and
(current_value is None or new_value != current_value)) or \
(new_value is None and current_value is not None):
update_values.append(new_value)
set_clause.append(column_name)
plugboard = None
if self.plugboard_func and not series_only:
if book.contentID.endswith('.kepub.epub') or not os.path.splitext(book.contentID)[1]:
@ -3427,7 +3428,6 @@ class KOBOTOUCH(KOBO):
if show_debug:
debug_print("KoboTouch:set_core_metadata - end")
@classmethod
def config_widget(cls):
# TODO: Cleanup the following

View File

@ -693,15 +693,19 @@ class MetadataGroupBox(DeviceOptionsGroupBox):
@property
def update_bookstats(self):
return self.update_bookstats_checkbox.isChecked()
@property
def bookstats_pagecount_template(self):
return self.bookstats_pagecount_template_edit.template
@property
def bookstats_wordcount_template(self):
return self.bookstats_wordcount_template_edit.template
@property
def bookstats_timetoread_lower_template(self):
return self.bookstats_timetoread_lower_template_edit.template
@property
def bookstats_timetoread_upper_template(self):
return self.bookstats_timetoread_upper_template_edit.template
@ -709,6 +713,7 @@ class MetadataGroupBox(DeviceOptionsGroupBox):
from calibre.gui2.dialogs.template_line_editor import TemplateLineEditor
class TemplateConfig(QWidget): # {{{
def __init__(self, val, label=None, tooltip=None):

View File

@ -201,7 +201,7 @@ class GoogleBooks(Source):
# }}}
def id_from_url(self, url): # {{{
url_pattern = '(?:http|https)://books\.google\.com/books\?id=(?P<id_>.+)'
url_pattern = r'(?:http|https)://books\.google\.com/books\?id=(?P<id_>.+)'
url_pattern = re.compile(url_pattern)
id_ = url_pattern.search(url).group('id_')
if id_:

View File

@ -4,7 +4,6 @@
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
from collections import defaultdict
from functools import partial
from qt.core import (QTimer, QApplication, Qt, QEvent, QDialog, QMenu, QIcon,