![]() |
#1 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,799
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
first_non_empty woes
I have a bunch of individual icon rules for use in my Cleanup library; e.g. show a tag icon for missing tags, that sort of thing. Combining them into one advanced rule is proving itself to be a bit difficult though.
First I tried a gpm with a lot of elifs, only to figure out that all the 'fis' were causing processing to stop prematurely. So I thought that a first_non_empty would work better: Code:
program: ## Some common variables ids = $identifiers; ## Check for 'Cleanup' VL. if 'Cleanup' in virtual_libraries() then ## Begin first_non_empty first_non_empty( ## Missing metadata if !$languages then 'languages.png' fi; if !$#pagecount then 'cover_flow.png' fi; if !$#chaptercount then 'cover_flow.png' fi; if !$tags then 'tags.png' fi; ## Fanfiction check if $#fanficcat then status = $#fanficstatus; ## Identifiers if select(ids, 'url') then if '(Archive of Our Own|Fanfiction.net)' in $publisher && '(Completed|Abandoned|Oneshot|Incomplete)' in status then 'metadata.png' elif !select(ids, 'ao3') && $publisher == 'Archive of Our Own' && status == 'In-Progress' then 'metadata.png' elif !select(ids, 'ffnet') && $publisher == 'FanFiction.net' && status == 'In-Progress' then "metadata.png" fi fi ## End fanfiction check fi; ## Marked books if is_marked() then m = is_marked(); first_non_empty( contains(m, "invalid_author_sort|invalid_title_sort", 'auto_author_sort.png', ''), contains(m, "epub_calibre_bookmarks", 'snippets.png', ''), if 'fff' in m && check_yes_no('#onkobo', 0, 0, 1) then 'sync.png' fi, if 'reading_list_send_to_device' in m then 'sync.png' fi, if 'reading_list_to_be_read' in m then 'list.png' fi, contains(m, "fff", 'download-metadata.png', ''), contains(m, "search_results", 'search.png', ''), if m then 'marked.png' fi ) fi; ## Fallback to polish.png for undefined issues 'polish.png' ## End first_non_empty ) # End Cleanup VL check fi Did I make a mistake? I tested this: Code:
program: ## Some common variables ids = $identifiers; ## Check for 'Cleanup' VL. if 'Cleanup' in virtual_libraries() then ## Fanfiction check if $#fanficcat then status = $#fanficstatus; ## Identifiers if select(ids, 'url') then if '(Archive of Our Own|Fanfiction.net)' in $publisher && '(Completed|Abandoned|Oneshot|Incomplete)' in status then 'metadata.png' elif !select(ids, 'ao3') && $publisher == 'Archive of Our Own' && status == 'In-Progress' then 'metadata.png' elif !select(ids, 'ffnet') && $publisher == 'FanFiction.net' && status == 'In-Progress' then "metadata.png" fi fi ## End fanfiction check fi # End Cleanup VL check fi So I return to the original template and comment out polish.png (removing the semicolon on the is_marked() section). Now it's returning blank. But if I uncomment polish.png and move the entire 'Fanfiction check' section below it, it returns metadata.png. Did I accidentally turn my first_non_empty into a last_non_empty? I also got some strange results on a far simpler test template: |
![]() |
![]() |
![]() |
#2 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,799
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
update: I should have used commas instead of semicolons. It was apparently just one long entry in first_non_empty instead of a bunch of them. That was a silly mistake.
Last edited by ownedbycats; 01-29-2022 at 04:49 AM. |
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Libra Metadata woes | ryadaj | Kobo Reader | 11 | 03-18-2021 09:36 AM |
Wallpaper woes... | alansplace | Android Devices | 4 | 01-02-2014 05:46 PM |
New firmware woes... | Dickdastardly | Kobo Reader | 8 | 12-11-2013 06:28 PM |
Stylus Woes | MelC | Sony Reader | 22 | 02-08-2010 01:16 PM |
PRS-300 New Computer Woes | Aeiouna | Sony Reader | 1 | 02-08-2010 05:56 AM |