Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 03-11-2015, 11:58 PM   #46
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,278
Karma: 83106403
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Yes, that would be the basic idea behind any solution. The only real improvement would be a way to automatedly add that value, which would require a full database context and thus a calibre-debug script.

Example here (this is much the same concept, though it accomplishes a different goal): https://www.mobileread.com/forums/sho...&postcount=631

instead of in_list() you could use for readability (triggers when the column is non-empty):

Code:
various_authors=test(
	field('#serie'),
	'',
	 strcat(' - ', field('authors'))
);
eschwartz is offline   Reply With Quote
Old 03-12-2015, 01:06 AM   #47
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 106
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
Quote:
Originally Posted by eschwartz View Post
Python, long time ago...getting old. But of course weekend is coming and i will check that out. I feel me back into the HTML/CSS hard coding time

Quote:
Originally Posted by eschwartz View Post
instead of in_list() you could use for readability (triggers when the column is non-empty):

Code:
various_authors=test(
	field('#serie'),
	'',
	 strcat(' - ', field('authors'))
);
I have changed the whole thing by adding "MAS" (Multi Author Series) to the "tags" metadata.
Advantage is that it does not messes the opf file with thousand of """ strings up, seams all Custom Column do that.
Also when deleting the Content of a "custom column" the Costum Colum metatag itself does not get deleted in the opf file, very messy

I see also that Calibre does not seam to use epub 3 DC tags. "DC: type" tag - the content would be related to my goal. Should work for templates even the books are epub 2. Any chance to get this into the Tag-Editor in Calibre?

Last edited by Thomas_AR; 03-12-2015 at 01:15 AM.
Thomas_AR is offline   Reply With Quote
Advert
Old 03-12-2015, 01:21 AM   #48
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,278
Karma: 83106403
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Makes sense then.

As far as DC tags go -- custom columns are quite nonstandard as you saw, they need to define both content and parsing rules in the OPF. Using meta tags is I suspect deliberate.

Perhaps an identifiers type builtin column for storing DC metadata can be created. Theoretically. Kovid would have to decide it is worth it (and change always needs consideration).
What can you do with DC tags that you cannot do currently?
eschwartz is offline   Reply With Quote
Old 03-12-2015, 01:34 AM   #49
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 106
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
Well, anyway for now i think i am happy with the last solution - thanks for your help, much appreciated.
Perhaps in the future Kovid considers to add some epub 3 DC tags. There are some interesting DC tags like: type, collection, etc. Could give some opportunities i think like separating information. But you are right, there is nothing more we can do with or without new epub 3 DC tags, just a stylish advantage, not needing customs columns and not messing up the opf file.

Thanks again.
Thomas

Last edited by Thomas_AR; 03-12-2015 at 01:39 AM.
Thomas_AR is offline   Reply With Quote
Old 03-12-2015, 01:43 AM   #50
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,278
Karma: 83106403
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Sure.
eschwartz is offline   Reply With Quote
Advert
Old 03-12-2015, 03:33 AM   #51
chaley
CC Android & calibre dev
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 8,945
Karma: 2737706
Join Date: Jan 2010
Location: UK
Device: Many android devices
Quote:
Originally Posted by Thomas_AR View Post
I added simple the Tag "MAS" (Multi Author Series) to "tags", than using:
Code:
program:

# return separator+authors if no Multi Autor Serie (MAS) is found, or return empty
various_authors=in_list(
	field('tags'),
	'&',
	'MAS',
	'',
	 strcat(' - ', field('authors'))
);
[...]
..it seams to work as expected.
This works by accident. It will see MAS inside any tag, such as in MASTER. You are also using the wrong separator. Authors-like columns use '&', tags-like columns use ','.

You should use
Code:
program:

# return separator+authors if no Multi Autor Serie (MAS) is found, or return empty
various_authors=str_in_list(
	field('tags'),
	',',
	'MAS',
	'',
	 strcat(' - ', field('authors'))
);
[...]
chaley is offline   Reply With Quote
Old 03-12-2015, 07:45 PM   #52
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 106
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
Yes "MAS" could resolve in finding other tags which contains those three letters, i will choose some more unique
Thanks for the hint with the separator.
learning every day.
Thomas_AR is offline   Reply With Quote
Old 03-13-2015, 09:53 AM   #53
chaley
CC Android & calibre dev
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 8,945
Karma: 2737706
Join Date: Jan 2010
Location: UK
Device: Many android devices
Quote:
Originally Posted by Thomas_AR View Post
Yes "MAS" could resolve in finding other tags which contains those three letters, i will choose some more unique
Thanks for the hint with the separator.
learning every day.
If you use str_in_list then it is looking for an exact match for the string, not a regular expression match as found in in_list. You wouldn't need to worry about MAS also matching MASTER or NAMASTE.
chaley is offline   Reply With Quote
Old 03-13-2015, 05:17 PM   #54
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 106
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
Quote:
Originally Posted by chaley View Post
If you use str_in_list then it is looking for an exact match for the string, not a regular expression match as found in in_list. You wouldn't need to worry about MAS also matching MASTER or NAMASTE.
Thanks for the tip!!
Thomas_AR is offline   Reply With Quote
Old 03-13-2015, 05:34 PM   #55
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,278
Karma: 83106403
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Hah, I originally used in_list() because you implied that "Perry Rhodan" was a part of each affected series.

Lots more good information and useful functions listed in the manual (and built into the template dialog box) -- when you get a spare moment (and assuming you intend to master the use of templates) I suggest you take a look-see through them.

I don't remember half of them except well enough to know -- usually -- that "there should be something vaguely capable of doing x, let me look that up".
eschwartz is offline   Reply With Quote
Old 03-13-2015, 06:25 PM   #56
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 106
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
Quote:
Originally Posted by eschwartz View Post
Lots more good information and useful functions listed in the manual (and built into the template dialog box) -- when you get a spare moment (and assuming you intend to master the use of templates) I suggest you take a look-see through them.

I don't remember half of them except well enough to know -- usually -- that "there should be something vaguely capable of doing x, let me look that up".
I downloaded the manual as epub and will have a closer look on the template section this weekend instead of reading a good fantasy book.

So at the end i am using:
Code:
program:

# return separator+authors if Multi Autor Serie (MAS) is not found, or return empty
various_authors=str_in_list(
	field('tags'),
	',',
	'MAS',
	'',
	 strcat(' - ', field('authors'))
);
end_template=template('{series_index:0>4s| | - }{title} - {authors}');

start_template=test(
	field('series'),
	strcat(
		'_ ',
		field('series'),
		various_authors
	),
	field('authors')
);

strcat(start_template, '/', end_template);
I only would love one little change also based on Tag "MAS" i use and regarding series_index.

When MAS is found in Tags i like to have 0>4s (those series go app to 2000 books), but not in the other series (mostly they end at 20 at the most). Also there are some series with series indices with sub values 1.5, 2.0, 2.5 etc and those series are never bigger than 20 books.

So if MAS in Tags is not found i would like to have a series index with 0>4.2f or 0>4.1f, if found 0>4

Possible or a better solution?

Last edited by Thomas_AR; 03-13-2015 at 06:37 PM.
Thomas_AR is offline   Reply With Quote
Old 03-13-2015, 06:35 PM   #57
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,278
Karma: 83106403
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Try:

Code:
program:

# return separator+authors if Multi Autor Serie (MAS) is not found, or return empty
various_authors=str_in_list(
	field('tags'),
	',',
	'MAS',
	'',
	 strcat(' - ', field('authors'))
);
sindex=str_in_list(
	field('tags'),
	',',
	'MAS',
	finish_formatting(field('series_index'), '0>5.2f', ' ', ' - '),
	finish_formatting(field('series_index'), '0>4s', ' ', ' - ')
);
start_template=test(
	field('series'),
	strcat(
		'_ ',
		field('series'),
		various_authors
	),
	field('authors')
);

strcat(start_template, '/', sindex, field('title'), ' - ', field('authors'));

Last edited by eschwartz; 03-13-2015 at 06:38 PM.
eschwartz is offline   Reply With Quote
Old 03-13-2015, 06:52 PM   #58
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 106
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
This is strangely not working.

I got for Series with NO "MAS" Tag and series index " 1, 2, 2.5, 3, 4 files as followed:

0001
0002
0003
0004
2.50

and in the tester i get the message in the checker: The template contains no {fields}, so books will have all the same name.

Last edited by Thomas_AR; 03-13-2015 at 10:48 PM.
Thomas_AR is offline   Reply With Quote
Old 03-13-2015, 08:25 PM   #59
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 23,191
Karma: 24100002
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab A, Kobo Aura2
Quote:
Hah, I originally used in_list() because you implied that "Perry Rhodan" was a part of each affected series.
That series is a bit of work because it could be done by issue or by cycle
I found me a chart and recoded series by cycle [in cycle index]

Perry Rhodan.Pobis[1]
theducks is online now   Reply With Quote
Old 03-13-2015, 09:26 PM   #60
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 106
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
Quote:
Originally Posted by theducks View Post
That series is a bit of work because it could be done by issue or by cycle
I found me a chart and recoded series by cycle [in cycle index]

Perry Rhodan.Pobis[1]
If i understand you right...
I thought about doing so with Custom columns, but it messes the opf ile up like hell

Quote:
I found me a chart ...
What do you mean by that?
Thomas_AR is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Send to device - Template help Snow Sciles Library Management 12 05-26-2014 05:16 PM
Generic "Sending to Device" template not kicking in on Folder Device At_Libitum Library Management 2 11-01-2013 07:12 AM
Save to Device template HFC3 Library Management 6 07-08-2013 11:48 AM
Save template for sending books to Kindle 3 Eaglebeak60 Devices 2 02-14-2011 06:12 PM
Send to device template rockeh Calibre 6 08-17-2010 05:28 PM


All times are GMT -4. The time now is 06:53 PM.


MobileRead.com is a privately owned, operated and funded community.