def bookmark_context_menu(media_id, section, title): bookmarks = container.bookmarks() if media_id in bookmarks: return [(lang(40307), actions.background(plugin.url_for('delete_bookmark', media_id=media_id, section=section.filter_val)))] else: return [(lang(40306), actions.background(plugin.url_for('add_bookmark', media_id=media_id, section=section.filter_val, title=ensure_str(title))))]
def bookmarks_index(section): plugin.set_content("movies") section = Section.find(section) bookmarks = container.bookmarks().get(section) total = len(bookmarks) for b in batch(reversed(bookmarks)): if abort_requested(): break items = itemify_bookmarks(b) plugin.add_items(items, total) plugin.finish(sort_methods=["unsorted", "title", "video_year", "video_rating"], cache_to_disc=False)
def delete_bookmark(media_id): bookmarks = container.bookmarks() bookmarks.delete(media_id) plugin.refresh()
def add_bookmark(section, media_id, title): section = Section.find(section) bookmarks = container.bookmarks() bookmarks.add(media_id, section) # notify(lang(40308) % (Section.find(section).singular.localized, ensure_unicode(title))) plugin.refresh()