I have a test version, attached to the first post.
It introduces a config file
.addons/autoshelf/autoshelf.cfg.
Code:
# AutoShelf sample configuration file
# In order to use this file, rename it to .addons/autoshelf/autoshelf.cfg
#
# path (Default: /mnt/onboard:/mnt/sd)
#
# path=path1[=prefix1][:path2[=prefix2]]...
#
# Specify the paths to be included by AutoShelf.
# Several paths can be separated using :.
#
# Paths in the internal memory start with /mnt/onboard.
# Paths on the external SD card start with /mnt/sd.
#
# The pathname itself will be removed from the collection name,
# so a collection "Fantasy/" would include books from both
# /mnt/onboard/Fantasy/ and /mnt/sd/Fantasy/.
#
# If you prefer "SD/Fantasy/" for the SD-card instead, you can
# specify a prefix using =.
#
# Examples:
# path=/mnt/onboard:/mnt/sd=SD/
# path=/mnt/onboard/Books=Books/:/mnt/onboard/Comics=Comics/
#
path=/mnt/onboard:/mnt/sd
#
# skip (Default: /mnt/onboard/.kobo)
#
# skip=path[:path]...
#
# Like path, but specifies paths to skip.
# Several paths can be separated using :.
# By default this applies to Kobo's User Manual.
#
skip=/mnt/onboard/.kobo
#
# consume (Default: 1)
#
# If set, each path will consume its books so the next path
# will not consider the same books again. Only relevant if
# you are using overlapping paths.
#
# This can be used to deviate from the real path structure
# without duplicating collections.
#
# path=/mnt/onboard/Sorted:/mnt/onboard=Unsorted/
#
consume=1
#
# series (Default: 1)
# Set series information for books based on folder and filename.
# If set to 0, series information will remain unchanged.
# To remove series information, see series_regexp below.
#
series=1
#
# series_regexp (Default: #([^/]+)/([0-9.]+)#:\1:\2:#)
# Only applies if series=1.
#
# The regular expression used to grab series and number,
# using sed extended regular expression syntax.
#
# Input: JKR/Harry Potter/001 Philosopher's Stone.epub
# Output: :Harry Potter:001:
#
# This can also be used to remove all series information:
# series_regexp=/.*/:::/
#
series_regexp=#([^/]+)/([0-9.]+)#:\1:\2:#
#
# exclusive (Default: 0)
# Set to 1 to use AutoShelf exclusively.
# !!! All other collections will be deleted.
#
exclusive=0
#
# unique_book (Default: 0)
#
# There shall be no book in more than one shelf at a time.
# Affects all shelves, not just the ones created by AutoShelf.
# May leave behind empty shelves.
#
unique_book=0
#
# uninstall (Default: 0)
# Set to 1 if you want to uninstall AutoShelf after the next run.
# Uninstalling will also remove all AutoShelf collections.
#
uninstall=0
Doesn't solve everything I wanted to. Either because I don't fully understand the database format, or because it's just bugs in Kobo's firmware.
Collections stopped reincarnating on sync for me except in one case: after uninstall with all collections removed, hey they're back. Yay.
Date is still scrambled, sort by date does not work. Sync sets date to 1970s, no matter what I do. And it happens for collections created directly on the Kobo as well. Same for book dates. Sort by "Date added" works - immediately after you added them. Stops working after you reboot. So it remembers the date in a memory structure temporarily only.
Anyway, while not perfect, this should be more powerful/customizable than before.