View Single Post
Old 06-11-2022, 12:40 AM   #3
wishingstar
Enthusiast
wishingstar can extract oil from cheesewishingstar can extract oil from cheesewishingstar can extract oil from cheesewishingstar can extract oil from cheesewishingstar can extract oil from cheesewishingstar can extract oil from cheesewishingstar can extract oil from cheesewishingstar can extract oil from cheese
 
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}")
wishingstar is offline   Reply With Quote