예제 #1
0
 def import_current_bookmarks(imported):
     if imported.get('type') != 'bookmarks':
         return
     bookmarks = self.get_bookmarks()
     for bm in imported['entries']:
         q = parse_annotation(bm)
         if q not in bookmarks:
             bookmarks.append(q)
     self.set_bookmarks(bookmarks)
     self.edited.emit(self.get_bookmarks())
예제 #2
0
def merge_annotations(annots, annots_map):
    for annot in annots:
        annot = parse_annotation(annot)
        annots_map[annot.pop('type')].append(annot)
    lr = annots_map['last-read']
    if lr:
        lr.sort(key=itemgetter('timestamp'), reverse=True)
    for annot_type in ('bookmark',):
        a = annots_map.get(annot_type)
        if a and len(a) > 1:
            annots_map[annot_type] = list(merge_annots_with_identical_titles(a))
예제 #3
0
def merge_annotations(annots, annots_map):
    for annot in annots:
        annot = parse_annotation(annot)
        annots_map[annot.pop('type')].append(annot)
    lr = annots_map['last-read']
    if lr:
        lr.sort(key=itemgetter('timestamp'), reverse=True)
    for annot_type, field in {
            'bookmark': 'title',
            'highlight': 'uuid'
    }.items():
        a = annots_map.get(annot_type)
        if a and len(a) > 1:
            annots_map[annot_type] = list(
                merge_annots_with_identical_field(a, field=field))