Quote:
Originally Posted by chaley
...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.
|
Personally, I'm not concerned about OS/file-system limitations in my own use of calibre because I've never encountered any limits that annoyed me. But there is a large base of Windows users, some of whom seem concerned about length of entire path or filename alone. So I was responding to that, while using it as an excuse to learn a little more about template programming.
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.