|
|
#1 |
|
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 479
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Pick a random book?
I'd like to create something that goes through all of my Calibre books, finds those that have the onkobo column checked but doesn't have a date in the finished column, then choose one at random.
Something like: Code:
import random unfinished = [book for books if book.onkobo and not book.finished] book = random.choice(unfinished) show(book.title, book.author) |
|
|
|
|
|
#2 |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,270
Karma: 61916422
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
I have a VL for 'To Read'
Code:
Not #finished:>12/31/2000 and formats:true and not formats:other and not #usertags:split_up usertags is what it says , I tag there when I use Epub Split (PI) on a boxed setSo, if it has a format and not fand any of the other, it represents my (outta control) TBR pile Once that VL is active, you just use the dice Icon (select a Random Book) Note: You may need to add it to a toolbar |
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 479
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Goes off to figure out virtual libraries.
![]() I like the idea of tracking abandoned books. |
|
|
|
|
|
#4 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 14,002
Karma: 243829945
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
|
|
|
|
|
|
|
#5 |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,270
Karma: 61916422
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
The reason I prefer VL's is because you can use them in conjunction with the Tag Browser.
Show To Read and filter by Science Fiction |
|
|
|
| Advert | |
|
|
|
|
#6 | |
|
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 479
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Quote:
Last edited by foosion; 08-18-2024 at 10:29 PM. |
|
|
|
|
|
|
#7 |
|
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,364
Karma: 79528341
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I have a stored template for tracking read status and for it I defined did-not-finished by adding 'dnf' to the#admintags column.
Code:
program: percent = $$#percentread; if 'dnf' inlist $#admintags then 'didnotfinish' elif percent >=#1 && percent <=#99 then 'currentlyreading' elif $#readinglist=='To Be Read' && percent ==#0 then 'toberead' elif percent >=#100 then 'read' elif percent == 'None' then 'undefined' elif percent >=#0 then 'unread' fi Last edited by ownedbycats; 08-18-2024 at 11:15 PM. |
|
|
|
|
|
#8 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
You would probably also want to do one or both of:
Edit: If your goal is to read (View) the random book, do it in Action chains.
EDIT 2: My post is more-or-less the same as @theduck's post (#2 above). Apologies for the repeat. Last edited by chaley; 08-19-2024 at 04:33 AM. |
|
|
|
|
|
|
#9 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
@foosion: if you really want to roll your own implementation, I think the easiest is to do it in an Action chains python action. Use db.cache.search() to get the list of ids, select one randomly, then gui2.actions.view.view_format_by_id() to launch the viewer.
Last edited by chaley; 08-19-2024 at 06:55 AM. Reason: spelling |
|
|
|
|
|
#10 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Here is a sample Action chains python action that does a search, selects a random book id, then "view"s the EPUB format of that book.
Code:
def run(gui, settings, chain):
db = gui.current_db
ids = list(db.new_api.search('#mybool:true and formats:epub'))
if ids:
import random
random_id = random.choice(ids)
view_action = gui.iactions['View']
view_action.view_format_by_id(random_id, 'EPUB', open_at=None)
|
|
|
|
|
|
#11 |
|
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 479
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Although I've been using Calibre for about 15 years, until I got a Kobo I barely used any of Calibre's features beyond add a book and view. I'm going to have to devote some time to reading the manual and playing.
|
|
|
|
|
|
#12 | |
|
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 479
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Quote:
I'd do "#onkobo:true and #finished:false" instead of #mybool. Is there a way to show a message, if I want to identify the chosen book rather than use the viewer? |
|
|
|
|
|
|
#13 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
|
|
|
|
|
#14 |
|
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 479
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
|
|
|
|
|
|
#15 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to assign Pick a Random Book to a keyboard combination? | jamesgl | Calibre | 3 | 05-14-2022 06:54 PM |
| Pick multiple random books? | BookJunkieLI | Library Management | 5 | 05-24-2020 12:10 PM |
| "Pick Random Book" - not so random?? | Chris_Snow | Library Management | 3 | 09-15-2013 07:44 PM |
| Adding "Pick a Random Book" in Sharing over the net | ippopom | Recipes | 2 | 01-13-2013 05:32 AM |
| Do you pick the book first or do you look for books available on your device? | Bob Russell | Which one should I buy? | 21 | 09-08-2008 01:34 PM |