Quote:
Originally Posted by chaley
What I would do is write a custom template function that does the job. Going this route gives you the full power and performance of python, of course at the cost of requiring knowledge of python. The function would get the values of tags, series, and what-have-you (I am not following all the details of the transformations you describe) and would construct the value for the composite column. This post shows some of what you would do in the template function. What is missing is that you can get arbitrary metadata items for a book from the kwargs parameter. For example, kwargs.get('series') will return the value of the series or None if there isn't one. Similarly, kwargs.get('tags') will return a list of tags on the book. You use the lookup name as the parameter for 'get'. From what I understand, you would want a different function in each library, but I am not sure of that.
You could do this in a general program mode template using in_list, list_union, and the like, but it would most likely be very slow.
|
Okay, that kinda flew over my head (as did the example you linked to), sorry. Yes, I plan on using a different function for the different libraries but if I have an example for how to do it for one library, I think I'll be able figure out the rest.
For example, I have the following:
Code:
Title Series Tags
Harry Potter and the Philosopher's Stone Harry Potter [1.0] Fiction, Children, Fantasy
Twilight Twilight [1.0] Fiction, Paranormal
How do I create the following custom columns from the above?
Code:
Title #MySeries #Type #Genre
Harry Potter and the Philosopher's Stone Series: Harry Potter [1.0] Fiction Genre: Children, Genre: Fantasy
Twilight Series: Twilight [1.0] Fiction Genre: Paranormal
#MySeries: Basically exactly the same as series except with
"Series: " added to the beginning of the string.
#Type: If certain pre-defined values are in tags (
Fiction, Non-Fiction, Fanfiction, Magazine), it goes to this column.
#Genre: Basically all tags (excluding
Fiction, Non-Fiction, Fanfiction & Magazine) with
"Genre: " added to the beginning of string.
I'm trying to understand your sample code but as I'm a total noob to Python, I'm finding it quite difficult to comprehend.