Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 10-16-2012, 06:13 AM   #1
dpierron
calibre2opds guru
dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.
 
dpierron's Avatar
 
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.
dpierron is offline   Reply With Quote
Old 10-17-2012, 11:18 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,317
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Should be possible with the various functions in the template language.
kovidgoyal is offline   Reply With Quote
Advert
Old 10-18-2012, 11:09 AM   #3
dpierron
calibre2opds guru
dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.
 
dpierron's Avatar
 
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 ?
dpierron is offline   Reply With Quote
Old 10-19-2012, 02:39 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,931
Karma: 7208979
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') )
It assumes that there is one language in languages or that you want all languages as the prefix, and that you want the language code instead of the language name.
chaley is offline   Reply With Quote
Old 10-19-2012, 07:24 AM   #5
dpierron
calibre2opds guru
dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.
 
dpierron's Avatar
 
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
dpierron is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 08:06 PM.


MobileRead.com is a privately owned, operated and funded community.