def history_index(section):
    plugin.set_content("movies")
    section = Section.find(section)
    history = container.history()
    items = []
    for item in reversed(history.get(section)):
        items.append(
            {
                "label": item.title,
                "thumbnail": item.poster,
                "path": item.path,
                "is_playable": True,
                "context_menu": toggle_watched_context_menu()
                + bookmark_context_menu(item.media_id, item.section, item.title)
                + download_torrent_context_menu(item.url)
                + clear_history_context_menu(),
            }
        )
    return with_fanart(items)
def itemify_file(f, **kwargs):
    """
    :type f: File
    """
    item = {
        'label': tf.file_title(f),
        'context_menu':
            refresh_context_menu(f.media_id) +
            toggle_watched_context_menu() +
            download_torrent_context_menu(f.link),
        'is_playable': True,
        'stream_info': [('video', {
            'codec': f.file_format,
            'width': f.resolution[0],
            'height': f.resolution[1],
            'duration': f.duration,
        })],
        'path': plugin.url_for('play_file', section=f.section.filter_val, media_id=f.media_id,
                               url=f.link, title=f.title, **kwargs)
    }
    return with_fanart(item)