Media Manager Lists

Here’s a comprehensive list of “How To’s” for general users of this plugin based on the provided code explanations. These instructions will help users navigate through the functionalities of the Lists! and Markdown report generation features effectively:


linkHow To Use the Lists! Function

Access the Lists! Function:

Open the plugin interface where the Lists! function is available.

Input Tags for Filtering:

Select Tags [OR]:

Enter up to 10 tags in the "OR" input field. This will include notes that contain any of the specified tags.

Example: Entering work and personal retrieves notes tagged with either.

Select Tags [AND]:

Enter up to 10 tags in the "AND" input field. This will include notes that contain all specified tags.

Example: Entering meeting and urgent retrieves notes tagged with both.

Choose the Object Type:

Select the type of content you want to filter:

Attachments: Retrieve notes containing attachments.

Images: Retrieve notes containing images.

Videos: Retrieve notes containing videos.

Links: Retrieve notes containing links.

List Formatting (Currently Inactive):

Note that the list formatting options are currently commented out and default to a document format. Future updates may allow for different formats.

Run the Function:

After inputting your tags and selecting the object type, run the Lists! function. It will:

Filter notes based on your criteria.

Remove duplicates and sort the notes alphabetically.

Generate a Markdown report.

View the Report:

Once generated, the report will display the filtered notes in Markdown format with a horizontal line separating sections for clarity.


linkHow To Generate a Markdown Report for Media Attachments

Select Object Type for Media Report:

Choose the desired object type from the following options:

All-Attachments: To list all file types (e.g., .xlsx, .pdf).

All-Images: To list all image files (e.g., .jpg, .png).

All-Videos: To list all video files (e.g., .mp4, .mov).

All-Links: To list all non-attachment web links.

Prepare Your Notes:

Ensure that the notes have been pre-fetched with necessary metadata, including tags and timestamps.

Run the Script:

Execute the script to generate the Markdown report based on your selected object type.

The script will:

Retrieve attachments, images, or links from the notes.

Filter and categorize the media based on specified formats.

Review the Markdown Report:

The report will include:

A header for each media type.

Clickable links for each note and its attachments.

Tags, creation dates, and update dates displayed in the report.

Saving the Report:

The generated Markdown report will be automatically saved as a new note in Amplenote.

The note will have a timestamped title in the format MD Media Manager: List YYMMDD_HHMMSS, making it easy to locate.

You can find the note under the tag -reports/-media-manager.


linkTips for Optimal Usage

Canceling Operations:

If you decide to cancel any input prompt during the process, the function will display an alert and stop execution.

Handling No Input:

If no tags are provided, the function defaults to searching the ^vault group for notes.

No Object Type Selected:

Ensure you select an object type; otherwise, the function will not proceed and will alert you.


This guide provides clear steps for users to utilize the Lists! function and the Markdown report generation effectively.


linkDetailed Code Documentation:

linkStep-by-Step Process:

Prompting the User:
The user is prompted to select tags for filtering and an object type for categorization. The user inputs tags using either the OR or AND fields and selects the type of objects to include in the report (attachments, images, videos, or links).

Handling User Inputs:

The function extracts the user's input using de-structuring and validates the input.

If the user cancels the process or fails to select an object type, an alert is triggered, and the function stops execution.

Filtering Notes by Tags (OR and AND):

The function splits the OR tags into an array of individual tags and searches for notes matching each tag separately.

If AND tags are provided, the function searches for notes that contain all the AND tags simultaneously.

If no tags are provided, the function defaults to retrieving notes from the ^vault group.

Removing Duplicates:
After filtering, the function removes duplicate notes by converting the filteredNotes array to a Set and back to an array.

Sorting Notes:
The filtered notes are sorted alphabetically in a case-insensitive manner, using the note's name.

Generating the Markdown Report:
The final list of filtered and sorted notes is formatted into a markdown document. Each section of the report is separated by a horizontal line for better readability.


linkFunctionality Overview:

This script generates a Markdown report that organizes attachments from notes within the Amplenote app, categorized by specific file types, including:

Attachments: .xlsx, .docx, .pdf, etc.

Images: .jpg, .png, .gif, etc.

Videos: .mp4, .mov, .webm, etc.

External Links (non-attachments): General web links.

The final report is stored as a new note in the app with a timestamped title.