![]() |
#1 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 33
Karma: 1032
Join Date: Nov 2016
Device: Kobo Aura Edition 2, Lenovo Android 10
|
![]()
As I'm organizing my library, I'm combining a bunch of articles by topic into collections. I have these articles downloaded as html files, and placed in folders by topic. So basically what I do is:
Now my question is about ordering the articles. The way outlined here means the articles will be added in alphabetical order, which is okay in principle, but I'm wondering if I can add some 'variety' into the collection by somehow randomizing the order of the html files in the book. I know I can drag the individual html files around, but that's impractical with 100+ articles. Is there a way to randomize the files automatically, or to write a script to randomize the files on import somehow? Last edited by wishingstar; 06-10-2022 at 02:01 AM. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,363
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
If you can script you can simply use conversion to do this in an automated fashion. https://manual.calibre-ebook.com/faq...specific-order
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 33
Karma: 1032
Join Date: Nov 2016
Device: Kobo Aura Edition 2, Lenovo Android 10
|
Thank you, I followed something similar to your suggestion, only I did the randomization in a python script outside of calibre before importing. Here's the script I used in case anyone is interested. Basically, the script adds a random prefix to each file name, and then I import them into the book editor, which will now be in the new order determined by the random prefix.
Code:
import os import random path = r"path\\to\\folder\\" # note: using double slashes because windows string_to_draw_from = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" for file in os.listdir(path): letters = ''.join(random.choices(string_to_draw_from, k=2)) + '_' # 2 random letters as prefix os.rename(path+file, f"{path}{letters}{file}") |
![]() |
![]() |
![]() |
Tags |
edit book |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Aura Grey text in book, Black text in menu | aluisscp | Kobo Reader | 4 | 09-03-2014 07:10 PM |
Troubleshooting K4NT (2012) randomizing screensavers | SN3AKYf0x | Amazon Kindle | 2 | 12-11-2012 04:18 AM |
Text files with # and ## | p3aul | Calibre | 6 | 10-13-2009 03:10 PM |
Text files blanked | Halk | Calibre | 21 | 05-18-2009 01:31 PM |
Text tool for formatting Gutenberg text files | bob_ninja | Workshop | 5 | 11-13-2007 12:28 PM |