![]() |
#16 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,065
Karma: 858115
Join Date: Jan 2011
Device: Kobo Clara, Kindle Paperwhite 10
|
Templates for character count of path of book in calibre library 0.1
Here's my first shot at a template for the full path of a book in a calibre library.
Edit: Oops. Deleted. Discovered a problem in the template, back to the drawing board. Last edited by unboggling; 09-15-2012 at 04:01 AM. Reason: deleted |
![]() |
![]() |
![]() |
#17 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
The question "how do I find the exact path to a book" has come up several times in the last month. I am wondering whether I should add a template function that returns it.
To be precise, I could add two functions, one that returns the path to the current library and one that returns the path to a given format. I don't see the use in a function that returns the path to the folder containing the formats, but I could be convinced otherwise. It is worth noting that calibre creates paths in the library that save-to-disk cannot replicate. In particular, paths in the library can contain multiple consecutive spaces. Save to disk (and send to device) will reduce these to one space. Thus even if I add the function it won't be possible to recreate an identical folder hierarchy even with these functions. Also note that it is likely that these functions won't work in save templates. Reason: the template processor will need access to the database to evaluate these functions, and the DB is not available to the send/save jobs. |
![]() |
![]() |
Advert | |
|
![]() |
#18 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,065
Karma: 858115
Join Date: Jan 2011
Device: Kobo Clara, Kindle Paperwhite 10
|
Quote:
![]() In the past few months (my memory may be faulty) I recall only 1 or 2 users wanting to exactly replicate the calibre library structure with Save to Disk, for some purpose of melding with a file-syncing application. Personally, I don't have a need for that. But I recall more than a few users wanting to track string length of filename alone or entire path, particularly since someone mentioned the issue last month in "How I" thread, which brought me out of my self-inflicted OS X daze to look around. For them one or two special functions (that don't necessarily work in Save/Send/Plugboard templates) might be simpler to use. For their purposes using it just for a composite column would work fine. A special function such as "path()" returning entire path string from start to finish that automatically includes drive/volume designators and perhaps even an approximation of file extension (at book level of abstraction) might get used a lot more than a complex-seeming template program such as my construction above. A function including the exact format extension might be even better, though it seems difficult to implement due to the conflicting levels of abstraction between "book" and "format". Special functions such as strlen_path and strlen_just_the_filename might be even more frequently used, for composite column, if using them were as simple as clicking a quick-create button in "Add your own columns". But I'm hazy about the various file-system path conventions and differences. I'm hazy about whether more users are concerned about limitations for filename component alone or for entire path. I'm hazy about calibre internals that truncate according to whatever criteria per whatever set of varying systems. And implementing such functions is probably a complicated endeavor. I don't know if your effort would be worth it. Maybe some of those users will chime in. ![]() Edit: PS. I really like the template language. Thank you for creating it. Last edited by unboggling; 09-14-2012 at 05:02 AM. |
|
![]() |
![]() |
![]() |
#19 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,076
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
My 2p (thinking on what unBoggling said)
Maybe we just need is a (un-trimmed names) 'path length' warning indicator that appears (in the Metadata Edit Window) when the combination of Authors, Title and Library path start pushing the Limit. |
![]() |
![]() |
![]() |
#20 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I am not sure what purpose the warning would serve. Calibre deals with the limit by shortening the component parts of the name to make things fit. The warning would tell the user that the names of files and folders in the library might be truncated, but why should anyone care? It is hard to imagine that someone would shorten an author's name so that it fits within the limit.
|
![]() |
![]() |
Advert | |
|
![]() |
#21 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 254
Karma: 69786
Join Date: May 2006
Location: Oslo, Norway
Device: Kobo Aura, Sony PRS-650
|
Quote:
![]() I must admit that I don't understand why people worry so much about the path length. Lots of entries in my library are cut off, but since calibre handles everything about it, why would I care? However, if you are bored one day and decide to implement this function I guess that quite a few users would find a use for it. |
|
![]() |
![]() |
![]() |
#22 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79
Karma: 498122
Join Date: May 2010
Location: Europe
Device: Bookeen Cybook Gen3, Kindle 3, Kindle PW, Kindle Voyage
|
Somehow calibre2odps is truncating the paths, at least to my understanding, thus rendering the download-links unusable. So the problem for me didn't sit with calibre, but since I cannot change the workings of calibre2opds either, I'm prepared to optimise the title a little bit if necessary. Otherwise I wouldn't care about it.
|
![]() |
![]() |
![]() |
#23 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,065
Karma: 858115
Join Date: Jan 2011
Device: Kobo Clara, Kindle Paperwhite 10
|
Templates for character count of path of book in calibre library 0.2
Here was my second shot at a template for the full path of books in a calibre library.
Deleted. Some of these templates became outdated due to new template functions recently added in calibre, which allow better path templates. For updated templates and discussion, please see Post #24 (the post following this post) Last edited by unboggling; 09-22-2012 at 06:17 AM. Reason: deleted, obsolescent |
![]() |
![]() |
![]() |
#24 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,065
Karma: 858115
Join Date: Jan 2011
Device: Kobo Clara, Kindle Paperwhite 10
|
Templates for character count of path of book in calibre library 0.3
Here's my third shot at a template for the full path of books in a calibre library, updated with some new template functions. Thank you, chaley and kovid. The full path templates using formats_paths() are easier to construct, with better performance, and (I assume) accuracy. The descriptions for the templates using new functions are dark blue.
Example Templates, Composite Columns, Filename or Path of Books in calibre Library. I am not concerned about path length or filename length in a library because calibre automatically stays within filesystem limitations by truncating filename or other path components when necessary, and the calibre library folder and filename structure are off-limits anyway. But some users are concerned enough to want short titles, filenames, or paths.
Last edited by unboggling; 09-22-2012 at 08:08 AM. Reason: minor clarifications in some descriptions |
![]() |
![]() |
![]() |
#25 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,076
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Windows(NT Kernal on) also permits longer extension names. EPUB is 4, Mobi is 4, AZW3 is 4 ![]() ![]() RIP 8 dot 3 |
|
![]() |
![]() |
![]() |
#26 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,065
Karma: 858115
Join Date: Jan 2011
Device: Kobo Clara, Kindle Paperwhite 10
|
Quote:
![]() Thanks. So I parse that to mean I can delete the sentence regarding being unsure about Windows extensions. (Done.) Last edited by unboggling; 09-22-2012 at 07:58 AM. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom column showing path length? | xterminal | Library Management | 1 | 09-11-2012 09:12 AM |
Custom column to display number of chapters? | crackshot91 | Library Management | 10 | 09-08-2012 04:56 PM |
Can custom book data be displayed in a custom column? | kiwidude | Development | 9 | 03-02-2011 05:35 AM |
Custom column for book added | gandor62 | Library Management | 1 | 03-01-2011 06:58 AM |
Custom Column - Book Format (ie mobi, epub etc) | jphphotography | Calibre | 3 | 01-17-2011 12:34 AM |