View Single Post
Old 10-18-2010, 04: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: 7,953
Karma: 22621990
Join Date: Dec 2008
Location: Krewerd
Device: HTC Flyer; BBMini; Sony PRS650; Onyx Boox T68
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