Quantcast
Channel: MobileRead Forums
Viewing all articles
Browse latest Browse all 50094

Last annotation date

$
0
0
Hi,

I'm running an Action Chain that filters a custom column with annotation count:true, then selects a View Manager preset that sorts the list by Last Action Date (from Last Modified plugin). This should give me in Library View a list of recently annotated titles in Calibre viewer.

However, as the Last Action column is also updated by other db changes, I thought of adding a custom column to display a book's last annotation date.

From looking at db\cache.py, I take it this might be possible...

Code:

@write_api
    def merge_annotations_for_book(self, book_id, fmt, annots_list, user_type='local', user='viewer'):
        '''
        Merge the specified annotations into the existing annotations for book_id, fm, user_type, and user.
        '''
        from calibre.utils.date import EPOCH
        from calibre.utils.iso8601 import parse_iso8601
        amap = self._annotations_map_for_book(book_id, fmt, user_type=user_type, user=user)
        merge_annotations(annots_list, amap)
        alist = []
        for val in itervalues(amap):
            for annot in val:
                ts = (parse_iso8601(annot['timestamp']) - EPOCH).total_seconds()
                alist.append((annot, ts))
        self._set_annotations_for_book(book_id, fmt, alist, user_type=user_type, user=user)

... because of that annot['timestamp'] reference.

Please help?

(I'm aware that the annotation browser sorts by last annotated titles but still thought this might be useful)

Viewing all articles
Browse latest Browse all 50094

Latest Images

Trending Articles



Latest Images