Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 09-22-2010, 02:05 PM   #31
phenomshel
ZCD BombShel
phenomshel ought to be getting tired of karma fortunes by now.phenomshel ought to be getting tired of karma fortunes by now.phenomshel ought to be getting tired of karma fortunes by now.phenomshel ought to be getting tired of karma fortunes by now.phenomshel ought to be getting tired of karma fortunes by now.phenomshel ought to be getting tired of karma fortunes by now.phenomshel ought to be getting tired of karma fortunes by now.phenomshel ought to be getting tired of karma fortunes by now.phenomshel ought to be getting tired of karma fortunes by now.phenomshel ought to be getting tired of karma fortunes by now.phenomshel ought to be getting tired of karma fortunes by now.
 
phenomshel's Avatar
 
Posts: 4,793
Karma: 8293322
Join Date: Jan 2009
Location: The Frozen North (aka Illinois, USA)
Device: iPad, STB Kindle Oasis
Yes, they do. I'm anxious to see all this implemented. I was thinking, "Oh, I'll install this and try it out", but then about the third post I realized the feedback they wanted was wayyy over my head, plus that, by the time I'd have time to do anything major with it, they'll have it done and released in the main production package. Not only does Calibre devel. rock, they're FAST.
phenomshel is offline   Reply With Quote
Old 09-22-2010, 02:34 PM   #32
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by Manichean View Post
That is SO COOL!
Squared!
Starson17 is offline   Reply With Quote
Advert
Old 09-22-2010, 02:50 PM   #33
Timoleon
Time Enough at Last
Timoleon ought to be getting tired of karma fortunes by now.Timoleon ought to be getting tired of karma fortunes by now.Timoleon ought to be getting tired of karma fortunes by now.Timoleon ought to be getting tired of karma fortunes by now.Timoleon ought to be getting tired of karma fortunes by now.Timoleon ought to be getting tired of karma fortunes by now.Timoleon ought to be getting tired of karma fortunes by now.Timoleon ought to be getting tired of karma fortunes by now.Timoleon ought to be getting tired of karma fortunes by now.Timoleon ought to be getting tired of karma fortunes by now.Timoleon ought to be getting tired of karma fortunes by now.
 
Timoleon's Avatar
 
Posts: 387
Karma: 1151316
Join Date: Feb 2008
Location: New England
Device: iPad 3, iPhone 5, Kindle 3, Fire, Sony PRS-350
Quote:
Originally Posted by Starson17 View Post
Squared!
Cubed!!
Timoleon is offline   Reply With Quote
Old 09-22-2010, 02:58 PM   #34
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by chaley View Post
{series}{ - |series_index| - }{title}

The hyphens will be included only if the book has a series index. Note: you must either use no | characters or both of them. Using one, such as in {field| - }, is not allowed. It is OK to not provide any text for one side or the other, such as in {|series| - }. Using {|title|} is the same as using {title}.
I hate to rain on my own parade, but I couldn't get this to work. Specifically, I tried
Code:
{|tags|/}{|series|/}{|series_index|- }{title}
{/|tags|/}{|series|/}{|series_index|- }{title}
{/|series|/}{title}
neither of which worked. The first two did transfer the books I selected, but apparently used Calibre's internal filename and didn't create any subdirectories whatsoever, the last one only created one file named "xseries_.epub"

Quote:
Originally Posted by chaley View Post
Now to formatting. Suppose you wanted to ensure that the series_index is always formatted as three digits with leading zeros. This would do the trick::

{series_index:0>3s} - Three digits with leading zeros

If instead of leading zeros you want leading spaces, use::

{series_index:>3s} - Thre digits with leading spaces
This doesn't work when used as I tried to do above. Calibre just told me that the conversion specification was invalid.
Manichean is offline   Reply With Quote
Old 09-22-2010, 03:00 PM   #35
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: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Putting path separators into the expressions isn't going to work. Leave those outside. calibre takes care of empty path components automatically anyway.
kovidgoyal is offline   Reply With Quote
Advert
Old 09-22-2010, 03:06 PM   #36
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,817
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Manichean View Post
I hate to rain on my own parade, but I couldn't get this to work. Specifically, I tried
Code:
{|tags|/}{|series|/}{|series_index|- }{title}
{/|tags|/}{|series|/}{|series_index|- }{title}
{/|series|/}{title}
neither of which worked. The first two did transfer the books I selected, but apparently used Calibre's internal filename and didn't create any subdirectories whatsoever, the last one only created one file named "xseries_.epub"


This doesn't work when used as I tried to do above. Calibre just told me that the conversion specification was invalid.
I started to do that, then ,
series_index is not blank, it always has a value (but is only displayed if Series has a value) The value is Series index default or set)
For this to work, we would need blank (string) OR Zero (numeric)
theducks is offline   Reply With Quote
Old 09-22-2010, 03:31 PM   #37
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by kovidgoyal View Post
Putting path separators into the expressions isn't going to work. Leave those outside. calibre takes care of empty path components automatically anyway.
Works flawlessly now. Though the issue with
Code:
{|series_index:0>2s|- }
being invalid, whereas
Code:
{series_index:0>2s}
is valid, still remains.

Also, I have a question: If a book has multiple tags, is it possible to use only a single tag in a template? I tried
Code:
{tags[0]}
but that only gave me the first letter of the combined tag string.
Manichean is offline   Reply With Quote
Old 09-22-2010, 03:32 PM   #38
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,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by theducks View Post
I started to do that, then ,
series_index is not blank, it always has a value (but is only displayed if Series has a value) The value is Series index default or set)
For this to work, we would need blank (string) OR Zero (numeric)
Sorry, but I don't understand.

If series is blank, then series_index is set to None.

I tested with this expression and it works.
{series}{ - |series_index|}/{author}/{title}
I get a folder level for series if the series exists, otherwise I don't.
chaley is offline   Reply With Quote
Old 09-22-2010, 03:46 PM   #39
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,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Manichean View Post
Though the issue with
Code:
{|series_index:0>2s|- }
being invalid, whereas
Code:
{series_index:0>2s}
is valid, still remains.
The non-working case is one that apparently is not handled by the format mini-language parser. It thinks that the | is part of the format spec. I will fix this tomorrow.
Quote:
Also, I have a question: If a book has multiple tags, is it possible to use only a single tag in a template? I tried
Code:
{tags[0]}
but that only gave me the first letter of the combined tag string.
No. Even if it did work, it would be ambiguous, because the first tag will vary depending on how the tags were fetched.

Instead, I suggest you make a custom text field and put the correct tag in it. No ambiguity.

Note: a last-minute optimization broke composite fields. The code changed from
Code:
'%s%s%s'%(prefix, value, suffix)
to
Code:
prefix + value + suffix.
Unfortunately, this second expression does not work if value is not a string, e.g. series index. I will fix this tomorrow as well.
chaley is offline   Reply With Quote
Old 09-22-2010, 04:44 PM   #40
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,817
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by chaley View Post
Sorry, but I don't understand.

If series is blank, then series_index is set to None.

I tested with this expression and it works.
{series}{ - |series_index|}/{author}/{title}
I get a folder level for series if the series exists, otherwise I don't.
I was thinking that he wanted a (wishful thinking) non-indexed series.
All entries in the series table have index values. Some of us have series that contain, both sequenced items and non-sequence (not in the main story placement) items . I usually assign 0 to the index.
I thought that was what he (and I) was trying to suppress. My bad.
theducks is offline   Reply With Quote
Old 09-22-2010, 04:53 PM   #41
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by chaley View Post
No. Even if it did work, it would be ambiguous, because the first tag will vary depending on how the tags were fetched.

Instead, I suggest you make a custom text field and put the correct tag in it. No ambiguity.
No big deal, I was just thinking about how to restructure my library to get rid of tags as folder assignments, something I've been wanting to do for some time now.
Manichean is offline   Reply With Quote
Old 09-23-2010, 11:28 AM   #42
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,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
OK, I have fixed the format spec + template problem. (Yea, you have heard this before. But this time I really mean it. )

In addition, and because it was convenient, I did some more stuff. The FAQ isn't updated yet, but a summary (not so short) is under the spoiler.

Summary: fully dynamic path generation, (some) functions in format specs, and direct editing of composite field format specifications on the library view. I also changed the prefix and suffix position, because it made things *much* simpler.

A field now looks like {name:fspec|prefix|suffix}. Any of fspec, prefix, or suffix can be empty. It is permissible to have no bars, but if there is one bar, then there must be two and the ':' must be there. Summary: {field}, {field:2>0s}, {field:||suffix}, and the like.

Documentation is:
Spoiler:

1) complete rewrite of composite field processing
-- creation of of formatter class in utils
-- change template validator (prefs/save_template.py) to use new formatting class
-- change save_to_disk to use new formatting class
-- change Metadata class to use new formatting class
-- Check for mutually recursive composite fields
-- change caches.py to use the 'get' interface (now the right one) for composites

2) Add template validation to the base deviceconfig plugin. It checks if the display widget has a 'validate' method, and if so, it calls it.

3) Change models.py so that composite templates can be edited on the library display.
-- back out the changes that set 'editable = False'

4) Fix problem in models.py where book info view was not being updated when a field is changed on library display

5) Changed save_to_disk to permit slashes in field specifications. Did this by splitting the template after template processing. This gives us basic variable folder structures
Example: Simple example: we want the folder structure series/series_index - title. If series does not exist, then the title should be in the top folder.
Template: {series:||/}{series_index:|| - }{title}

6) Change syntax for extended templates
-- prefixes and suffixes have moved to the end of the field specification.
Syntax: {series:|prefix value|suffix value}
You can put a standard python format specification between the : and the first |.
Either zero or two bars must be present.

7) Addition of some built-in functions to template processing. These appear in the format part.

Syntax: {field:function()|prefix value|suffix value}

Functions apply to the value of the field in the format specification.
The functions available are:
-- uppercase(), lowercase(), titlecase(), capitalise()

-- ifempty(text)
If the field is empty, replace it with text.

-- shorten(from start, center string, from end)
Replace the field with a shortened version. The shortened version is found by joining the field's first 'from start' characters, the center string, and the field's last 'from end' characters.
Example: assume that the title is
'Values of beta will give rise to dom'.
The field specification {title:shorten(6,---,6)} will produce the result 'Values---to dom'

-- lookup(key if field not empty, key if field empty)
Replace the value of 'field' with the value of some other field. The first field key is used if 'field' is not empty. The second field key is used if field is empty. This function, coupled with composite fields and the change to save_to_disk above, facilitates complex variable folder trees on devices.

Example: If a book has a series, then we want the folder structure series/series index - title.fmt. If the book does not have a series, then we want the folder structure genre/author_sort/title.fmt. If the book has no genre, use 'Unknown'.
To accomplish this, we:
1) create a composite field named AA containing '{series:||}/{series_index} - {title'.
2) create a composite field named BB containing '{#genre:ifempty(Unknown)}/{author_sort}/{title}'
3) set the save template to '{series:lookup(AA,BB)}
chaley is offline   Reply With Quote
Old 09-23-2010, 01:51 PM   #43
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,817
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
So !
Is there going to be a new Beta soon
theducks is offline   Reply With Quote
Old 09-23-2010, 02:16 PM   #44
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,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by theducks View Post
So !
Is there going to be a new Beta soon
We plan on releasing one tomorrow (Friday).
chaley is offline   Reply With Quote
Old 09-23-2010, 02:34 PM   #45
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,817
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by chaley View Post
We plan on releasing one tomorrow (Friday).
theducks is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sony collections and custom fields: how to handle duplicates? chaley Calibre 13 09-02-2010 04:11 PM
Amazon integrates Video and Audio with Ebooks luqmaninbmore News 22 06-28-2010 06:22 PM
PRC file doesn't fully import into Calibre MSJim Kindle Formats 1 06-01-2010 02:55 PM
Calibre custom news feed and python help. harrynewman Calibre 4 10-08-2009 09:26 AM
Smashwords integrates with Stanza, optimized for iPhone Smashwords News 1 11-29-2008 03:26 PM


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


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