コード例 #1
0
def delete_search(name):
    storage = container.search_storage()
    if 'search_recent' in storage:
        recent = storage['search_recent']
        recent.remove(str(name))
        storage['search_recent'] = recent
    plugin.refresh()
コード例 #2
0
def turn_off_auto_refresh(section, media_id):
    section = Section.find(section)
    scraper = container.scraper()
    scraper.get_details_cached(section, media_id)
    scraper.get_folders_cached(section, media_id)
    container.details_cache().protect_item(media_id)
    container.folders_cache().protect_item(media_id)
    not_refreshing_items = container.not_refreshing_items()
    not_refreshing_items[media_id] = True
    plugin.refresh()
コード例 #3
0
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)
コード例 #4
0
def refresh(media_id):
    details_cache = container.details_cache()
    folders_cache = container.folders_cache()
    meta_cache = container.meta_cache()
    if media_id in details_cache:
        del(details_cache[media_id])
    if media_id in folders_cache:
        del(folders_cache[media_id])
    if media_id in meta_cache:
        del(meta_cache[media_id])
    plugin.refresh()
コード例 #5
0
def turn_on_auto_refresh(section, media_id):
    try:
        container.details_cache().unprotect_item(media_id)
    except KeyError:
        pass
    try:
        container.folders_cache().unprotect_item(media_id)
    except KeyError:
        pass
    not_refreshing_items = container.not_refreshing_items()
    if media_id in not_refreshing_items:
        del not_refreshing_items[media_id]
    plugin.refresh()
コード例 #6
0
def mark_watched(section, media_id):
    meta_cache = container.meta_cache()
    section = Section.find(section)
    watched_items = container.watched_items()
    meta = meta_cache.get(media_id, {})
    total_size = meta.get('total_size')
    date_added = meta.get('date_added')
    if total_size is None:
        scraper = container.scraper()
        folders = scraper.get_folders_cached(section, media_id)
        total_size = sum(f.size for f in folders)
        meta['total_size'] = total_size
        meta_cache[media_id] = meta
    watched_items.mark(media_id, True, date_added=date_added, total_size=total_size)
    plugin.refresh()
コード例 #7
0
ファイル: main.py プロジェクト: anteo/plugin.video.mediapoisk
def clear_history():
    history = container.history()
    history.clear()
    plugin.refresh()
コード例 #8
0
def clear_search_history():
    storage = container.search_storage()
    del storage['search_recent']
    plugin.refresh()
コード例 #9
0
def delete_bookmark(media_id):
    bookmarks = container.bookmarks()
    bookmarks.delete(media_id)
    plugin.refresh()
コード例 #10
0
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()
コード例 #11
0
def mark_unwatched(media_id):
    watched_items = container.watched_items()
    watched_items.mark(media_id, False)
    plugin.refresh()
コード例 #12
0
def refresh_all():
    container.details_cache().clear()
    container.folders_cache().clear()
    container.meta_cache().clear()
    container.search_cache().clear()
    plugin.refresh()
コード例 #13
0
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)