![]() |
#841 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,944
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Code:
program: subjects = $#subjects; admintags = $#admintags; existing_colls = $#kobocoll; new_colls = strcat( if $#booktype=='Fanfiction' then 'Fanfiction,' fi, if '^Cozy Mystery$' inlist subjects then 'Cozy Mysteries,' fi, if '^Horses$' inlist subjects then 'Horses,' fi, if '(Juvenile|Young Adult)' inlist subjects then 'Juvenile & Young Adults,' fi, if '^(Fantasy|Paranormal|Science Fiction)$' inlist subjects && !'Star Trek' inlist subjects then 'Fantasy & Sci-Fi,' fi, if '^Star Trek$' inlist subjects then 'Star Trek,' fi, if 'Omnibus' in admintags then 'Omnibuses' fi, ); Last edited by ownedbycats; 06-03-2025 at 06:46 PM. |
![]() |
![]() |
![]() |
#842 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,429
Karma: 8012664
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
check_inlist_field(field, values required, values_not_allowed) You should use "inlist_field '#subjects'" instead of "inlist subjects". I also suggest you use parentheses on line 12 to avoid any possibility of operator precidence being what you don't want. Example: Code:
if ('^(Fantasy|Paranormal|Science Fiction)$' inlist_field '#subjects') && (!('Star Trek' inlist_field '#subjects')) then 'Fantasy & Sci-Fi,' fi, Last edited by chaley; 06-04-2025 at 06:16 AM. |
|
![]() |
![]() |
![]() |
#843 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,944
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I have this to display icons for formats, and an unknown icon if none are present:
Code:
program: formats = approximate_formats(); strcat ( if "azw3" inlist formats then 'formats_azw3.png:' fi, if "cbz" inlist formats then 'formats_cbz.png:' fi, if "epub" inlist formats then 'formats_epub.png:' fi, if "html" inlist formats then 'formats_html.png:' fi, if "mobi" inlist formats then 'formats_mobi.png:' fi, if "paperbook" inlist formats then 'formats_paperbook.png:' fi, if "pdf" inlist formats then 'formats_pdf.png:' fi, if "txt" inlist formats then 'formats_txt.png:' fi, if "(overdrive|paperloan)" inlist formats then 'formats_overdrive.png:' fi, if list_difference(formats, 'azw3, cbz, epub, html, mobi, paperbook, pdf, txt, overdrive, paperloan', ',') then 'formats_unknown.png' fi ) |
![]() |
![]() |
![]() |
#844 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,712
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Maybe there's a way to use the png's in the ???\resources\images\mimetypes folder, where the image names are the format file types - e.g. epub.png, pdf.png etc.
BR |
![]() |
![]() |
![]() |
#845 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,944
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Yeah, I copied most icons from there (except paperbook and overdrive).
|
![]() |
![]() |
![]() |
#846 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,429
Karma: 8012664
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
This isn't as repetitive, but is a bit harder to understand.
Code:
program: def add_icon_name(res, fmt): return res & 'formats_' & fmt & '.png:' fed; result = ''; formats = approximate_formats(); formats_for_book = list_intersection('azw3, cbz, epub, html, mobi, paperbook, pdf, txt', formats, ','); for format in formats_for_book: result = add_icon_name(result, format) rof; if "(overdrive|paperloan)" inlist formats then result = add_icon_name(result, 'overdrive') fi; if list_difference(formats, formats_for_book & ',overdrive,paperloan', ',') then result = add_icon_name(result, 'unknown') fi; re(result, ':$', '') |
![]() |
![]() |
![]() |
#847 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,944
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Code:
{title_sort:'contains(t=uppercase(re($, '^\W*(\w).*$','\1')), '\d', '0-9', t)'} EDIT: Got it (not sure if transliterate should come before or after uppercase). Code:
{title_sort:'contains(t=uppercase(transliterate(re($, '^\W*(\w).*$','\1'))), '\d', '0-9', t)'} Last edited by ownedbycats; 06-23-2025 at 10:02 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Library Management: various questions not worth their own thread | ownedbycats | Library Management | 210 | 07-07-2025 08:06 PM |
[Metadata Source Plugin] Questions regarding parse select, docs and ref templates | Boilerplate4U | Development | 13 | 07-07-2020 02:35 AM |
Questions on Kobo [Interfered with another thread topic] | spdavies | Kobo Reader | 8 | 10-12-2014 11:37 AM |
[OLD Thread] Some questions before buying the fire. | darthreader13 | Kindle Fire | 7 | 05-10-2013 09:19 PM |
Thread management questions | meme | Feedback | 6 | 01-31-2011 05:07 PM |