示例#1
0
def show_files(section, media_id, folder_id):
    scraper = container.scraper()
    section = Section.find(section)
    plugin.set_content("movies")
    files = scraper.get_files_cached(section, media_id, folder_id)
    plugin.add_items(itemify_file(f) for f in files)
    plugin.finish(sort_methods=["unsorted", "title", "duration", "size"])
示例#2
0
def show_folders(section, media_id):
    section = Section.find(section)
    scraper = container.scraper()
    meta_cache = container.meta_cache()
    meta = meta_cache.setdefault(media_id, {})
    plugin.set_content("movies")
    folders = scraper.get_folders_cached(section, media_id)
    total_size = sum(f.size for f in folders)
    meta["total_size"] = total_size
    for f in folders:
        if len(f.files) == 1 and not meta.get("is_series"):
            item = itemify_file(f.files[0], can_mark_watched=1)
            item["label"] = tf.folder_file_title(f, f.files[0])
            item["context_menu"] += library_context_menu(section, media_id, f.id)
        else:
            item = itemify_folder(f)
        plugin.add_item(item)
    plugin.finish(sort_methods=["unsorted", "title", "duration", "size"])