View Single Post
Old 01-06-2014, 12:44 AM   #418
ACGAuthor
Enthusiast
ACGAuthor began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Nov 2013
Device: Kindle PW
Quote:
Originally Posted by eschwartz View Post
Well, I'm back!!
Welcome back! Hope you had a great holiday!

Quote:
Would you like to try this now?
Sure, I'm game!

Quote:
If I remember correctly, you want to generate a #collections field, which will be used by Kindle Collections to create collections, right?
Yes, pretty much. I can, of course, generate collections based on author name, series name, and even tags, but the problem is that I am trying to break my collection down into genres because the Collections Manager hack on my PW has the ability to nest collections inside collections, so I'd like to have folders for each genre, and then relevant sub-folders for authors/series inside those.

It would be easy enough to tell it to generate a collection based on X, Y, and Z tags, but the tags you might get when downloading metadata (or using the metadata in the file) are all over the place. So yeah, the idea would be to search for a set of tags like "Sci-Fi, Science Fiction, Fantasy, Urban Fantasy, Paranormal, vampires, shifters, etc etc, etc" and have it generate either a another tag, or a value for a "Genre" column, that would just be "SFF/UF/PNR".

Same principle for all the variations of tags you might find on M/M Romance books, only with that I want to go a step further. Because this is the genre I publish in, I read a lot of it, naturally. Enough so that it's not going to do me much good making a collection for each author because there are hundreds.

So except for the ones I would like to have in their own author/series collections, I would like them to go into a collection that would be (for example) "M/M misc authors A-B" (C-D, E-G, H-L, M-R, S-Z). So if the book had Genre=M/M Romance (based upon the tags) AND has "Author Grouping A-B" (based on the code you gave me a couple weeks ago." It would get sorted into the collection "M/M misc authors A-B"

Of course, then there's the question of how to distinguish the "misc" authors from the special authors who get their own folders, which I'm sure is an entirely different headache, lol.

Quote:
So what you will want is something along the lines of
Code:
{tags:switch(Sci-Fi,SFF/UF/PNR,(Urban )?Fantasy,SFF/UF/PNR,none)}
but with switch(pattern,value,pattern,value,......,value_if _empty) sets where pattern is (the regex of) any possible tag, and value is what the column should equal if so. value_if_empty is returned if no tags match, we can leave that blank.

So we can expand that to match all your tags, and add any other stuff you need into the collection naming.
Okay, I will compile a list of tags. Well, lists. What I may want to do is have you show me how it's done with the SFF/UF/PNR genre and then I'll see if I can replicate it for another genre.




Quote:
Problem from before:





Stupid me, I know what the problem is here. I created a new capture group at the beginning to remove leading spaces, but left the replace code replacing the nonexistent capture group. Properly, it should've been this (fix in red):
Code:
Name: #initials. Template: {#stripped_series:re(([\s])?([^\s])[^\s]+(\s|$),\2)}
And without the formatting error, it seems to work perfectly. Try this again?
Awesome! That works perfectly for the space after the ampersand issue. It also solves the problem of the space being added after other single-letter words like "a" or "I". So now the series "I, Spy" is "IS" now instead of "I S" and "Measure of a Man" is "MoaM" rather than "Moa M" like it was before.

And I see you posted something else while I was writing this. Back in a moment with answers for that!
ACGAuthor is offline   Reply With Quote