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 10-14-2010, 07:36 AM   #46
Sweetpea
Grand Sorcerer
Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.
 
Sweetpea's Avatar
 
Posts: 8,050
Karma: 22708134
Join Date: Dec 2008
Location: Krewerd
Device: AVTN8; BBMini; Onyx Boox T68; SGN8
Quote:
Originally Posted by chaley View Post
As for your second example, yes, shortening can always create collisions. You pays your money and makes your choice.
Ahh, but those template fields do make the payment very cheap! You always have the possibility to do something in multiple steps
Sweetpea is offline   Reply With Quote
Old 10-14-2010, 07:45 AM   #47
Manichean
Wizard
Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!
 
Manichean's Avatar
 
Posts: 3,130
Karma: 80520
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by Sweetpea View Post
And no, that tweak doesn't do anything...
AFAIK, it's only applied when (title) metadata is updated, thus, you'd have to edit every title field without changing it or something like that.
Manichean is offline   Reply With Quote
 
Advertisement
Old 10-15-2010, 12:07 PM   #48
Sweetpea
Grand Sorcerer
Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.
 
Sweetpea's Avatar
 
Posts: 8,050
Karma: 22708134
Join Date: Dec 2008
Location: Krewerd
Device: AVTN8; BBMini; Onyx Boox T68; SGN8
Question:

I have a yes/no/unknown custom column ({#read}). I want to use this column in a collection. But simplying adding {#read} doesn't work, as I'll get a collection "Yes" and "No". Which doesn't make any sense, naturally.

So, I'd like to make a new custom column {#collection_read} which will transform the "Yes", "No" and "" into a value with actual visible meaning

But {#column:switch(Yes, Read, No, Reading, Unread)} doesn't work... It'll give me either "Read" or "Unread", the "Reading" is never shown...
Sweetpea is offline   Reply With Quote
Old 10-15-2010, 12:32 PM   #49
chaley
"chaley", not "charley"
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: 5,814
Karma: 1216136
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Sweetpea View Post
I have a yes/no/unknown custom column ({#read}). I want to use this column in a collection. But simplying adding {#read} doesn't work, as I'll get a collection "Yes" and "No". Which doesn't make any sense, naturally.
Actually, unless you change the renaming rules, the collections would be named 'Yes (Read)' and 'No (Read)', where 'Read' is the column heading of the custom field.
Quote:
So, I'd like to make a new custom column {#collection_read} which will transform the "Yes", "No" and "" into a value with actual visible meaning

But {#column:switch(Yes, Read, No, Reading, Unread)} doesn't work... It'll give me either "Read" or "Unread", the "Reading" is never shown...
The problem is that the test must match exactly, including spaces. Try
{#column:switch(Yes,Read,No,Reading,Unread)}
chaley is offline   Reply With Quote
Old 10-15-2010, 12:50 PM   #50
Sweetpea
Grand Sorcerer
Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.
 
Sweetpea's Avatar
 
Posts: 8,050
Karma: 22708134
Join Date: Dec 2008
Location: Krewerd
Device: AVTN8; BBMini; Onyx Boox T68; SGN8
Never tried the spaces! I'm not used to having spaces actually meaning anything

Quote:
Originally Posted by chaley View Post
Actually, unless you change the renaming rules, the collections would be named 'Yes (Read)' and 'No (Read)', where 'Read' is the column heading of the custom field.

Nope, I didn't change any naming rules and I got a nice category "Yes"...
Sweetpea is offline   Reply With Quote
Old 10-15-2010, 12:59 PM   #51
chaley
"chaley", not "charley"
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: 5,814
Karma: 1216136
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Sweetpea View Post
Never tried the spaces! I'm not used to having spaces actually meaning anything
I considered making a real lexical analyzer/parser for the template language, but gave it up because of performance. I didn't want to create a 'compiled' form, and I didn't want to reparse (worse would be the lexical analysis) each time. Thus, spaces count.
Quote:
Nope, I didn't change any naming rules and I got a nice category "Yes"...
Most of the more interesting custom column collection features are disabled when metadata management isn't set to automatic, which must be your case. The problem is that with manual management, calibre cannot know where the values come from, so it cannot apply combining and renaming. I could probably make the stuff work with 'on-send', but I didn't try.
chaley is offline   Reply With Quote
Old 10-16-2010, 02:32 PM   #52
Gary_M_Mugford
Zealot
Gary_M_Mugford has a complete set of Star Wars action figures.Gary_M_Mugford has a complete set of Star Wars action figures.Gary_M_Mugford has a complete set of Star Wars action figures.
 
Gary_M_Mugford's Avatar
 
Posts: 109
Karma: 297
Join Date: Jul 2010
Location: Brampton ON
Device: Kobo, Kindle3
Quote:
Originally Posted by chaley View Post
I considered making a real lexical analyzer/parser for the template language, but gave it up because of performance. I didn't want to create a 'compiled' form, and I didn't want to reparse (worse would be the lexical analysis) each time. Thus, spaces count.

Most of the more interesting custom column collection features are disabled when metadata management isn't set to automatic, which must be your case. The problem is that with manual management, calibre cannot know where the values come from, so it cannot apply combining and renaming. I could probably make the stuff work with 'on-send', but I didn't try.
The best of the initialisms versus shorten factions would be a regex that would check for spaces=0 and then use the shorten(4,~,3) versus the full regex contraction. Have NO idea whether regex can do that. But for the time-being, I've adopted the initialisms version after having tried the shorten function. I find the shorten version works for letting me know WHICH book in the series to read first, but I prefer giving up Mistborn1 for the occasional M1 rather than the occasional Tale~ers1 instead of the Tales Of the Black Widowers 1 becoming TOTBW1. More space on the woefully inadequate title browser screen on the Kindle for the actual title is a good thing.

Thanks for providing me with the initialism code. Very much appreciated.

GM

EDIT: Guess I'm not much of a programmer. Had spaces>0 originally. The pseudocode should be if spaces=0 then shorten else regex. Not that it matters, since Charles is going above and beyond. Looking forward to next week's release, afterwhich I will be making the composite columns outlined below end enjoying the best of all worlds.

Last edited by Gary_M_Mugford; 10-20-2010 at 02:08 AM.
Gary_M_Mugford is offline   Reply With Quote
Old 10-16-2010, 11:48 PM   #53
speakingtohe
Wizard
speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.
 
Posts: 4,608
Karma: 25170940
Join Date: Apr 2010
Device: sony PRS-T1 and T3, Kobo Mini and Aura HD, Tablet
Quote:
More space on the woefully inadequate title browser screen on the Kindle for the actual title is a good thing.
On the Kindle 3 if you leave the cursor on the title for about 3 seconds it displays two lines of title info with the second line being smaller font.

Meg Langslow Mysteries - ... Donna Andrews

becomes

Meg Langslow Mysteries - 03 - Revenge of
the Wrought-Iron Flamingos

No author but I have the collections by author so I can still see the author on the line above.

Helen
speakingtohe is offline   Reply With Quote
Old 10-17-2010, 02:16 AM   #54
chaley
"chaley", not "charley"
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: 5,814
Karma: 1216136
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Gary_M_Mugford View Post
The best of the initialisms versus shorten factions would be a regex that would check for spaces>0 and then use the shorten(4,~,3) versus the full regex contraction.
What you are asking for can be done, but not directly with regexps.

First, while working through this example I found that my implementation of the lookup function wasn't optimal. It suffered from the same problems that sweetpea found with test etc. I changed lookup, and the changes will appear in the next release (tomorrow, possibly). The examples uses the new functionality, so they won't work at home until release/upgrade.

OK, how to do it. The full solution requires creating three composite columns. The first column is used to remove the leading articles. The second is used to compute the 'shorten' form. The third is to compute the 'initials' form. Once you have these columns, the plugboard selects between them.

First column:
Code:
Name: #stripped_series. Template: {series:re(^(A|The|An)\s+,)||}
Second column (the shortened form):
Code:
Name: #shortened. Template: {#stripped_series:shorten(4,-,4)}
Third column (the initials form):
Code:
Name: #initials. Template: {#stripped_series:re(([^\s])[^\s]+(\s|$),\1)}
Plugboard expression:
Code:
Template:{#composite:lookup(.\s,#initials,.,#shortened,series)}{series_index:0>2s| [|] }{title}
Destination field: title
This set of fields and plugboard produces:
Series: The Lord of the Rings
Series index: 2
Title: The Two Towers
Output: LotR [02] The Two Towers

Series: Dahak
Series index: 1
Title: Mutineers Moon
Output: Dahak [01] Mutineers Moon

Series: Berserkers
Series Index: 4
Title: Berserker Throne
Output: Bers-kers [04] Berserker Throne

Series: Meg Langslow Mysteries
Series Index: 3
Title: Revenge of the Wrought-Iron Flamingos
Output: MLM [03] Revenge of the Wrought-Iron Flamingos

Of course, the plugboard template can easily be changed to require 2, 3, or however-many-you-want spaces before initials are used. For example, the following checks for 3 spaces.
Plugboard expression:
Code:
Template:{#composite:lookup(\s.*\s.*\s,#initials,.,#shortened,series)}{series_index:0>2s| [|] }{title}
Destination field: title
Using this template would change the Meg Langslow example to be:

Series: Meg Langslow Mysteries
Series Index: 3
Title: Revenge of the Wrought-Iron Flamingos
Output: Meg -ries [03] Revenge of the Wrought-Iron Flamingos

All the others would remain the same.

Last edited by chaley; 10-17-2010 at 05:22 PM. Reason: Fix wrong names in template
chaley is offline   Reply With Quote
Old 10-17-2010, 03:42 AM   #55
speakingtohe
Wizard
speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.
 
Posts: 4,608
Karma: 25170940
Join Date: Apr 2010
Device: sony PRS-T1 and T3, Kobo Mini and Aura HD, Tablet
So once again I am really confused. My post was informational (I thought) in that the kindle 3 will display a pretty comprehensive title on more than one line if you leave the cursor on it. (kindle cursor when browsing kindle) I have actually got it all quite reasoable in my mind at least on my mother's kindle.

Not that the Kindle agrees with me of course but I shall persevere. Or give my mother my Sony if she likes that better
speakingtohe is offline   Reply With Quote
Old 10-17-2010, 06:21 AM   #56
chaley
"chaley", not "charley"
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: 5,814
Karma: 1216136
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by speakingtohe View Post
So once again I am really confused. My post was informational (I thought) in that the kindle 3 will display a pretty comprehensive title on more than one line if you leave the cursor on it.
And it was informational. I hadn't before heard anyone mention that about a kindle.

I was responding to the post ahead of yours. I did use your example, because it was handy and the right number of words.
chaley is offline   Reply With Quote
Old 10-17-2010, 01:00 PM   #57
Gwen Morse
Addict
Gwen Morse never is beset by a damp, drizzly November in his or her soul.Gwen Morse never is beset by a damp, drizzly November in his or her soul.Gwen Morse never is beset by a damp, drizzly November in his or her soul.Gwen Morse never is beset by a damp, drizzly November in his or her soul.Gwen Morse never is beset by a damp, drizzly November in his or her soul.Gwen Morse never is beset by a damp, drizzly November in his or her soul.Gwen Morse never is beset by a damp, drizzly November in his or her soul.Gwen Morse never is beset by a damp, drizzly November in his or her soul.Gwen Morse never is beset by a damp, drizzly November in his or her soul.Gwen Morse never is beset by a damp, drizzly November in his or her soul.Gwen Morse never is beset by a damp, drizzly November in his or her soul.
 
Posts: 254
Karma: 59872
Join Date: Dec 2009
Location: New York, USA
Device: Kindle 3 (wifi) + nokia n900 tablet phone
EDIT: Editing out the whole post, I noticed too late I'd only read 3 pages of the thread, not 4 and what I wanted was already being discussed.

Sorry!

Last edited by Gwen Morse; 10-17-2010 at 01:10 PM.
Gwen Morse is offline   Reply With Quote
Old 10-18-2010, 05:11 PM   #58
Sweetpea
Grand Sorcerer
Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.
 
Sweetpea's Avatar
 
Posts: 8,050
Karma: 22708134
Join Date: Dec 2008
Location: Krewerd
Device: AVTN8; BBMini; Onyx Boox T68; SGN8
I finished my save-template for my non-meta-data-reading devices (I've got two).

I had several hurdles to take.

First of all: a folder structure. In order to not create one huge list of authors, I wanted to sort my authors in an alphabetic structure.


Code:
[A - D]/Adams, Douglas/Hitchhiker's Guide to the Galaxy/01 - The Hitchhiker's Guide to the Galaxy v1.epub
So, I created a custom column, {#folder_name}:

Code:
{author_sort:switch(^[A-D],[A - D],^[E-J],[E - J],^[K-O],[K - O],^[P-T],[P - T],^[U-Z],[U - Z],[Other])}
(with thanks to Chaley).

The next part was easier, simply {author_sort}

Then {series}, but not all books have series, so, {series:|/|}


The next part is a bit more difficult. Let me explain:

My books have the following meta-data:

Author: Douglas Adams
Author Sort: Adams, Douglas
Title: HggtG - 01 - The Hitchhiker's Guide to the Galaxy
Series: The Hitchhiker's Guide
Series Index: 1

The reason why I have the series in the title is simply because I think that series info belongs to the title. But that does make it a bit harder in this case, as I'll need to strip it.

{#collection_title} did the job:

Code:
{title:re(.*? - .*? - (.*?),\1)}
A simple custom column {#version} (integer) finished it all.


My final field:

{#folder_name}/{author_sort}{series:|/|}/{series_index:0>2s|| - }{#collection_title} - v{#version:ifempty(0)}



Now, there's one oddity. When I make a custom column in my Library, with this template, I'll get:

Code:
[A - D]/Adams, Douglas/Hitchhiker's Guide to the Galaxy/01 - The Hitchhiker's Guide to the Galaxy v1
However, if I use this template (or that custom column for that matter) as my save template, I'll get

Code:
[A - D]/Adams, Douglas/Hitchhiker's Guide to the Galaxy/01 - The Hitchhiker's Guide to the Galaxy v#version.epub
As long as version isn't filled, I'll get "v0"...

there's something weird going on with that #version anyway, as I had it as floating point before. It refused to do anything with it then! Not even in a custom template...
Sweetpea is offline   Reply With Quote
Old 10-18-2010, 05:30 PM   #59
chaley
"chaley", not "charley"
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: 5,814
Karma: 1216136
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Sweetpea View Post
As long as version isn't filled, I'll get "v0"...

there's something weird going on with that #version anyway, as I had it as floating point before. It refused to do anything with it then! Not even in a custom template...
Mea culpa. Float and integer custom columns don't work in save to disk templates. I will fix this for the next release.

I know the text types work, as do series types. Float and int now work (but not released). I need to check the other odd type: date.
chaley is offline   Reply With Quote
Old 10-19-2010, 03:04 AM   #60
Sweetpea
Grand Sorcerer
Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.
 
Sweetpea's Avatar
 
Posts: 8,050
Karma: 22708134
Join Date: Dec 2008
Location: Krewerd
Device: AVTN8; BBMini; Onyx Boox T68; SGN8
Quote:
Originally Posted by chaley View Post
Mea culpa. Float and integer custom columns don't work in save to disk templates. I will fix this for the next release.

I know the text types work, as do series types. Float and int now work (but not released). I need to check the other odd type: date.
Naturally, again, I try something that's not implemented yet
Sweetpea is offline   Reply With Quote
Reply

Tags
custom column

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
custom column i need a little help shinken Calibre 3 09-15-2010 04:41 AM
Using Custom Metadata in Save Template EJvdH Calibre 1 07-02-2010 07:06 AM
Accessories Decalgirl Kindle 2 custom skin template srmalloy Amazon Kindle 6 04-09-2010 10:55 PM
Donations for Custom Recipes ddavtian Calibre 5 01-23-2010 05:54 PM
Help understanding custom recipes andersent Calibre 0 12-17-2009 03:37 PM


All times are GMT -4. The time now is 03:07 AM.


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