![]() |
#1 |
calibre2opds guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 533
Karma: 8792
Join Date: Aug 2005
Location: Metz, France
Device: iPhone, iPad, PRS-650
|
Custom column listing the tags and language
Hi,
I'd like to add a custom column which would take the list of tags, and prepend the book language to each tag, resulting in a new list. For example, a book in french with tags "tag1, tag2, tag3" would produce this result "fr_tag1, fr_tag2, fr_tag3". Is it possible ? Thanks, David. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,177
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Should be possible with the various functions in the template language.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
calibre2opds guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 533
Karma: 8792
Join Date: Aug 2005
Location: Metz, France
Device: iPhone, iPad, PRS-650
|
Hi Kovid, thanks for your tip.
I actually tried playing with the template language functions before posting (should have made it obvious) but I miserably failed, being such a bad Python hacker... Could anyone with more Python-fu than me (that is, everybody imho) help me with this please ? |
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,335
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
The template language is closer to lisp (with "prog") than python, but not all that close.
![]() The following does what I think you want Code:
program: lang = test(field('language'), strcat(field('language'), '_'), ''); list_re(field('tags'), ',', '(.*)', strcat(lang, '\1') ) |
![]() |
![]() |
![]() |
#5 |
calibre2opds guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 533
Karma: 8792
Join Date: Aug 2005
Location: Metz, France
Device: iPhone, iPad, PRS-650
|
Thanks a lot chaley, that's exactly what I was looking for !
Congratulations on your LISP-looking-Python-fu ![]() |
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to move tags data into a new custom column | smoothrolla | Library Management | 6 | 05-30-2018 07:19 AM |
On Device column listing incorrect info | ScarletSony | Library Management | 12 | 02-09-2012 01:44 AM |
Download tags to a custom column | atjnjk | Library Management | 8 | 01-18-2012 08:02 AM |
Sony PRS-T1 and plugboards "tags" from custom column | salines | Devices | 8 | 10-31-2011 03:00 AM |
Help with template for custom column from tags | africalass | Library Management | 2 | 07-16-2011 11:47 AM |