View Single Post
Old 09-20-2020, 10:51 PM   #915
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303826
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by JimmXinu View Post
I dunno--you're using features I've never used and I didn't write it, so...

The relevant block of code appears to be:
Spoiler:

Code:
    def _rebuild_auto_device_list(self, db, list_name, on_device_ids):
        if DEBUG:
            prints('READING LIST: Auto-populating device list: ', list_name)
        existing_book_ids = set(cfg.get_book_list(db, list_name))
        ids_to_remove = list(existing_book_ids - on_device_ids)
        ids_to_add = list(on_device_ids - existing_book_ids)
        if DEBUG:
            prints('READING LIST: Removing %d ids from automatic list: %s' % (len(ids_to_remove), list_name))
        self.apply_tags_to_list(list_name, ids_to_remove, add=False, modify_action='TAGADDREMOVE')
        if DEBUG:
            prints('READING LIST: Adding %d ids to automatic list: %s' % (len(ids_to_add), list_name))
        # We will force the apply of tags to ALL items on the list, just in case the user
        # has only just specified a tag.
        self.apply_tags_to_list(list_name, list(on_device_ids), add=True, modify_action='TAGADDREMOVE')
        cfg.set_book_list(db, list_name, list(on_device_ids))
        ids_to_remove.extend(ids_to_add)
        return ids_to_remove

The code is explicitly ignoring the list's setting for modify_action when it's an auto-populated list.

That's the only place in the RL code that the apply_tags_to_list(...,modify_action=...) parameter is used, which suggests it was deliberate? (Interestingly, search populated lists explicitly disable updating column/tags from list.)

I think it would do what you want if the modify_action='TAGADDREMOVE' parameters are removed.

Attached is a version with that change. I haven't tested it -- use at your own risk and test it first.
To me that is very deliberate. The purpose of that type of list is to be able to see what books are on the device when it is not actually connected. Removing the book from the list, but, not removing the column value would be confusing. The point of setting the column is to have a way to search for the books that are on the device when the device is not connected. If you don't remove the value, you break that rule and it will almost definitely break searches people are using.
davidfor is offline   Reply With Quote