def add_to_library(section, media_id, folder_id):
    scraper = container.scraper()
    section = Section.find(section)
    details = scraper.get_details_cached(section, media_id)
    folder = scraper.get_folder_cached(section, media_id, folder_id)
    library_manager = container.library_manager()
    library_manager.update_folder(details, folder)
    plugin.refresh()
    if plugin.get_setting('update-xbmc-library', bool):
        plugin.update_library('video', library_manager.path)
Example #2
0
def do_search(section, name):
    plugin.set_content('movies')
    section = Section.find(section)
    sf = container.search_filter(section=section, name=str(name))
    if not make_search(sf):
        notify(lang(40312) % ensure_unicode(name))
    elif plugin.request.arg('new'):
        storage = container.search_storage()
        recent = storage.get('search_recent', [])
        if name in recent:
            recent.remove(name)
        recent.append(name)
        storage['search_recent'] = recent
        count = plugin.get_setting('search-items-count', int)
        if len(recent) > count:
            del recent[:len(recent)-count]
Example #3
0
def itemify_details(details):
    """
    :type details: Details
    :rtype: dict
    """
    item = {
        'thumbnail': details.poster,
        'path': plugin.url_for('show_folders', section=details.section.filter_val, media_id=details.media_id),
        'info': filter_dict({
            'plot': details.plot,
            'title': details.title,
            'rating': details.rating,
            'cast': details.actors,
            'studio': u" / ".join(details.studios),
            'writer': u" / ".join(details.creators),
            'premiered': details.release_date_russia or details.release_date,
            'genre': u" / ".join(unicode(g) for g in details.genres),
            'year': details.year,
            'originaltitle': u" / ".join(details.original_title),
        }),
    }
    if plugin.get_setting('use-screenshots-as-fanart', bool) and hasattr(details, 'screenshots') and details.screenshots:
        item.setdefault('properties', {})['fanart_image'] = random.choice(details.screenshots)
    return with_fanart(item)
def remove_from_library(folder_id):
    container.library_manager().remove_folder(folder_id)
    plugin.refresh()
    if plugin.get_setting('clean-xbmc-library', bool):
        plugin.clean_library('video', False)