|  02-03-2022, 05:47 PM | #916 | 
| Junior Member  Posts: 1 Karma: 10 Join Date: Feb 2022 Device: Kindle2 (KB) | 
				
				Explain me the plugboard
			 
			
			Hi, is there any regex guru who can help me to understand plugboard template "Show author name as Initial and Surname (Kindle) (inspired by brewjono)"? Im afraid i dont fully understand the syntax: Code: {author_sort:re(\, (.).*?( &|$),\, \1\2)}How the regex matches the string and how replaces the field? | 
|   |   | 
|  02-03-2022, 06:10 PM | #917 | |
| Grand Sorcerer            Posts: 12,525 Karma: 8065948 Join Date: Jan 2010 Location: Notts, England Device: Kobo Libra 2 | Quote: 
 Where are you seeing the result you say you get? If it is on a device then the device is changing it. Nothing the plugboard can do about that. Workarounds might be available but you should ask in the devices forum, naming your device. | |
|   |   | 
|  02-19-2022, 02:59 PM | #918 | 
| Guru            Posts: 918 Karma: 810834 Join Date: Sep 2017 Location: Buenos Aires, Argentina Device: moon+ reader, kindle paperwhite | 
			
			Hello people  I have this configuration to save to disk. {title} ({#id}) - {authors} But the ID comes out with decimals, how could I fix it so that it is a whole number example: Title (10017301.0) - author.epub | 
|   |   | 
|  02-19-2022, 03:16 PM | #919 | |
| Grand Sorcerer            Posts: 12,525 Karma: 8065948 Join Date: Jan 2010 Location: Notts, England Device: Kobo Libra 2 | Quote: 
 My guess is that {title} ({id}) - {authors} will work. | |
|   |   | 
|  02-19-2022, 03:24 PM | #920 | |
| Guru            Posts: 918 Karma: 810834 Join Date: Sep 2017 Location: Buenos Aires, Argentina Device: moon+ reader, kindle paperwhite | Quote: 
 For that reason # My mistake, for not seeing. Sorry Last edited by dunhill; 02-19-2022 at 03:33 PM. | |
|   |   | 
|  02-19-2022, 03:32 PM | #921 | 
| Grand Sorcerer            Posts: 12,525 Karma: 8065948 Join Date: Jan 2010 Location: Notts, England Device: Kobo Libra 2 | |
|   |   | 
|  02-19-2022, 04:30 PM | #922 | |
| Grand Sorcerer            Posts: 12,525 Karma: 8065948 Join Date: Jan 2010 Location: Notts, England Device: Kobo Libra 2 | Quote: 
 Code: {title} ({#id:15.15g}) - {authors} | |
|   |   | 
|  02-19-2022, 09:24 PM | #923 | 
| Guru            Posts: 918 Karma: 810834 Join Date: Sep 2017 Location: Buenos Aires, Argentina Device: moon+ reader, kindle paperwhite | |
|   |   | 
|  02-20-2022, 01:51 PM | #924 | 
| Guru            Posts: 918 Karma: 810834 Join Date: Sep 2017 Location: Buenos Aires, Argentina Device: moon+ reader, kindle paperwhite | 
			
			I have a question about the id. Let's suppose that I have an id that by order is added 100000000 Example: Original id 043579 + added 100043579 Question by means of a disk saving template could I get back the original id or a personal column by means of program: ? Example: id 100043579 - added 100000000 = id Original 043579 Last edited by dunhill; 02-20-2022 at 01:54 PM. | 
|   |   | 
|  02-20-2022, 03:45 PM | #925 | |
| Grand Sorcerer            Posts: 12,525 Karma: 8065948 Join Date: Jan 2010 Location: Notts, England Device: Kobo Libra 2 | Quote: 
 Code: program: $#id - 100000000 I suggest you look at the template language documentation. | |
|   |   | 
|  02-20-2022, 04:26 PM | #926 | |
| Guru            Posts: 918 Karma: 810834 Join Date: Sep 2017 Location: Buenos Aires, Argentina Device: moon+ reader, kindle paperwhite | Quote: 
 Thanks because I was thinking about it with this post and it was simpler https://www.mobileread.com/forums/sh...17&postcount=8 Well not everything can be perfect. First of all I must say that I lack command of pyton, how could you add conditionals. Example: what remains if the number is between 10000000 and 10999999 only Last edited by dunhill; 02-20-2022 at 06:33 PM. | |
|   |   | 
|  02-21-2022, 10:33 AM | #927 | 
| Custom User Title            Posts: 11,347 Karma: 79528341 Join Date: Oct 2018 Location: Canada Device: Kobo Libra H2O, formerly Aura HD | 
			
			Something like this should work. Code: program: ## obviously replace $#yournum with your column if $#yournum>=#10000000 && $#yournum<=#10999999 then ## using 'round' to fix the float/decimal output I got in my test round(subtract($#yournum, 100000000)) else $#yournum fi Last edited by ownedbycats; 02-21-2022 at 10:35 AM. | 
|   |   | 
|  02-21-2022, 05:06 PM | #928 | |
| Guru            Posts: 918 Karma: 810834 Join Date: Sep 2017 Location: Buenos Aires, Argentina Device: moon+ reader, kindle paperwhite | Quote: 
 Thank you very much, that solves the problem | |
|   |   | 
|  03-16-2022, 08:30 AM | #929 | 
| Custom User Title            Posts: 11,347 Karma: 79528341 Join Date: Oct 2018 Location: Canada Device: Kobo Libra H2O, formerly Aura HD | 
			
			I use this as a stored template, readstatus().  Note that #percentread is integer and #readinglist is series-like managed with the Reading List plugin. Code: program: if $$#percentread >=#1 && $$#percentread <=#99 then 'currentlyreading' elif "To Be Read" in $#readinglist && $$#percentread ==#0 then 'toberead' elif $$#percentread >=#100 then 'read' elif $$#percentread == 'None' then 'undefined' elif $$#percentread >=#0 then 'unread' fi It would probably also work as a composite column. Last edited by ownedbycats; 03-16-2022 at 10:18 AM. | 
|   |   | 
|  04-06-2022, 02:36 PM | #930 | 
| Connoisseur            Posts: 73 Karma: 673502 Join Date: Jan 2012 Device: enTourage pocket eDGe,Pyrus mini, NOOK HD+, KAO, S6, S8, KP4, Note 10+ | 
			
			Please, more skilled than me, this problem really overwhelms me, please help. I have all the books in this format. W E Johns - [Biggles 31] - Biggles Delivers the Goods (epub).epub What is the correct way to import books into Calibre? Thank you and excuse the beginner question. edit: If i use Code: (?P<author>[^_-]+) -?\s*(?P<series>[^_0-9-]*)(?P<series_index>[0-9]*)\s*-\s*(?P<title>[^_].+) ? W E Johns - Biggles 31 - Biggles Delivers the Goods (epub).epub so no square brackets ... Last edited by Arbait; 04-07-2022 at 02:54 PM. | 
|   |   | 
|  | 
| Tags | 
| custom column, tag, tags | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Should composite columns appear in Grouped Searches? | ownedbycats | Library Management | 3 | 02-13-2021 03:43 PM | 
| Having problems with composite columns and save/send templates | Trel | Calibre | 4 | 09-26-2016 03:21 PM | 
| Tooltips for narrow columns | theducks | Library Management | 7 | 03-16-2015 10:58 PM | 
| Techniques to use plugboards, custom columns and templates | kovidgoyal | Library Management | 0 | 01-26-2011 04:21 PM |