Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 11-12-2013, 04:43 AM   #1
Feather_Qwill
Enthusiast
Feather_Qwill began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Jun 2013
Device: EZReader Pocket Pro
Question Saving Books: Make folder using only last part of hierarchical tags?

Hey, is it possible to Save Books to Device with a folder system that uses hierarchical tags for one of the folder levels, but only taking the final 'part' of the tag?

Quote:
ie:

if genre = speculative.science_fiction
then, given a file structure of
(genre)/(author)/(title)
it would be:
science_fiction/Bujold, Lois McMaster/Miles Errant.epub
(instead of speculative.science_fiction/Bujold, Lois McMaster/Miles Errant.epub)

and

genre = speculative.fantasy.urban_fantasy
--> urban_fantasy/Butcher, Jim/Storm Front.epub
(Instead of speculative.fantasy.urban_fantasy/Butcher, Jim/Storm Front.epub)


Why? I'm trying to cut out one of my custom columns that I need for in-calibre organization, but is unnecessary on my reader. All the contents of Column B are essentially subheadings of the contents of Column A.


Is there any way to tell calibre to do this? I know you can tell it to use shortened versions of authors, etc.




Extra: I'm trying to figure out how to change the reader that calibre uses by default when opening a book from within the program. Anyone know how? I did this once, but I can't remember it.

Last edited by Feather_Qwill; 11-12-2013 at 04:56 AM.
Feather_Qwill is offline   Reply With Quote
Old 11-12-2013, 05:12 AM   #2
chaley
Grumpy old git
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: 9,258
Karma: 2902112
Join Date: Jan 2010
Location: UK
Device: Reader
Assuming that the genre column is type "text" and not "text, like tags", and further assuming that its lookup key is #genre, then the template expression to get the last component is
Code:
{#genre:list_item(-1,.)}
See the documentation for the list_item function for more details.
chaley is offline   Reply With Quote
Advert
Old 11-12-2013, 05:22 AM   #3
Feather_Qwill
Enthusiast
Feather_Qwill began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Jun 2013
Device: EZReader Pocket Pro
Is there any way to do this with the "comma-separated text" type of column? Or do I basically need to make a new custom column and somehow copy everything over?

I'd rather keep the comma-separated tag variety if possible, since I often use multiple tags (ie: both Historical and Fantasy for something like Naomi Novik's Temeraire books, or Urban Fantasy and Mystery for Jim Butcher's Dresden Files books.
Feather_Qwill is offline   Reply With Quote
Old 11-12-2013, 05:25 AM   #4
chaley
Grumpy old git
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: 9,258
Karma: 2902112
Join Date: Jan 2010
Location: UK
Device: Reader
Quote:
Originally Posted by Feather_Qwill View Post
Is there any way to do this with the "comma-separated text" type of column? Or do I basically need to make a new custom column and somehow copy everything over?

I'd rather keep the comma-separated tag variety if possible, since I often use multiple tags (ie: both Historical and Fantasy for something like Naomi Novik's Temeraire books, or Urban Fantasy and Mystery for Jim Butcher's Dresden Files books.
Sure, but you need to specify exactly what is to happen when there is more than one value. Do you want the end of the first tag, the end of the last tag, all the ends concatenated together, or something else?
chaley is offline   Reply With Quote
Old 11-12-2013, 05:55 AM   #5
Feather_Qwill
Enthusiast
Feather_Qwill began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Jun 2013
Device: EZReader Pocket Pro
Thank you!

So would I use
{#genre:list_item(1,-1,.)} ?

or something like

{#genre:list_item(-1,.),first_non_empty(value)}

to select the last part of the first tag?


I'm sorry, I just have a bit of a hard time understanding all the technical language in the manual.
Feather_Qwill is offline   Reply With Quote
Advert
Old 11-12-2013, 06:20 AM   #6
chaley
Grumpy old git
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: 9,258
Karma: 2902112
Join Date: Jan 2010
Location: UK
Device: Reader
Selecting the first genre from a list of them is a bit complicated. We must first be sure that we know what "first" means. You probably mean it to be the first displayed, so we need to sort the list (list_sort) because inside calibre its sort order isn't defined. We then must extract the first tag from the sorted list (sublist), and finally extract the last item from that first tag (list_item).

The following template in template program mode should work
Code:
{#genre:'list_item(sublist(list_sort($, 0, ','), 0, 1, ','), -1, '.')'}
We need to use template program mode because we are using the output of one function as the input for another, something that cannot be done in the simpler single function mode.
chaley is offline   Reply With Quote
Old 11-13-2013, 03:08 AM   #7
Feather_Qwill
Enthusiast
Feather_Qwill began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Jun 2013
Device: EZReader Pocket Pro
Thank you for all your help.
Feather_Qwill is offline   Reply With Quote
Reply

Tags
directory, hierarchical, tags

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving books WITHOUT the folder structure janowskima Library Management 3 10-29-2013 11:20 PM
Calibre speed and hierarchical tags Noughty Library Management 10 01-24-2013 01:30 PM
Hierarchical tags and their format on book details Noughty Library Management 12 02-19-2012 07:47 AM
[Old Thread] Join books with same tags into one folder. ElLoco Calibre 8 03-29-2011 03:41 PM
Folder structure when adding vs. saving books drp Calibre 2 07-05-2009 01:19 PM


All times are GMT -4. The time now is 02:27 AM.


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