I had the problem of multiple values for "tags" in XPath, and the preview showed additional lines without title, but with author(s) and one tag per line.
After some time of experiments (yeah, no XPath 2.0, no string-join) I looked in the code (I have/had no experience with Python
) and modified it:
Quote:
Code:
*** page_common.py_original 2012-09-04 15:46:32.000000000 +0200
--- page_common.py 2013-09-10 18:27:43.225779000 +0200
***************
*** 16,21 ****
--- 16,23 ----
AUTHOR_SEPARATOR = ' & '
+ FIELDVALUES_SEPARATOR = ', '
+
def parse_series(val):
if val:
pat = re.compile(r'\[([.0-9]+)\]')
|
and
Quote:
Code:
*** tab_webpage.py_original 2012-10-25 21:11:04.000000000 +0200
--- tab_webpage.py 2013-09-10 18:27:30.225779000 +0200
***************
*** 31,36 ****
--- 31,37 ----
from calibre_plugins.import_list.common_utils import (get_icon,
ListComboBox, SizePersistedDialog)
from calibre_plugins.import_list.page_common import AUTHOR_SEPARATOR
+ from calibre_plugins.import_list.page_common import FIELDVALUES_SEPARATOR
from calibre_plugins.import_list.soup import BeautifulSoup
from calibre_plugins.import_list.tab_common import (DragDropComboBox, get_templated_url,
tidy_title, tidy_author, tidy_pubdate, tidy_field,
***************
*** 794,799 ****
--- 795,802 ----
# If multiple values for a field, append them into a single value for this row.
if len(field_values) > 1 and field_name == 'authors':
row_name_values[field_name] = [AUTHOR_SEPARATOR.join(field_values)]
+ elif len(field_values) > 1 and field_name != 'authors':
+ row_name_values[field_name] = [FIELDVALUES_SEPARATOR.join(field_values)]
else:
row_name_values[field_name] = field_values
append_matches(row_name_values)
|
(diffs are attached in zip)
With this changes I was able to correctly import multiple values for tags (and all other fields I wanted to do so) with XPath.
I tested also the update of existing entries - this was ok (means: no duplicate values, missing values were added).
Perhaps this can be (configurable? checkbox?) implemented to this great plugin, if it is useful.
(I really like the possibility to fill my custom columns with data )